wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CSNP-04103 Chapter 6 - Functions

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What are the methods used to pass parameters to a function in C++?

a)

Call by memory

b)

Call by reference

c)

Call by duplicating the argument

d)

Call by value

2.

Select all that apply. Functions can:

a)

Return no value

b)

Return exactly one value

c)

Return more than one value

d)

None of the above

3.

In C++ What is the symbol used to tell the compiler that you are sending a parameters to a function by reference?.

a)

&&

b)

@

c)

*

d)

&

4.

In C++ when sending parameters by reference the & is placed.

a)

&<Data Type>

b)

<Data Type>&

c)

<Data Type> <Variable Name>&

d)

<Data Type> <Constant Name>&

5.

In C++ if you are calling a function passing parameters by reference, the function itself must be of type:.

a)

void

b)

int

c)

float

d)

string

6.

In C++ When passing parameters by reference to a function, you are passing:

a)

A copy of the value in the calling function.

b)

The value of the parameters in the calling function

c)

The memory address of the variable in the calling function

d)

None of the above.

7.

In C++, If you need to send a value to a function by using parameters, and you do not need to return anything from the function, what type of call will you use:

a)

Call by Value

b)

Call by Reference

c)

Call by Cellular phone

d)

A void call

8.

In C++, if a function receives a parameter by reference and it changes the value, what happens?.

a)

Nothing

b)

The value of the variable in the calling function will be changed as well

c)

You will get a compiler error

d)

Unlimited loop

9.

When calling a function by reference, does C++ makes any distinction between an output and input / output parameters?.

a)

Yes

b)

No

10.

In C++ when using functions, what is an alternative to get values back to the calling function other than a call by reference or using global variables?

a)

There is no alternative

b)

Use the return clause

c)

Use a void function

d)

Make a call by value