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

1. What is the effect ofthe following recursive function? void Mystery(int A[ ],

ID: 3610235 • Letter: 1

Question

1. What is the effect ofthe following recursive function?

void Mystery(int A[ ], intsize)
{
      if (size > 0) {A[0] = 0; Mystery(A+1, size -1);}
}

A) It sets the firstelement of the array A to zero.
B) It sets the last element of the array A to zero.
C) It sets all elements of the array A to zero.
D) It generates an infinite recursion loop.


2. An #include file will usually contain:
A) constants defined with #define.
B) function prototypes.
C) type definitions.
D) all of the above.

3.   What is theeffect of the following code?
char Ch;
Ch = '7';
printf("%d ", Ch);

A) It will cause anerror
B) It will print out the computer's internal code for the character'7'
C) It will print out the character '7'
D) It will print out the character whose internal code is7


4. The most common reason for using a macro instead of a functionis:
A) to save storage space.
B) to reduce the possibility of errors.
C) to make the program run faster.
D) all of the above.

5. What is the two'scomplement of -Y (negative Y)?

X=1100110000110011
Y=0000111100001010

A) 0000111100001010
B) 1111000011110101
C) 1111000011110110
D) 1100000000110001

6. What is the advantageof using a pointer to a structure as a parameter to a function,instead of the structure itself?
A) The code is easier to read.
B) It is more efficient because the structure is not copied.
C) There is no difference; it is a matter of style which isused.
D) Passing a structure as a parameter is not allowed.

Explanation / Answer

1. What is the effect ofthe following recursive function?

void Mystery(int A[ ], intsize)
{
      if (size > 0) {A[0] = 0; Mystery(A+1, size -1);}
}

A) It sets the firstelement of the array A to zero.
B) It sets the last element of the array A to zero.
C) It sets all elements of the array A tozero.
D) It generates an infinite recursion loop.


2. An #include file will usually contain:
A) constants defined with #define.
B) function prototypes.
C) type definitions.
D) all of the above.

3.   What is theeffect of the following code?
char Ch;
Ch = '7';
printf("%d ", Ch);

A) It will cause anerror
B) It will print out the computer's internal codefor the character '7'
C) It will print out the character '7'
D) It will print out the character whose internal code is7



4. The most common reason for using a macro instead of a functionis:
A) to save storage space.
B) to reduce the possibility of errors.
C) to make the program run faster.
D) all of the above.


5. What is the two'scomplement of -Y (negative Y)?

X=1100110000110011
Y=0000111100001010

A) 0000111100001010
B) 1111000011110101
C) 1111000011110110
D) 1100000000110001



6. What is the advantageof using a pointer to a structure as a parameter to a function,instead of the structure itself?
A) The code is easier to read.
B) It is more efficient because the structure is not copied.
C) There is no difference; it is a matter of style which isused.
D) Passing a structure as aparameter is not allowed.      This wastrue in older versions ofC