C++ Programming - Mock Interview Test

1. What is the correct syntax to declare a pointer in C++?

2. Which operator is used to allocate memory dynamically in C++?

3. What is the default access modifier for members of a class in C++?

4. Which function is used to deallocate memory in C++?

5. Which of the following is the correct way to create a constructor in C++?

6. In C++, which of the following is used to define a constant?

7. What does the this pointer in C++ represent?

8. Which operator is used to access members of a class in C++?

9. What is the correct way to inherit a class in C++?

10. Which of the following is true for virtual functions in C++?

11. What is the output of the following code snippet?
int x = 10;
cout << ++x;

12. What is the purpose of the friend keyword in C++?

13. Which function is used to find the length of a string in C++?

14. What will be the output of the following code?
int x = 5;
int y = 10;
cout << x + y;

15. What is the purpose of #include in C++?

16. Which of the following is a characteristic of a static member in C++?

17. Which of the following is the correct way to declare an array of 10 integers in C++?

18. In C++, which keyword is used to handle exceptions?

19. Which of the following will give an error in C++?

20. Which of the following data types in C++ has the highest storage size?