Exam 8: Arrays

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

On each iteration of the following range-based for loop for (int element : myArray) Cout << element << endl; The variable element holds

Free
(Multiple Choice)
4.8/5
(40)
Correct Answer:
Verified

A

After carrying out the following two statements, sales will have been created as a one-dimensional array that can hold 20 double values. typedef salesArray double[20]; salesArray sales;

Free
(True/False)
4.9/5
(38)
Correct Answer:
Verified

True

The amount of memory used by an array depends solely on the number of elements the array can hold.

Free
(True/False)
4.8/5
(29)
Correct Answer:
Verified

False

An array can store multiple values, but the values must be

(Multiple Choice)
4.9/5
(32)

When you create a vector it is unnecessary to specify how many elements it will hold because it will expand in size as you add new values to it.

(True/False)
4.8/5
(33)

The elements of an array can be

(Multiple Choice)
4.7/5
(32)

To access an array element, use the array name and the element's

(Multiple Choice)
4.8/5
(37)

What does the following statement do? Typedef int oneDArray[20];

(Multiple Choice)
4.8/5
(32)

The size of an array is the number of elements that have data stored in them.

(True/False)
4.7/5
(34)

When an array is passed to a function, it is actually ________ the array that is passed.

(Multiple Choice)
4.9/5
(36)

The following statement for(int val : myArray) Cout << val << " "; Is an example of a(n)

(Multiple Choice)
4.8/5
(43)

Any of the following statements can be used to initialize the integer variable num to 7; int num = 7; int num(7); int num{7};

(True/False)
4.9/5
(32)

You can assign the contents of one array to another by using

(Multiple Choice)
4.8/5
(34)

The following array definition is legal because C++ allows arrays to be implicitly sized. int grades[ ];

(True/False)
4.8/5
(45)

An array can be returned by a function as well as passed to a function.

(True/False)
4.8/5
(26)

Elements of vectors can be access by using the vector name and a subscript, similarly to how array elements are accessed.

(True/False)
4.9/5
(31)

Each individual element of an array can be accessed by the array name and an element number, called a subscript.

(True/False)
4.9/5
(33)

If a C++ program contains the following array definition int score[10]; the following statement would store 100 in the first array element: score[1] = 100;

(True/False)
4.8/5
(44)

When you pass an array as an argument to a function, the function can modify the contents of the array.

(True/False)
4.7/5
(35)

To step through a one-dimensional array, accessing the elements one by one, it would be most appropriate to use ________ loop.

(Multiple Choice)
4.8/5
(38)
Showing 1 - 20 of 40
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)