C++ Programming Fundamentals Quiz
Test your knowledge of C++ programming basics including data types, operators, constructors, strings, integer arithmetic, and code output analysis.
Questions
Question 1 Multiple Choice (Single Answer)
C++
- unsigned int
- char
- Float
- None of the Above
Question 2 Multiple Choice (Single Answer)
C++
- public
- protected
- guarded
- None of the Above
Question 3 Multiple Choice (Single Answer)
C++
- &&
- ||
- !
- None of the Above
Question 4 Multiple Choice (Single Answer)
C++
- True
- False
- It depends on the variable type
- None of the Above
Question 5 Multiple Choice (Single Answer)
C++
- sin()
- kbhit()
- tmpnam()
- None of the Above
Question 6 Multiple Choice (Single Answer)
C++
- char *a=new char[20];
- char a=new char[20];
- char a=new char(20.0);
- None of the Above
Question 7 Multiple Choice (Single Answer)
C++
- class aClass{public:int x;};
- /* A comment */
- char x=12;
- None of the Above
Question 8 Multiple Choice (Single Answer)
C++
- int main()
- int main(int argc, char *argv[])
- They both work
- None of the Above
Question 9 Multiple Choice (Single Answer)
C++
- True
- False
- Invalid Statement
- None of the Above
Question 10 Multiple Choice (Single Answer)
C++
- The snippet is illegal
- It loops forever
- It is ignored by compiler, but it is not illegal
- None of the Above
Question 11 Multiple Choice (Single Answer)
C++
- Constructor
- Destructor
- Constitutor
- None of the Above
Question 12 Multiple Choice (Single Answer)
What does 7/9*9 equal (in C and C++)?
- 1
- 0.08642
- 0
- 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
- 0
- Code cannot compile
- None of the Above
Question 14 Multiple Choice (Single Answer)
Which of the following is evaluated first:
- &&
- ||
- !
- None of the Above
Question 15 Multiple Choice (Single Answer)
Which is not an ANSI C++ function?
- sin()
- kbhit()
- tmpnam()
- None of the Above
Question 16 Multiple Choice (Single Answer)
True or false: If you continuously increment a variable, it will become negative?
- True
- False
- It depends on the variable type
- None of the Above
Question 17 Multiple Choice (Single Answer)
What character terminates all strings composed of character arrays?
- \0
- .
- \END
- None of the Above
Question 18 Multiple Choice (Single Answer)
Which of the following functions initalizes the variables contained in a class:
- Constructor
- Destructor
- Constitutor
- None of the Above
Question 19 Multiple Choice (Single Answer)
Is C++ case sensitive?
- No
- Case sensitivity is compiler-determined
- Yes
- None of the Above
Question 20 Multiple Choice (Single Answer)
Which datatype can store decimal numbers?
- unsigned int
- char
- Float
- None of the Above