Answer the following questions true (T) or false (F)

1. There is only one kind of parameter passing in C++, namely call-by-value.
Explain.

2. The call-by-reference mechanism is specified in the function declaration and definition, using a $ between the type and the parameter.

1. False
Explanation: There is also call-by-reference. Call-by-value makes a copy of the argument then uses that, hence does not make changes to the argument. Call-by-reference effectively passes the argument hence can make changes to the argument.
2. False
Explanation: The character is an ampersand, &, not a $. It is placed between the type and the parameter to indicate a call-by-reference parameter.

Computer Science & Information Technology

You might also like to view...

To break the link between headers in different sections, click the ________ button

A) Merge B) Split C) Link to Previous D) Break Link

Computer Science & Information Technology

To compare struct variables, you compare them ____.

A. by reference B. by value C. index-wise D. member-wise

Computer Science & Information Technology