WorksheetsCSC404 Quiz 1
Total questions: 10
Worksheet time: 13mins
The function prototype for function display() is given below:
void display (int x, int y, float z);
Which of the following function call is VALID?
A = display (int x, int y, float z);
display (x, y, z);
display (int x, int y, float z);
A = display (x, y, z);
Given the following C++ program segment, determine the final value of variable current.
3
4
6
7
A function can send data to other function and it can also receive values sent by other functions. Data can be shared between functions through the following:
i. Global variable
ii. Local variable
iii. Parameter passing
iv. A return value
i, ii, iii and iv
i, ii and iii
i, iii and iv
iii and iv
Given the following statements:
char x;
x = findChar (20, 10, 'a');
Which of the following function prototype is VALID for the function findChar()?
void findChar (int, int, char);
void findChar (int &, int &, int);
char findChar (int, int, char);
char findChar (int &, int &, char);
Which of the following is FALSE about parameter and function calls?
The number of actual parameters should agree with the number of formal parameters.
The data type of each actual parameters should match the data type of the corresponding formal parameters.
The name of each actual parameter should be identical to the name of the corresponding formal parameters.
When you pass information to a function by value, the function stores the value of each item.
Given the following C++ program fragment, which of the following answer is the correct function prototype for guess (...)?
bool guess (int);
void guess (int);
void guess (bool);
void guess (int &);
What are the outputs of the following C++ code?
98 98
98 98
35 98
98 98
35 98
35 98
35 35
35 35
Which of the following is the proper declaration of pointer?
int x;
int &x;
ptr x;
int *x;
The two operators used in dynamic memory allocation are
new and null
new and delete
allocate and remove
allocate and dealloc
What is the output of the following program segment?
First number is 40
First number is 60
First number is 100
40
