Top 80+ Solved Object Oriented Programming (OOP) MCQ Questions Answer

From 31 to 45 of 94

Q. A static local variable is used to

a. make a variable visible to several functions.

b. make a variable visible to only one function.

c. retain a value when a function is not executing.

d. b and c

  • d. b and c

Q. When an array name is passed to a function, the function

a. accesses exactly the same array as the calling program.

b. refers to the array using a different name than that used by the calling program.

c. refers to the array using the same name as that used by the calling program.

d. a and b

  • d. a and b

Q. You can read input that consists of multiple lines of text using

a. the normal cout <<combination.

b. the cin.get() function with one argument.

c. the cin.get() function with two arguments.

d. the cin.get() function with three arguments.

  • d. the cin.get() function with three arguments.

Q. Objects of the string class

a. are zero-terminated.

b. can be copied with the assignment operator.

c. do not require memory management.

d. both b and c

  • d. both b and c

Q. Can destuctors be private in C++?

a. yes

b. no

  • a. yes

Q. What is value of size?

a. 28

b. 32

c. 20

d. 24

  • c. 20

Q. What value will be printed for data.i?

a. 10 220.5 230.5 unpredictable value

b. 220

c. 230.5

d. unpredictable value

  • d. unpredictable value

Q. What is the compilation error for thisprogram?

a. each undeclared identifier is reported only once

b. cout and cin not declared in scope

c. invalid conversion from int to float

d. all of the above

  • b. cout and cin not declared in scope

Q. What will be the output of the program?

a. 1

b. default value

c. will not compile

d. none of the above

  • c. will not compile

Q. What is the output of the program?

a. 0 0

b. x = 0 y = 0

  • d. compilation error

Q. Which function will change the state of the object?

a. only set()

b. only display()

c. display() and set() both

d. none of the above

  • a. only set()
Subscribe Now

Get All Updates & News