C++ Programming Fundamentals Quiz

Test your knowledge of C++ programming basics including data types, operators, constructors, strings, integer arithmetic, and code output analysis.

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

C++

  1. unsigned int
  2. char
  3. Float
  4. None of the Above
Question 2 Multiple Choice (Single Answer)

C++

  1. public
  2. protected
  3. guarded
  4. None of the Above
Question 3 Multiple Choice (Single Answer)

C++

  1. &&
  2. ||
  3. !
  4. None of the Above
Question 4 Multiple Choice (Single Answer)

C++

  1. True
  2. False
  3. It depends on the variable type
  4. None of the Above
Question 5 Multiple Choice (Single Answer)

C++

  1. sin()
  2. kbhit()
  3. tmpnam()
  4. None of the Above
Question 6 Multiple Choice (Single Answer)

C++

  1. char *a=new char[20];
  2. char a=new char[20];
  3. char a=new char(20.0);
  4. None of the Above
Question 7 Multiple Choice (Single Answer)

C++

  1. class aClass{public:int x;};
  2. /* A comment */
  3. char x=12;
  4. None of the Above
Question 8 Multiple Choice (Single Answer)

C++

  1. int main()
  2. int main(int argc, char *argv[])
  3. They both work
  4. None of the Above
Question 9 Multiple Choice (Single Answer)

C++

  1. True
  2. False
  3. Invalid Statement
  4. None of the Above
Question 10 Multiple Choice (Single Answer)

C++

  1. The snippet is illegal
  2. It loops forever
  3. It is ignored by compiler, but it is not illegal
  4. None of the Above
Question 11 Multiple Choice (Single Answer)

C++

  1. Constructor
  2. Destructor
  3. Constitutor
  4. None of the Above
Question 12 Multiple Choice (Single Answer)

What does 7/9*9 equal (in C and C++)?

  1. 1
  2. 0.08642
  3. 0
  4. None of the Above
Question 13 Multiple Choice (Single Answer)

What is the output of the following code: int v() { int m=0; return m++; } int main() { cout<<v(); }

  1. 1
  2. 0
  3. Code cannot compile
  4. None of the Above
Question 14 Multiple Choice (Single Answer)

Which of the following is evaluated first:

  1. &&
  2. ||
  3. !
  4. None of the Above
Question 15 Multiple Choice (Single Answer)

Which is not an ANSI C++ function?

  1. sin()
  2. kbhit()
  3. tmpnam()
  4. None of the Above
Question 16 Multiple Choice (Single Answer)

True or false: If you continuously increment a variable, it will become negative?

  1. True
  2. False
  3. It depends on the variable type
  4. None of the Above
Question 17 Multiple Choice (Single Answer)

What character terminates all strings composed of character arrays?

  1. \0
  2. .
  3. \END
  4. None of the Above
Question 18 Multiple Choice (Single Answer)

Which of the following functions initalizes the variables contained in a class:

  1. Constructor
  2. Destructor
  3. Constitutor
  4. None of the Above
Question 19 Multiple Choice (Single Answer)

Is C++ case sensitive?

  1. No
  2. Case sensitivity is compiler-determined
  3. Yes
  4. None of the Above
Question 20 Multiple Choice (Single Answer)

Which datatype can store decimal numbers?

  1. unsigned int
  2. char
  3. Float
  4. None of the Above