# C++ Programming Language Hardest Exam! Trivia Quiz

90 Questions | Total Attempts: 263  Settings  Below is what is considered the hardest trivia quiz on C++ programming language. It is designed for those of us who are studying towards passing the certification exam. Gaming developers mostly prefer the C++ language since it is fast. Are you feeling up to tackling this exam? Do give it a try and get to find out if you need more practice.

Related Topics
• 1.
What is the output of the following function and function call? void calculateCost(int count, float& subTotal, float taxCost);   float tax = 0.0,   subtotal = 0.0;   calculateCost(15, subtotal,tax); cout << "The cost for 15 items is " << subtotal        << ", and the tax for " << subtotal << " is " << tax << endl; //end of fragment   void calculateCost(int count, float& subTotal, float taxCost) {       if ( count < 10)       {                   subTotal = count * 0.50;       }       else       {                   subTotal = count * 0.20;       }       taxCost = 0.1 * subTotal; }
• A.

The cost for 15 items is 3.00, and the tax for 3.00 is 0.30;

• B.

The cost for 15 items is 0.00, and the tax for 3.00 is 0.00;

• C.

The cost for 15 items is 0.00, and the tax for 3.00 is 0.30;

• D.

The cost for 15 items is 3.00, and the tax for 3.00 is 0.00;

• 2.
Which of the following is not an example of a program bug?
• A.

Run-time error

• B.

Operator error

• C.

Syntax error

• D.

Logic error

• 3.
The set of instructions that a computer will follow is known as:
• A.

Hardware

• B.

Algorithm

• C.

Program

• D.

CPU

• 4.
Which of the following is not a valid identifier?
• A.

Return

• B.

MyInt

• C.

MyInteger

• D.

Total3

• 5.
What is the value of x after the following statements? int x, y, z; y = 10; z = 3; x = y * z + 3;
• A.

Garbage

• B.

60

• C.

30

• D.

33

• 6.
What is the value of x after the following statements? int x; x = x + 30;
• A.

0

• B.

30

• C.

33

• D.

Garbage

• 7.
What is the output of the following code? float value; value = 33.5; cout << value << endl;
• A.

33.5

• B.

33

• C.

Value

• D.

Garbage

• 8.
Which of the following statements is NOT legal?
• A.

Char ch='b';

• B.

Char ch='0';

• C.

Char ch=65;

• D.

Char ch="cc";

• 9.
An algorithm is
• A.

The inputs and outputs of a program

• B.

The part of the computer that does the processing

• C.

A finite set of steps to solve a problem

• D.

A complete computer program

• 10.
Which of the following is not a phase of the program-design process?
• A.

Problem-solving

• B.

Implementation

• C.

Marketing the final program

• 11.
Which of the following is not part of the Software Life Cycle?
• A.

Analysis

• B.

Design

• C.

Data Entry

• D.

Implementation

• E.

Testing

• 12.
What is the value of x after the following statements? int x; x = 15 %4;
• A.

15

• B.

4

• C.

3

• D.

3.75

• 13.
What is the value of x after the following statement? float x; x = 3.0 / 4.0 + 3  + 2 / 5
• A.

5.75

• B.

4.75

• C.

1.75

• D.

3.75

• 14.
1. Which boolean operation is described by the following table?
A B Operation True True True True False True False True True False False False
• A.

Or

• B.

And

• C.

Not

• D.

None of the above

• 15.
Which of the following data types may be used in a switch statement?
• A.

Int

• B.

Char

• C.

Enum

• D.

Long

• E.

• 16.
What is wrong with the following for loop?       for(int i=0; i<10; i--)       {                   cout << "Hello\n";       }
• A.

Can not use a for-loop for this

• B.

I is not initialized

• C.

Infinite loop

• D.

Off-by-one error

• 17.
What is the value of x after the following code fragment executes? float x = 36.0; x = sqrt(x);
• A.

36.0

• B.

6.0

• C.

3.0

• D.

2.456

• 18.
What is the output of the following program fragment? cout << pow(4,2) << endl;
• A.

4

• B.

2

• C.

8

• D.

16

• 19.
Which boolean operation is described by the following table? A B Operation True True True True False False False True False False False False
• A.

Or

• B.

And

• C.

Not

• D.

None of the above

• 20.
• A.

The names should be different with the same number and/or types of parameters.

• B.

The names should be the same with different number and/or types of parameters.

• C.

The names should be different with different number and/or types of parameters.

• D.

The names should be the same with the same number and/or types of parameters.

• 21.
When parameters are passed between the calling code and the called function, parameters and arguments are matched by:
• A.

Their data types

• B.

Their relative positions in the parameter and argument lists

• C.

Their names

• D.

They are not matched up at all.

• 22.
The expression static_cast(3) is called a
• A.

Type cast

• B.

Multiplier

• C.

Doubler

• D.

Polymorphism

• 23.
What is the value of the following? sqrt(pow(2,4));
• A.

1

• B.

2

• C.

4

• D.

16

• 24.
Information Hiding is analogous to using
• A.

An algorithmic design

• B.

A black-box methodology

• C.

Actual parameters

• 25.
What is the output of the following function call? //function body int factorial(int n) {       int product=0;       while(n > 0)       {                   product = product * n;                   n—;       }       return product; }   //function call cout << factorial(4);
• A.

4

• B.

0

• C.

24

• D.

48