Filters
Question type

Study Flashcards

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

Consider the following declaration: int alpha[5] = {3, 5, 7, 9, 11};. Which of the following is equivalent to this statement?


A) int alpha[] = {3, 5, 7, 9, 11};
B) int alpha[] = {3 5 7 9 11};
C) int alpha[5] = [3, 5, 7, 9, 11];
D) int alpha[] = (3, 5, 7, 9, 11) ;

E) A) and B)
F) None of the above

Correct Answer

verifed

verified

Which of the following correctly declares name to be a character array and stores "William" in it?


A) char name[6] = "William";
B) char name[7] = "William";
C) char name[8] = "William";
D) char name[8] = 'William';

E) None of the above
F) B) and D)

Correct Answer

verifed

verified

Given the following declaration: Given the following declaration:   which of the following correctly finds the sum of the elements of the fifth row of sale? A)  sum = 0; For(j = 0; j < 7; j++)  Sum = sum + sale[5][j]; B)  sum = 0; For(j = 0; j < 7; j++)  Sum = sum + sale[4][j]; C)  sum = 0; For(j = 0; j < 10; j++)  Sum = sum + sale[5][j]; D)  sum = 0; For(j = 0; j < 10; j++)  Sum = sum + sale[4][j]; which of the following correctly finds the sum of the elements of the fifth row of sale?


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

E) A) and B)
F) None of the above

Correct Answer

verifed

verified

The ____________________ of an array is the address (that is, the memory location) of the first array component.

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

When you pass an array as a parameter, the base address of the actual array is passed to the formal parameter.

A) True
B) False

Correct Answer

verifed

verified

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

What is the value of alpha[2] after the following code executes? What is the value of alpha[2] after the following code executes?   A)  1 B)  4 C)  5 D)  6


A) 1
B) 4
C) 5
D) 6

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

Correct Answer

verifed

verified

C

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

Consider the following statement: double alpha[10][5];. The number of components of alpha is ____.


A) 15
B) 50
C) 100
D) 150

E) All of the above
F) B) 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) None of the above
F) All of the above

Correct Answer

verifed

verified

A

A collection of a fixed number of elements (called components) arranged in n dimensions (n >= 1) is called a(n) ____.


A) matrix
B) vector
C) n-dimensional array
D) parallel array

E) None of the above
F) B) 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 C)
F) A) and B)

Correct Answer

verifed

verified

C

After the following statements execute, what are the contents of matrix? After the following statements execute, what are the contents of matrix?   A)  0 0 1 1 2 2 B)  0 1 2 3 4 5 C)  0 1 1 2 2 3 D)  1 1 2 2 3 3


A) 0 0
1 1
2 2
B) 0 1
2 3
4 5
C) 0 1
1 2
2 3
D) 1 1
2 2
3 3

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

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 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 D)
F) B) and D)

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) A) and B)
F) A) and C)

Correct Answer

verifed

verified

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

In a(n) ____________________ data type, each data item is a collection of other data items.

Correct Answer

verifed

verified

Showing 1 - 20 of 40

Related Exams

Show Answer