Ultimate C++ Programming Language Test! Hardest Trivia Quiz

60 Questions | Total Attempts: 440

SettingsSettingsSettings
Please wait...
Ultimate C++ Programming Language Test! Hardest Trivia Quiz

.


Questions and Answers
  • 1. 
    A function that is associated with an object is called a _________ function.
    • A. 

      Input

    • B. 

      Output

    • C. 

      Member

    • D. 

      Instantiated

  • 2. 
    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;

  • 3. 
    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

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

      0

    • B. 

      30

    • C. 

      33

    • D. 

      Garbage

  • 5. 
    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

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

      Char ch='b';

    • B. 

      Char ch='0';

    • C. 

      Char ch=65;

    • D. 

      Char ch="cc";

  • 7. 
    What is the value of choice after the following statements? void getChoice(int& par_choice, in par_count); int choice, count=3;   getChoice(choice, count);   void getChoice(int& par_choice, in par_count) {             if(par_count<0)                         par_choice =0;             if(par_count = 0)                         par_choice=-1;             else                         par_choice=99;             return; }
    • A. 

      3

    • B. 

      0

    • C. 

      -1

    • D. 

      99

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

      Run-time error

    • B. 

      Operator error

    • C. 

      Syntax error

    • D. 

      Syntax error

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

      Hardware

    • B. 

      Algorithm

    • C. 

      Program

    • D. 

      CPU

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

      Return

    • B. 

      MyInt

    • C. 

      MyInteger

    • D. 

      Total3

  • 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. 
    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

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

      Problem-solving

    • B. 

      Implementation

    • C. 

      Marketing the final program

  • 14. 
    What is the value of x after the following statements? double x; x = 0; x += 3.0 * 4.0; x -= 2.0;
    • A. 

      22.0

    • B. 

      12.0

    • C. 

      10.0

    • D. 

      14.0

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

      15

    • B. 

      4

    • C. 

      3

    • D. 

      3.75

  • 16. 
    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

  • 17. 
    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

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

      Int

    • B. 

      Char

    • C. 

      Enum

    • D. 

      Long

    • E. 

      All of the above

    • F. 

      A and d

  • 19. 
    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

  • 20. 
    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

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

      4

    • B. 

      2

    • C. 

      8

    • D. 

      16

  • 22. 
    1. 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

  • 23. 
    If the variable x has the original value of 3.4, what is the value in x after the following? cout << static_cast(x);
    • A. 

      3.4

    • B. 

      4

    • C. 

      3

    • D. 

      Unknown

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

      1

    • B. 

      2

    • C. 

      4

    • D. 

      16

  • 25. 
    What is the value of i after the following function call? //function definition int doSomething(int value) {             value = 35;             return value;             value = 13 }   //fragment of main program int i=0; cout << doSomething(i);
    • A. 

      13

    • B. 

      35

    • C. 

      48

    • D. 

      0