Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Which of the following statements (a-d) about Table are true if the array Tab

ID: 3705012 • Letter: 1

Question

1. Which of the following statements (a-d) about Table are true if the array Table if is defined as follows: float Table[] = { 0.9, 0.8, 0.7, 0.6 };

A. There will be a compiler error because there is no value specified inside of the square brackets.

B. Table[1] contains the value 0.9

C. There are actually 5 values stored in table: the four listed above and the null terminator as the fifth element

D. There will be a compiler error because an array cannot be initialized when it is declared.

E. All of the statements (a-d) are false.

______________________________________________________________________________________

2.

The unsubscripted name of an array is __________

A. the address of the array.

B. what is used in calls to functions that expect an array to be passed.

C. both a and b are correct

_____________________________________________________________________

3/

Which of the following "chunks" of C++ code will print the contents of an array called ar that has been defined to hold 25 integer values and has been initialized with 25 integer values.

A. cout << ar;

C. for( int sub = 0; sub < 25; sub++ )

   cout << ar[sub] << " ";

D. for( int sub = 0; sub < 25; sub++ );

cout << ar[sub] << " ";

_____________________________________________________________________

4. What will happen if a variable of type char called ch is typecasted as an integer and cout-ed? cout << (int) ch;

The character will be displayed

The cout statement will produce a run-time error

The ASCII value of the character will be displayed

The cout statement will not compile

_________________________________________________________________

5. The following line of code: temp = numAr[8];

copies the value from the variable temp into position 8 of numAr

copies the value from position 8 of numAr into the variable temp

copies 8 values from numAr into the variable temp

copies 8 into the variable temp

A. There will be a compiler error because there is no value specified inside of the square brackets.

B. Table[1] contains the value 0.9

C. There are actually 5 values stored in table: the four listed above and the null terminator as the fifth element

D. There will be a compiler error because an array cannot be initialized when it is declared.

E. All of the statements (a-d) are false.

______________________________________________________________________________________

2.

The unsubscripted name of an array is __________

A. the address of the array.

B. what is used in calls to functions that expect an array to be passed.

C. both a and b are correct

_____________________________________________________________________

3/

Which of the following "chunks" of C++ code will print the contents of an array called ar that has been defined to hold 25 integer values and has been initialized with 25 integer values.

A. cout << ar;

  B.for( int sub = 0; sub == 25; sub++ )
     cout << ar[sub] << " ";

C. for( int sub = 0; sub < 25; sub++ )

   cout << ar[sub] << " ";

D. for( int sub = 0; sub < 25; sub++ );

cout << ar[sub] << " ";

_____________________________________________________________________

4. What will happen if a variable of type char called ch is typecasted as an integer and cout-ed? cout << (int) ch;

A.

The character will be displayed

B.

The cout statement will produce a run-time error

C.

The ASCII value of the character will be displayed

D.

The cout statement will not compile

_________________________________________________________________

5. The following line of code: temp = numAr[8];

A.

copies the value from the variable temp into position 8 of numAr

B.

copies the value from position 8 of numAr into the variable temp

C.

copies 8 values from numAr into the variable temp

D.

copies 8 into the variable temp

Explanation / Answer

Question 1

Answer:

A. There will be a compiler error because there is no value specified inside of the square brackets.

Question 2

Answer:

A. the address of the array.

Question 3

Answer:

C. for( int sub = 0; sub < 25; sub++ )

cout << ar[sub] << " ";

Question 4

Answer:

c.The ASCII value of the character will be displayed

Question 5

Answer:

B. copies the value from position 8 of numAr into the variable temp