Sharpen Your CPP Skills Engaging MCQs for All Levels part three

C++ Skills with Mixed MCQs

1. By default, which access specifier is applied to members of a C++ class?

2. In C++, which of the following is not allowed in function overloading?

3. What will be the output of the following code?
int x = 5; cout << ++x + 1;

4. What is a key difference between a struct in C++ and C?

5. If a member is declared protected in a base class, who can access it?

6. Which function in C++ is used to dynamically allocate memory?

7. What is the result if a derived class object calls a non-virtual base class function?

8. What will be the output of the following code?
int a = 10, b = 5; cout << (a + b);

9. What will be the output of the following code?
static int x = 10; cout << x;

10. What is the purpose of the ternary operator?

11. What is the purpose of 'endl' in C++?

12. What will happen if you run the following code?
while(1) { cout << "Hello"; }

13. Which of the following statements about C++ references is true?

14. In C++, what does the 'this' pointer represent?

15. Which cast is used for safe downcasting in C++?

16. What is the purpose of a virtual function in C++?

17. Given void add(int &sum, int a, int b) { sum = a + b; }, what does this function do?

18. What will happen if you declare int x = 5; int x = 10; in the same scope in C++?

19. How does C++ handle multiple inheritance with virtual inheritance?

20. When is the memory allocated for an array automatically released in C++?

1 2 3 4

Post a Comment

Your comment will be visible after approval.
© TechTestLog. All rights reserved. Premium By Raushan Design
//My script