C++ MCQ Based On Learning Outcomes
C++ MCQ Based On Learning Outcomes
C++ MCQ Based On Learning Outcomes
Design, code, debug and solve problems in using programming concepts, Apply the principle of
mathematical knowledge to prove statements and solve problems in computing science.
19. Which of the following is an example of an object-oriented programming (OOP) concept in C++?
a) Inheritance
b) Goto statement
c) Switch case
d) Bitwise operator
int x = 5;
int y = x++;
cout << y;
a) 4
b) 5
c) 6
d) Error
22. What is the output of the following code snippet?
a) 1
b) 2
c) 3
d) 4
bool x = true;
bool y = false;
cout << (x && y);
a) true
b) false
c) 1
d) 0
19. Which of the following is an example of an object-oriented programming (OOP) concept in C++?
Answer: a) Inheritance
Explanation: Inheritance is an important concept in object-oriented programming, and it allows classes to
inherit properties and behaviors from other classes.
21. Answer: a) 4
Explanation: The postfix increment operator (x++) returns the current value of x and then increments it.
So, y gets assigned the value 5, and then x becomes 6. Therefore, the output will be 4.
22. Answer: d) 4
Explanation: The code initializes an array "arr" with five elements. Each element is assigned a value
starting from 1. The index 3 corresponds to the fourth element in the array, which is 4. Therefore, the
output will be 4.