Top 80+ Solved Object Oriented Programming In cpp MCQ Questions Answer

From 1 to 15 of 87

Q. Which classes allow primitive types to be accessed as objects?

a. storage

b. virtual

c. friend

d. wrapper

  • b. virtual

Q. When is std::bad_alloc exception thrown?

a. when new operator cannot allocate memory

b. when alloc function fails

c. when type requested for new operation is considered bad, thisexception is thrown

d. object

  • d. object

Q. Which one of the following is not a fundamental data type in C++

a. float

b. string

c. int

d. wchar_t

  • a. float

Q. Which of the following is a valid destructor of the class name “Country”

a. int ~country()

b. void country()

c. int ~country(country obj)

d. void ~country()

  • b. void country()

Q. Which of the following correctly describes C++ language?

a. statically typed language

b. dynamically typed language

c. both statically and dynamically typed language

d. type-less language

  • d. type-less language

Q. Which of the following keyword supports dynamic method resolution?

a. abstract

b. virtual

c. dynamic

d. typeid

  • a. abstract

Q. Which of the following is the most preferred way of throwing and handling exceptions?

a. throw by value and catch by reference.

b. throw by reference and catch by reference.

c. throw by value and catch by value

d. throw the pointer value and provide catch for the pointer type.

  • b. throw by reference and catch by reference.

Q. Which of the following is not true about preprocessor directives

a. they begin with a hash symbol

b. they are processed by a preprocessor

c. they form an integral part of the code

d. they have to end with a semi colon

  • a. they begin with a hash symbol

Q. What’s wrong? while( (i < 10) && (i > 24))

a. the logical operator && cannot be used in a test condition

b. the while loop is an exit-condition loop

c. the test condition is always false

d. the test condition is always true

  • d. the test condition is always true

Q. A continue statement causes execution to skip to

a. the return 0; statement

b. the first statement after the loop

c. the statement following the continue statement

d. the next iteration of the loop

  • c. the statement following the continue statement

Q. What’s wrong? (x = 4 && y = 5) ? (a = 5) ; (b = 6);

a. the question mark should be an equal sign

b. the first semicolon should be a colon

c. there are too many variables in the statement

d. the conditional operator is only used with apstrings

  • d. the conditional operator is only used with apstrings

Q. What’s wrong? for (int k = 2, k <=12, k++)

a. the increment should always be ++k

b. the variable must always be the letter i when using a for loop

c. there should be a semicolon at the end of the statement

d. the commas should be semicolons

  • b. the variable must always be the letter i when using a for loop

Q. Which of the following is not recommended in a header file?

a. type definitions (typedefs)

b. class definitions

c. function definitions

d. template definitions

  • d. template definitions

Q. Which of the STL containers store the elements contiguously (in adjacent memory locations)?

a. std::vector

b. std::list

c. std::map

d. std::set

  • c. std::map
Subscribe Now

Get All Updates & News