Question 1 of 25
Hints left: 3
Q1
What happens if the following C++ statement is compiled and executed? int *ptr = NULL; delete ptr;
Q2
What is the difference between delete and delete[] in C++?
Q3
What will be the output of the following C++ code? #include<iostream> using namespace std; class Base { public: Base() { cout<<"Constructing Base \n"; } ~Base() { cout<<"Destructing Base \n"; } }; class Derived: public Base { public: Derived() { cout<<"Constructing Derived \n"; } ~Derived() { cout<<"Destructing Derived \n"; } }; int main(void) { Derived *d = new Derived(); Base *b = d; delete b; return 0; }
Q4
What does polymorphism in OOPs mean?
Q5
What will be the output of the following C++ code? #include <iostream> using namespace std; class A{ public: A(){ cout<<"Constructor called\n"; } ~A(){ cout<<"Destructor called\n"; } }; int main(int argc, char const *argv[]) { A *a = new A[5]; delete a; return 0; }
Q6
Which concept means the addition of new components to a program as it runs?
Q7
Which of the following is not a type of Constructor?
Q8
Which of the following is an abstract data type?
Q9
What is the correct syntax of declaring array of pointers of integers of size 10 in C++?
Q10
Which of the following explains the overloading of functions?
Q11
How access specifiers in Class helps in Abstraction?
Q12
Wrapping data and its related functionality into a single entity is known as . . . . . . . .
Q13
How compile-time polymorphisms are implemented in C++?
Q14
Which of the following is correct?
Q15
What will be the output of the following C++ code? #include <iostream> using namespace std; class A { int a; A() { a = 5;} }; int main() { A *obj = new A; cout << obj->a; }
Q16
Which of the following feature of OOPs is not used in the following C++ code? class A { int i; public: void print(){cout<<"hello"<<i;} } class B: public A { int j; public: void assign(int a){j = a;} }
Q17
Which of the following cannot be a friend?
Q18
C++ is . . . . . . . .
Q19
What will be the output of the following C++ code? #include <iostream> using namespace std; class A{ public: A(){ cout<<"Constructor called\n"; } ~A(){ cout<<"Destructor called\n"; } }; int main(int argc, char const *argv[]) { A *a = new A[5]; delete[] a; return 0; }
Q20
What is the other name used for functions inside a class?
Q21
Which of the following explains Polymorphism?
Q22
Which of the following approach is used by C++?
Q23
Why references are different from pointers?
Q24
Out of the following, which is not a member of the class?
Q25
Which of the following provides a programmer with the facility of using object of a class inside other classes?