Chapter 8 Arrays and Vectors PDF

Summary

This document is a past paper on arrays and vectors from the textbook \"Starting Out with C++: Early Objects\", 10th edition. It includes questions and answers. It is suitable for undergraduate computer programming students

Full Transcript

Starting Out with C++: Early Objects, 10th ed. (Gaddis, Walters, and Muganda) Chapter 8 Arrays and Vectors Chapter 8 Test 1 1) Unlike regular variables, arrays can hold multiple A) data types. B) named constants. C) values. D) variables. E) operators. Answer: C 2) True/False: The amount of memory...

Starting Out with C++: Early Objects, 10th ed. (Gaddis, Walters, and Muganda) Chapter 8 Arrays and Vectors Chapter 8 Test 1 1) Unlike regular variables, arrays can hold multiple A) data types. B) named constants. C) values. D) variables. E) operators. Answer: C 2) True/False: The amount of memory used by an array depends solely on the number of elements the array can hold. Answer: FALSE 3) To access an array element, use the array name and the element's A) name. B) data type. C) value. D) subscript. E) size declarator. Answer: D 4) True/False: If a C++ program contains the following array definition int score; the following statement would store 100 in the first array element: score = 100; Answer: FALSE 5) The statement int grades[ ] = { 100, 90, 99, 80 }; is an example of A) default arguments. B) an illegal array declaration. C) an illegal array initialization. D) data encapsulation. E) implicit array sizing. Answer: E 6) Which of the following statements correctly initialize the value variable? A) int value = 8; B) int value{8}; C) int value(8); D) All of the above. E) Both A and B, but not C. 1 Copyright © 2020 Pearson Education, Inc. Answer: D 7) Which of the following statements will correctly carry out the operation stated in the comment to its right. A) array 2 = array1 // Copy the elements of array 1 into array 2. B) cout

Use Quizgecko on...
Browser
Browser