Q 1. Which of the following is the correct way to define a pointer in C++?
A. int *ptr;
B. int ptr*;
C. pointer int *;
D. ptr int*;
Q 2. What does the 'new' operator do in C++?
A. Allocates memory for variables
B. Deallocates memory
C. Allocates memory dynamically for objects
D. Returns a reference to an object
Q 3. Which of the following will result in a compilation error in C++?
A. int x = 10;
B. int x = 'A';
C. int x = 10.5;
D. int x = 10.0;
Q 4. Which of the following is the correct syntax for declaring a constant in C++?
A. const int a = 10;
B. int const a = 10;
C. constant int a = 10;
D. both A and B
Q 5. In C++, which of the following is used to implement polymorphism?
A. Inheritance
B. Encapsulation
C. Abstraction
D. Function Overloading