C++ MCQ Questions and Answers

Practice Mode
Showing 10 of 93 questions
Q21
A block comment can be written by
  • A Starting every line with double slashes (//)
  • B Starting with /* and ending with */
  • C Starting with //* and ending with *//
  • D Starting with <!- and ending with -!>
Answer: Option B
Q22
When writing comments you can
  • A Use code and /* comment on the same line
  • B Use code and // comments on the same line
  • C Use code and //* comments on the same line
  • D Use code and <!- comments on the same line
Answer: Option B
Q23
A variable is/are
  • A String that varies during program execution
  • B A portion of memory to store a determined value
  • C Those numbers that are frequently required in programs
  • D None of these
Answer: Option B
Q24
Which of the following can not be used as identifiers?
  • A Letters
  • B Digits
  • C Underscores
  • D Spaces
Answer: Option D
Q25
Which of the following identifiers is invalid?
  • A papername
  • B writername
  • C typename
  • D printname
Answer: Option C
Q26
Which of the following can not be used as valid identifier?
  • A bitand
  • B bittand
  • C biand
  • D band
Answer: Option A
Q27
The difference between x and &lsquo;x&rsquo; is
  • A The first one refers to a variable whose identifier is x and the second one refers to the character constant x
  • B The first one is a character constant x and second one is the string literal x
  • C Both are same
  • D None of above
Answer: Option A
Q28
Which of the following is not a valid escape code?
  • A \t
  • B \v
  • C \f
  • D \w
Answer: Option D
Q29
Which of the following statement is true?
  • A String Literals can extend to more than a single line of code by putting a backslash sign at the end of each unfinished line.
  • B You can also concatenate several string constants separating them by one or several blank spaces, tabulators, newline or any other valid blank character
  • C If we want the string literal to explicitly made of wide characters, we can precede the constant with the L prefix
  • D All of above
Answer: Option D
Q30
Regarding #difine which of the following statement is false?
  • A It is not C++ statement but the directive for the preprocessor
  • B This does not require a semicolon at the end of line
  • C It is a C++ statement that declares a constant in C++
  • D None of the above
Answer: Option C
Questions and Answers for Competitive Exams Various Entrance Test