Question: 6 .When allocating an array of objects, what constructor is used to initialize all of the objects in the array? A. The automatic copy constructor.
6 .When allocating an array of objects, what constructor is used to initialize all of the objects in the array?
A. The automatic copy constructor.
B. The constructor specified at the declaration.
C. The default constructor.
D. None of the above.
7. In which location do dynamic variables reside?
A. The code segment.
B. The data segment.
C. The heap.
D. The run-time stack.
8. When should a pointer parameter p be a reference parameter?
A. When the function changes p, and you want the change to affect the actual pointer argument.
B. When the function changes p, and you do NOT want the change to affect the actual pointer argument.
C. When the function changes *p, and you want the change to affect the the object that is pointed at.
D. When the function changes *p, and you do NOT want the change to affect the the object that is pointed at.
E. When the pointer points to a large object.
9. Suppose you have the following function prototype and variable declaration:
void goop(int z[ ]);
int x[10];
Which is the correct way to call the goop function with x as the argument:
A. goop(x);
B. goop(x[ ]);
C. goop(x[10]);
D. goop(&x);
E. goop(&x[ ]);
10. Suppose that the goop function from the previous question changes the value of z[1]. Does this change effect the value of the actual argument?
A. Yes
B. No
11. Here is a function declaration:
void goo(int* x)
{
*x = 1;
}
Suppose that a is an int* variable pointing to some integer, and *a is equal to zero. What is printed if you print *a after the function call goo(a)?
A. 0
B. 1
C. address of a
D. address of x
E. None of the above
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
