C++ coding multiple choice exam

see attachment

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

  

Questions 1 – 5 are True/False. Mark A for True and B for False.

1.

In C++, the variables total and ToTaL are NOT considered to be the same variable.
A) True
B) False

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

2.

The body of a while loop is only executed if the loop condition is false.
A) True
B) False

3.

Pseudocode is considered a “high level” programming language.
A) True
B) False

4.

An expression containing the operator && is true only if both its operands are true.
A) True
B) False

5.

else if statements are tested sequentially until a match occurs.
A) True
B) False
 
Questions 6 – 15 are Multiple Choice and worth 1 point each.

6.

Which of the following is a valid constant declaration?
A) const FRED int = 5;
B) int const FRED = 5;
C) int FRED const = 5;
D) const int FRED = 5;
E) FRED const int = 5;

7.

const, while, if, and int are examples of:
A) reserved (key) words
B) identifiers
C) variables
D) compiler directives
E) program comments

8.

Which of the following is a valid C++ assignment statement?
A) x = q – (y * z);
B) y + z = x;
C) y = b * c
D) x = (x + (y z);
E) x = a b;

9.

The formula:
    
can be represented in C++ as:
A) x = a – b / c – d;
B) x = a – b / (c – d);
C) x = (a – b) / (c – d);
D) x = (a – b) / c – d;
E) (a – b) / (c – d) = x;

10.

Which of the following is a valid variable name?
A) 2ndName
B) %Last_Name
C) year03
D) @Month
E) #55

11.

Which library must be included to enable keyboard input?
A) iomanip
B) cstdlib
C) input
D) iostream
E) kbdin

12.

Which of the following is an invalid variable name?
A) Part time
B) part_time
C) full_time_job
D) FullTime
E) _Parttime

13.

Which library must be included to enable formatted output?
A) output
B) scrnout
C) format
D) cstdlib
E) iomanip

14.

Which of the following is an invalid variable name?
A) _64
B) 64_
C) Sum_
D) _S_u_m_
E) _Sum

15.

What is the comment section at the beginning of a program that gives information about the author and the program called?
A) prologue
B) prelude
C) heading
D) preliminaries
E) foreword
Questions 16 – 19 are Matching and worth 1 point each.
A. sentinel          B. running total          C. cin          D. condition          E. counter

16.

A __________ is evaluated to true or false each time an if statement is encountered in code.
A) sentinel
B) running total
C) cin
D) condition
E) counter

17.

A while loop that is controlled by the user ends with a __________ value.
A) sentinel
B) running total
C) cin
D) condition
E) counter

18.

A while loop that runs a pre-determined number of times is controlled by a __________.
A) sentinel
B) running total
C) cin
D) condition
E) counter

19.

A variable that accumulates the sum of numbers entered by the user is accumulating a __________.
A) sentinel
B) running total
C) cin
D) condition
E) counter
 
For Questions 20 – 24, determine the logical value of the comparison. Mark A for True and B for False.
 
Assume that a=10, b=6, c=10, and d=8.

20.

a == b
A) True
B) False

21.

c < d A) True B) False

22.

c == a
A) True
B) False

23.

a >= c || b >= d
A) True
B) False

24.

(c < b && d < b) || (a != c) A) True B) False   Trace through the following Code:

25.

for (i = 3; i <= 6; i++) {            cout << "*"; } A) * B) ** C) *** D) **** E) 3 4 5 6 Consider the following code for Questions 26 and 27: int count = 10; int num = 4; do {       if ((count % 2) == 1)       {            num += 3;       }       else       {            num -= 2;       }       count--; } while (count > 5);

26.

What is the value of count after the following code is executed? This question is worth 2 points.
A) 1
B) 10
C) 5
D) 4
E) 2

27.

What is the value of num after the following code is executed? This question is worth 2 points.
A) 1
B) 10
C) 5
D) 4
E) 2
 
For Questions 28 – 30, determine the result of each expression.

28.

3 * 3 + 3 / 3 – 3 % 3
A) 0
B) 10
C) 1
D) 4
E) 3

29.

6 * (8 – 12 / 2) + 9 / 3
A) 1
B) 10
C) 5
D) 4
E) 15

30.

(8 – 3) % 2 + 12 / 4
A) 1
B) 10
C) 5
D) 4
E) 15

Still stressed from student homework?
Get quality assistance from academic writers!

Order your essay today and save 25% with the discount code LAVENDER