C++ MCQ Questions and Answers

Practice Mode
Showing 10 of 93 questions
Q51
Which of the following is extraction operator in C++?
  • A ^
  • B v
  • C <<
  • D >>
Answer: Option D
Q52
When requesting multiple datum, user must separate each by using
  • A a space
  • B a tab character
  • C a new line character
  • D all of above
Answer: Option D
Q53
cin extraction stops execution as soon as it finds any blank space character
  • A TRUE
  • B FALSE
Answer: Option A
Q54
Observe the following statements and decide what do they do. string mystring; &nbsp; getline(cin, mystring); &nbsp;
  • A reads a line of string from cin into mystring
  • B reads a line of string from mystring into cin
  • C cin can’t be used this way
  • D none of above
Answer: Option A
Q55
Regarding stringstream identify the invalid statement
  • A stringstream is defined in the header file <sstream>
  • B It allows string based objects treated as stream
  • C It is especially useful to convert strings to numerical values and vice versa.
  • D None of above
Answer: Option D
Q56
Which of the header file must be included to use stringstream?
  • A <iostream>
  • B <string>
  • C <sstring>
  • D <sstream>
Answer: Option D
Q57
Which of the following header file does not exist?
  • A <iostream>
  • B <string>
  • C <sstring>
  • D <sstream>
Answer: Option C
Q58
If you use same variable for two getline statements
  • A Both the inputs are stored in that variable
  • B The second input overwrites the first one
  • C The second input attempt fails since the variable already got its value
  • D You can not use same variable for two getline statements
Answer: Option B
Q59
The "return 0;" statement in main function indicates
  • A The program did nothing; completed 0 tasks
  • B The program worked as expected without any errors during its execution
  • C not to end the program yet.
  • D None of above
Answer: Option B
Q60
Which of the following is not a reserve keyword in C++?
  • A mutable
  • B default
  • C readable
  • D volatile
Answer: Option C
Questions and Answers for Competitive Exams Various Entrance Test