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

21. A block comment can be written by

  • Starting every line with double slashes (//)
  • Starting with /* and ending with */
  • Starting with //* and ending with *//
  • Starting with <!- and ending with -!>
Show Answer Report

22. When writing comments you can

  • Use code and /* comment on the same line
  • Use code and // comments on the same line
  • Use code and //* comments on the same line
  • Use code and <!- comments on the same line
Show Answer Report

23. A variable is/are

  • String that varies during program execution
  • A portion of memory to store a determined value
  • Those numbers that are frequently required in programs
  • None of these
Show Answer Report

24. Which of the following can not be used as identifiers?

  • Letters
  • Digits
  • Underscores
  • Spaces
Show Answer Report

25. Which of the following identifiers is invalid?

  • papername
  • writername
  • typename
  • printname
Show Answer Report

26. Which of the following can not be used as valid identifier?

  • bitand
  • bittand
  • biand
  • band
Show Answer Report

27. The difference between x and &lsquo;x&rsquo; is

  • The first one refers to a variable whose identifier is x and the second one refers to the character constant x
  • The first one is a character constant x and second one is the string literal x
  • Both are same
  • None of above
Show Answer Report

28. Which of the following is not a valid escape code?

  • \t
  • \v
  • \f
  • \w
Show Answer Report

29. Which of the following statement is true?

  • String Literals can extend to more than a single line of code by putting a backslash sign at the end of each unfinished line.
  • You can also concatenate several string constants separating them by one or several blank spaces, tabulators, newline or any other valid blank character
  • If we want the string literal to explicitly made of wide characters, we can precede the constant with the L prefix
  • All of above
Show Answer Report

30. Regarding #difine which of the following statement is false?

  • It is not C++ statement but the directive for the preprocessor
  • This does not require a semicolon at the end of line
  • It is a C++ statement that declares a constant in C++
  • None of the above
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test