Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CSC404 Quiz 1

Total questions: 10

Worksheet time: 13mins

Name
Class
Date
1.

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)

A = display (int x, int y, float z);

b)

display (x, y, z);

c)

display (int x, int y, float z);

d)

A = display (x, y, z);

2.

Given the following C++ program segment, determine the final value of variable current.

a)

3

b)

4

c)

6

d)

7

3.

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

a)

i, ii, iii and iv

b)

i, ii and iii

c)

i, iii and iv

d)

iii and iv

4.

Given the following statements:


char x;

x = findChar (20, 10, 'a');


Which of the following function prototype is VALID for the function findChar()?

a)

void findChar (int, int, char);

b)

void findChar (int &, int &, int);

c)

char findChar (int, int, char);

d)

char findChar (int &, int &, char);

5.

Which of the following is FALSE about parameter and function calls?

a)

The number of actual parameters should agree with the number of formal parameters.

b)

The data type of each actual parameters should match the data type of the corresponding formal parameters.

c)

The name of each actual parameter should be identical to the name of the corresponding formal parameters.

d)

When you pass information to a function by value, the function stores the value of each item.

6.

Given the following C++ program fragment, which of the following answer is the correct function prototype for guess (...)?

a)

bool guess (int);

b)

void guess (int);

c)

void guess (bool);

d)

void guess (int &);

7.

What are the outputs of the following C++ code?

a)

98 98

98 98

b)

35 98

98 98

c)

35 98

35 98

d)

35 35

35 35

8.

Which of the following is the proper declaration of pointer?

a)

int x;

b)

int &x;

c)

ptr x;

d)

int *x;

9.

The two operators used in dynamic memory allocation are

a)

new and null

b)

new and delete

c)

allocate and remove

d)

allocate and dealloc

10.

What is the output of the following program segment?

a)

First number is 40

b)

First number is 60

c)

First number is 100

d)

40