C++ MCQ Questions and Answers

Take Exam

C++ MCQ questions and answers are vital for students preparing for software development and IT placement exams like TCS, Infosys, and Tech Mahindra. These questions test your understanding of core concepts such as classes, objects, inheritance, polymorphism, and templates. Practicing C++ programming MCQs with detailed explanations helps strengthen coding logic and syntax understanding. This topic is ideal for candidates aiming to improve their performance in programming interview questions with answers and campus recruitment tests.

C++ MCQ

Showing 10 of 93 questions

51. Which of the following is extraction operator in C++?

  • ^
  • v
  • <<
  • >>
Show Answer Report

52. When requesting multiple datum, user must separate each by using

  • a space
  • a tab character
  • a new line character
  • all of above
Show Answer Report

53. cin extraction stops execution as soon as it finds any blank space character

  • TRUE
  • FALSE
Show Answer Report

54. Observe the following statements and decide what do they do. string mystring; &nbsp; getline(cin, mystring); &nbsp;

  • reads a line of string from cin into mystring
  • reads a line of string from mystring into cin
  • cin can’t be used this way
  • none of above
Show Answer Report

55. Regarding stringstream identify the invalid statement

  • stringstream is defined in the header file <sstream>
  • It allows string based objects treated as stream
  • It is especially useful to convert strings to numerical values and vice versa.
  • None of above
Show Answer Report

56. Which of the header file must be included to use stringstream?

  • <iostream>
  • <string>
  • <sstring>
  • <sstream>
Show Answer Report

57. Which of the following header file does not exist?

  • <iostream>
  • <string>
  • <sstring>
  • <sstream>
Show Answer Report

58. If you use same variable for two getline statements

  • Both the inputs are stored in that variable
  • The second input overwrites the first one
  • The second input attempt fails since the variable already got its value
  • You can not use same variable for two getline statements
Show Answer Report

59. The "return 0;" statement in main function indicates

  • The program did nothing; completed 0 tasks
  • The program worked as expected without any errors during its execution
  • not to end the program yet.
  • None of above
Show Answer Report

60. Which of the following is not a reserve keyword in C++?

  • mutable
  • default
  • readable
  • volatile
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test