Filters
Question type

Study Flashcards

Which of the following correctly declares and initializes alpha to be an array of four rows and three columns with the component type int?


A) int alpha[4][3] = {{0,1,2} {1,2,3} {2,3,4} {3,4,5}};
B) int alpha[4][3] = {0,1,2; 1,2,3; 2,3,4; 3,4,5};
C) int alpha[4][3] = {0,1,2: 1,2,3: 2,3,4: 3,4,5};
D) int alpha[4][3] = {{0,1,2}, {1,2,3}, {2,3,4}, {3,4,5}};

E) B) and C)
F) A) and D)

Correct Answer

verifed

verified

What is the output of the following C++ code? What is the output of the following C++ code?   A)  2 4 6 8 10 B)  4 3 2 1 0 C)  8 6 4 2 0 D)  10 8 6 4 2


A) 2 4 6 8 10
B) 4 3 2 1 0
C) 8 6 4 2 0
D) 10 8 6 4 2

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

Assume you have the following declaration double salesData[1000];.Which of the following ranges is valid for the index of the array salesData?


A) 0 through 999
B) 0 through 1000
C) 1 through 1001
D) 1 through 1000

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

Correct Answer

verifed

verified

Given the following declaration:int j; int sum; Double sale[10][7]; Which of the following correctly finds the sum of the elements of the fourth column of sale?


A) sum = 0;
For(j = 0; j < 7; j++)
Sum = sum + sale[j][3];
B) sum = 0;
For(j = 0; j < 7; j++)
Sum = sum + sale[j][4];
C) sum = 0;
For(j = 0; j < 10; j++)
Sum = sum + sale[j][4];
D) sum = 0;
For(j = 0; j < 10; j++)
Sum = sum + sale[j][3];

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

Correct Answer

verifed

verified

D

For a list of length n, the ____________________ sort makes exactly (n(n - 1))/2 key comparisons and 3(n - 1) item assignments.

Correct Answer

verifed

verified

Assume you have the following declaration char nameList[100];.Which of the following ranges is valid for the index of the array nameList?


A) 0 through 99
B) 0 through 100
C) 1 through 100
D) 1 through 101

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

Consider the following statement: int alpha[25][10];.Which of the following statements about alpha is true?


A) Rows of alpha are numbered 0...24 and columns are numbered 0...9.
B) Rows of alpha are numbered 0...24 and columns are numbered 1...10.
C) Rows of alpha are numbered 1...24 and columns are numbered 0...9.
D) Rows of alpha are numbered 1...25 and columns are numbered 1...10.

E) A) and D)
F) A) and C)

Correct Answer

verifed

verified

What is the output of the following C++ code? What is the output of the following C++ code?   A)  0 1 2 3 4 B)  0 5 10 15 C)  0 5 10 15 20 D)  5 10 15 20


A) 0 1 2 3 4
B) 0 5 10 15
C) 0 5 10 15 20
D) 5 10 15 20

E) B) and D)
F) A) and B)

Correct Answer

verifed

verified

In C++, the null character is represented as ____.


A) '\0'
B) "\0"
C) '0'
D) "0"

E) B) and C)
F) A) and D)

Correct Answer

verifed

verified

Consider the following declaration:char charArray[51]; char discard; Assume that the input is:Hello There! How are you? What is the value of discard after the following statements execute? Consider the following declaration:char charArray[51]; char discard; Assume that the input is:Hello There! How are you? What is the value of discard after the following statements execute?   A)  discard = ' ' (Space)  B)  discard = '!' C)  discard = '\n' D)  discard = '\0'


A) discard = ' ' (Space)
B) discard = '!'
C) discard = '\n'
D) discard = '\0'

E) B) and C)
F) A) and D)

Correct Answer

verifed

verified

C

If an array index goes out of bounds, the program always terminates in an error.

A) True
B) False

Correct Answer

verifed

verified

The one place where C++ allows aggregate operations on arrays is the input and output of C-strings.

A) True
B) False

Correct Answer

verifed

verified

True

Suppose list is a one dimensional array of size 25, wherein each component is of type int.Further, suppose that sum is an int variable.The following for loop correctly finds the sum of the elements of list. Suppose list is a one dimensional array of size 25, wherein each component is of type int.Further, suppose that sum is an int variable.The following for loop correctly finds the sum of the elements of list.

A) True
B) False

Correct Answer

verifed

verified

Consider the statement int list[10][8];.Which of the following about list is true?


A) list has 10 rows and 8 columns.
B) list has 8 rows and 10 columns.
C) list has a total of 18 components.
D) list has a total of 108 components.

E) B) and D)
F) A) and C)

Correct Answer

verifed

verified

Arrays can be passed as parameters to a function by value, but it is faster to pass them by reference.

A) True
B) False

Correct Answer

verifed

verified

What is the output of the following C++ code? What is the output of the following C++ code?   A)  0 5 10 15 20 B)  5 10 15 20 0 C)  5 10 15 20 20 D)  Code results in index out-of-bounds


A) 0 5 10 15 20
B) 5 10 15 20 0
C) 5 10 15 20 20
D) Code results in index out-of-bounds

E) A) and B)
F) B) and C)

Correct Answer

verifed

verified

The form of the for loop shown below is called a(n) ____________________ for loop. for (dataType identifier : arrayName) statements ​

Correct Answer

verifed

verified

range-base...

View Answer

Assume you have the following declaration int beta[50];.Which of the following is a valid element of beta?


A) beta['2']
B) beta['50']
C) beta[0]
D) beta[50]

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

The statement int list[25]; declares list to be an array of 26 components, since the array index starts at 0.

A) True
B) False

Correct Answer

verifed

verified

All components of an array are of the same data type.

A) True
B) False

Correct Answer

verifed

verified

Showing 1 - 20 of 40

Related Exams

Show Answer