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

1. The following codefragment invokes a function named InitToZero: Int alpha[10]

ID: 3608886 • Letter: 1

Question

1.       The following codefragment invokes a function named InitToZero:

Int alpha[10] [20];

InitToZero(alpha);

Which of the following is a valid function heading forInitToZero?

A)     Void InitToZero( int beta [] [] )

B)      Void InitToZero( int beta [10][20] )

C)      Void InitToZero( int beta [10][] )

D)     Void InitToZero( int beta [] [20])

2.       Which of the followingcannot be used to input values into a 3-element int array Named alpha?

A)     Cin >> alpha[0] >> alpha[1] >> alpha[2];

B)      Cin >> alpha;

C)      For (I = 0; I < 3; i++)

          Cin>> alpha [i];

D)     Cin >> alpha[0];

         Cin >>alpha[1];

         Cin>> alpha[2];

3.       Which of the followingstatements about C++ arrays is true?

A)     Array components cannot be offloating-point types.

B)      The index type of aone-dimensional array can be any data type.

C)      An array component can betreated as a simple variable of its component type.

D)     A and b

E)      A,b, and c

4.       Which of the followingstatements about passing C++ arrays as arguments is false?

A)     It is impossible to pass an array byvalue.

B)      When declaring an array in afunction’s parameter list, you do not attach an ampersand

(&) to the name of the component type.

C)      When declaring aone-dimensional array in a function’s parameter list, youmust include its size within square brackets.

D)     At run time, the base address of theargument is passed to the function.

Explanation / Answer

1.       The following codefragment invokes a function named InitToZero:

Int alpha[10] [20];

InitToZero(alpha);

Which of the following is a valid function heading forInitToZero?

A)     Void InitToZero( int beta [] [] )

B)      Void InitToZero( int beta [10][20] )

C)      VoidInitToZero( int beta [10] [] )

D)     Void InitToZero( int beta [] [20])

2.       Which of the followingcannot be used to input values into a 3-element int array Named alpha?

A)     Cin >> alpha[0] >> alpha[1] >> alpha[2];

B)      Cin>> alpha;

C)      For (I = 0; I < 3; i++)

          Cin>> alpha [i];

D)     Cin >> alpha[0];

         Cin >>alpha[1];

         Cin>> alpha[2];

3.       Which of the followingstatements about C++ arrays is true?

A)     Arraycomponents cannot be of floating-point types.

B)      The index type of aone-dimensional array can be any data type.

C)      An array component can betreated as a simple variable of its component type.

D)     A and b

E)      A,b, and c

4.       Which of the followingstatements about passing C++ arrays as arguments is false?

A)     It is impossible to pass an array byvalue.

B)      When declaring an array in afunction’s parameter list, you do not attach an ampersand

(&) to the name of the component type.

C)      Whendeclaring a one-dimensional array in a function’s parameterlist, you must include its size within squarebrackets.

D)     At run time, the base address of theargument is passed to the function.