Home > MCQs > IT & Programming > C++ MCQs

C++ MCQ

C++ Quick Quiz

Question 1 of 10
  • Which of the following is a valid variable identifier in C++?

    Answer & Explanation

    Correct Answer: m_test

    Note: This Question is unanswered, help us to find answer for this one

  • _____ are programs that test code to ensure that it contains no syntax errors.

    Answer & Explanation

    Correct Answer: Validators

    Note: This Question is unanswered, help us to find answer for this one

  • Consider this function declaration of is_even, which takes in an integer and returns true if the argument is an even number and false otherwise. Which declarations are correct for overloaded versions of that function to support floating point numbers and string representations of numbers? bool is_even(int);

    Answer & Explanation

    Correct Answer: Bool is_even(float f); bool is_even(char *str);

    Note: This Question is unanswered, help us to find answer for this one

  • A class template is a _?

    Answer & Explanation

    Correct Answer: Class written with the generic programming paradigm, specifying behavior in terms of type parameter rather than specific type.

    Note: This Question is unanswered, help us to find answer for this one

  • To correctly swap two values, you create a(n) ____ variable to hold one of the values.

    Answer & Explanation

    Correct Answer: Temporary

    Note: This Question is unanswered, help us to find answer for this one

  • Is this program correct? class A { int a; friend class B; }; class B { friend class C; }; class C { void foo() { A a; a.a = 4; } };

    Answer & Explanation

    Correct Answer: No, friend declarations are not transitive

    Note: This Question is unanswered, help us to find answer for this one

  • A(n) ____________________ is a memory location whose contents can be changed.

    Answer & Explanation

    Correct Answer: Variable

    Note: This Question is unanswered, help us to find answer for this one

  • What does auto type specifier do in this line of code (since C++11)? auto x = 4000.22;

    Answer & Explanation

    Correct Answer: It specifies that the type of x will be deduced from the initializer - in this case, double.

    Note: This Question is unanswered, help us to find answer for this one

  • What is the statement below equivalent to? sprite->x

    Answer & Explanation

    Correct Answer: (*sprite).x

    Note: This Question is unanswered, help us to find answer for this one

  • ____ are executable statements that inform the user what to do.

    Answer & Explanation

    Correct Answer: Promp Lines

    Note: This Question is unanswered, help us to find answer for this one

  • C++ Quick Quiz

    battery

    Poor Results!

    You need a lot of improvement.

    Just don't give up!

    Correct Answers: 0/10

    Start Practicing with our MCQs given below.