1) Pam the Programmer wants to write a nice, powerful function that can be used
ID: 3662812 • Letter: 1
Question
1) Pam the Programmer wants to write a nice, powerful function that can be used in many different circumstances. She wants to be sure that her function never alters the values of the runtime values sent by the calling program to her function. What kind of parameters should she use?
Select one:
a. pass-by-reference parameters
b. pass-by-value parameters
c. pass-by-name parameters
d. array parameters
2) Commenting your C++ code is very important because
Select one:
a. All of the choices listed are correct
b. a few days after you first write it, you might need to make changes and will have lost your train of thought unless you explicitly state what you are trying to do
c. very often, a programming project involves many individuals who will want to understand how your code works, even though you were its sole author
d. many years from now, it might need to be maintained by someone else who will not know what you meant your code to do
3) In the computation: a = b * c + f / g;
C++ will calculate the answer by performing
Select one:
a. the multiplication and division first, followed by the addition and subtraction
b. the subtraction and addition first, followed by the multiplication and division
c. the division and subtraction first, followed by the multiplication and addition
d. the addition and division first, followed by the multiplication and subtraction
4) When using a return statement, the parenthesis around the value being returned to the calling program are
Select one:
a. required only in certain circumstances
b. never allowed
c. required
d. optional
5) Consider the expression: &&( false !( true || false )
Select one:
a. At run-time, this expression evaluates to the value false
b. Due to run-time errors, this expression cannot be evaluated
c. Due to syntax errors, this expression cannot be compiled successfully
d. At run-time, this expression evaluates to the value true
6) Each statement in C++ ends with a
Select one:
a. pound sign (that is a #) and more than one statement can be present on a single textual line of code
b. new line and only one statement can be present on a single textual line of code
c. semicolon (that is a ;) and only one statement can be present on a single textual line of code
d. semicolon (that is a ;) and more than one statement can be present on a single textual line of code
7) When evaluating a complex expression that lack parenthesis such as
x = a + b - c * d / e + f;
C++ will always calculate the answer running * and / before + and - computing the answer as if the user entered
x = (((a + b) - ((c * d) / e)) + f);
Select one:
True
False
8) Which statement does a program use to change the value of a variable at run-time?
Select one:
a. An assignment statement
b. A #include statement
c. An if statement
d. A while statement
Explanation / Answer
The correct answers are following:
1. b. pass-by-value parameters
2. a. All of the choices listed are correct
3. a. the multiplication and division first, followed by the addition and subtraction
4. c. required
5. c. Due to syntax errors, this expression cannot be compiled successfully
6. d. semicolon (that is a ;) and more than one statement can be present on a single textual line of code
7. False
8. d. A while statement
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.