Filters
Question type

Study Flashcards

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 << array2 // Output the elements stored in array 2.
C) array2 = 5; // Place a 5 in each element of array2.
D) None of the above.
E) A and B, but not C.

F) All of the above
G) C) and E)

Correct Answer

verifed

verified

In C++ If you attempt to store more data in an array than it can hold, the compiler will issue an error.

A) True
B) False

Correct Answer

verifed

verified

An individual array element can be processed or passed to a function just like a regular C++ variable.

A) True
B) False

Correct Answer

verifed

verified

The amount of memory used by an array depends upon the array's data type and how many elements it can hold.

A) True
B) False

Correct Answer

verifed

verified

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.

F) A) and E)
G) A) and D)

Correct Answer

verifed

verified

A two-dimensional array can be viewed as


A) two rows of values.
B) two columns of indexes.
C) a table with rows and columns.
D) any of the above.
E) none of the above.

F) B) and E)
G) C) and D)

Correct Answer

verifed

verified

Unlike regular variables, arrays can hold multiple


A) data types.
B) named constants.
C) values.
D) variables.
E) operators.

F) A) and B)
G) C) and D)

Correct Answer

verifed

verified

The range-based for loop may be used with arrays, but not with vectors.

A) True
B) False

Correct Answer

verifed

verified

An element of a two-dimensional array is referenced by the array name and two subscripts, first the element row number and then the element column number.

A) True
B) False

Correct Answer

verifed

verified

Subscript numbering in C++


A) can be set at run time.
B) can begin with a programmer-defined value.
C) varies from program to program.
D) automatically begins with zero.
E) automatically begins with one.

F) A) and E)
G) D) and E)

Correct Answer

verifed

verified

If employee is an array of objects with a public member function named setHoursWorked, which of the following statements correctly calls that function for the employee object in array element 5?


A) employee.setHoursWorked[5] = 40;
B) employee[5].setHoursWorked = 40;
C) employee.setHoursWorked[5](40) ;
D) employee[5].setHoursWorked(40) ;
E) setHoursWorked(employee[5], 40) ;

F) A) and B)
G) C) and D)

Correct Answer

verifed

verified

The following two arrays string deptName[3] = {"Manufacturing", "Sales", "Business Office") ; Double deptBudget[3] = {200000.0, 60000.0, 50000.0}; Are an example of ________ arrays.


A) two-dimensional
B) paired
C) linked
D) parallel
E) brother

F) A) and B)
G) B) and C)

Correct Answer

verifed

verified

The following statement is a valid C++ array definition. double money[25.00];

A) True
B) False

Correct Answer

verifed

verified

Arrays can be passed to functions, but individual array elements cannot be.

A) True
B) False

Correct Answer

verifed

verified

By using the same ________ you can build relationships between data stored in two or more arrays.


A) array name
B) data
C) subscript
D) arguments
E) data type

F) D) and E)
G) A) and E)

Correct Answer

verifed

verified

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.

F) A) and B)
G) All of the above

Correct Answer

verifed

verified

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


A) a copy of all the values in
B) the value stored in the first element of
C) the starting memory address of
D) the data type and size of
E) none of the above

F) A) and E)
G) A) and D)

Correct Answer

verifed

verified

If the scores array is defined like this: int scores[ ]= {4, 7, 4, 8, 9}; What will the following statement display? Cout << scores[4];


A) 4
B) 7
C) 8
D) 9
E) the first four scores

F) B) and E)
G) A) and B)

Correct Answer

verifed

verified

To add up all the values in a two-dimensional array it would be best to use


A) one for loop
B) two separate for loops
C) a nested for loop
D) no loop
E) one sentinel controlled loop

F) A) and E)
G) A) and D)

Correct Answer

verifed

verified

If employee is an array of objects with a public member function named setHourlyWage, the following statement correctly calls this method for employee[2]. employee.setHourlyWage[2](20.00);

A) True
B) False

Correct Answer

verifed

verified

Showing 21 - 40 of 40

Related Exams

Show Answer