OOPs Sample MCQ2
OOPs Sample MCQ2
a) .
b) *
c) ->
d) :
Answer: a) .
a) class
b) struct
c) typedef
d) typename
Answer: a) class
a) int
b) char
c) float
d) double
Answer: b) char
a) #define
b) #include
c) #ifdef
d) #ifndef
Answer: c) #ifdef
5. Which decision-making construct in C++ is used when you have multiple conditions and want to
perform different actions based on each condition?
a) if
b) if-else
c) if-else-if ladder
d) switch case
6. Which repetitive construct in C++ is primarily used when you want to execute the loop at least once,
even if the condition is false?
a) for loop
b) while loop
c) do-while loop
d) switch case
a) ++
b) +=
c) =
d) *
Answer: a) ++
a) &&
b) ||
c) !
d) &
Answer: a) &&
9. Which keyword is used to stop the execution of the current iteration and move to the next iteration in
a loop in C++?
a) continue
b) break
c) exit
d) return
Answer: a) continue
a) func
b) method
c) def
d) void
Answer: d) void
2 MARK MCQ
switch (num) {
case 1:
std::cout << "One" << std::endl;
break;
case 2:
std::cout << "Two" << std::endl;
break;
case 3:
std::cout << "Three" << std::endl;
break;
default:
std::cout << "Other" << std::endl;
}
return 0;
}
a) The program will compile but no output will be displayed.
b) The program will display "One".
c) The program will display "Two".
d) The program will display "Three".