C++ Basic MCQ Questions And Answers

10 Questions | Total Attempts: 4453

SettingsSettingsSettings
C++ Basic MCQ Questions And Answers - Quiz

Get ready for these C++ basic MCQ questions and answers. This quiz is created for those users who want to test their command over the C++ Programming Language. The quiz is gonna be helpful to learn even more about C++ in a fun way. You will be called an expert in this subject if you manage to get more than 70 on this quiz. So, are you ready and excited? Let's go for it!


Questions and Answers
  • 1. 
    Which of the following identifiers is invalid?
    • A. 

      Papername

    • B. 

      Writername

    • C. 

      Typename

    • D. 

      Printname

  • 2. 
    The difference between x and ‘x’ 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 literal string x

    • C. 

      Both are same

    • D. 

      None of above

  • 3. 
    Which of the following is not a valid escape code?
    • A. 

      \t

    • B. 

      \v

    • C. 

      \f

    • D. 

      \w

  • 4. 
    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, newlines, 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

  • 5. 
    Regarding #difine, which of the following statement is false?
    • A. 

      It is not a 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

  • 6. 
    Regarding the following statement, which of the statements is true? const int pathwidth=100;
    • A. 

      Declares a variable pathwidth with 100 as its initial value

    • B. 

      Declares a construction pathwidth with 100 as its initial value

    • C. 

      Declares a constant pathwidth whose value will be 100

    • D. 

      Constructs an integer type variable with pathwidth as identifier and 100 as value

  • 7. 
    A variable is/are
    • A. 

      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

  • 8. 
    Which of the following cannot be used as identifiers?
    • A. 

      Letters

    • B. 

      Digits

    • C. 

      Underscores

    • D. 

      Spaces

  • 9. 
    Which of the following cannot be used as a valid identifier?
    • A. 

      Bitand

    • B. 

      Bittand

    • C. 

      Biand

    • D. 

      Band

  • 10. 
    In an assignment statement
    • A. 

      The value must always be a variable.

    • B. 

      The value might be a constant, a variable, an expression, or any combination of these.

    • C. 

      The assignment always takes place from right to left and never the other way.

    • D. 

      All of above

Back to Top Back to top