C++ MCQ Questions and Answers
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 -!>
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
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
24. Which of the following can not be used as identifiers?
- Letters
- Digits
- Underscores
- Spaces
25. Which of the following identifiers is invalid?
- papername
- writername
- typename
- printname
26. Which of the following can not be used as valid identifier?
- bitand
- bittand
- biand
- band
27. The difference between x and ‘x’ 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
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
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