What happens if the following C++ statement is compiled and executed?
int *ptr = NULL;
delete ptr;
Select an option to see the answer and solution.
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;
}
Select an option to see the answer and solution.
Which of the following is not a type of Constructor?
Select an option to see the answer and solution.
Which of the following cannot be a friend?
Select an option to see the answer and solution.
How access specifiers in Class helps in Abstraction?
Select an option to see the answer and solution.
Which of the following approach is used by C++?
Select an option to see the answer and solution.
Which of the following provides a programmer with the facility of using object of a class inside other classes?
Select an option to see the answer and solution.
Which concept means the addition of new components to a program as it runs?
Select an option to see the answer and solution.
What does polymorphism in OOPs mean?
Select an option to see the answer and solution.
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;
}
Select an option to see the answer and solution.
Wrapping data and its related functionality into a single entity is known as . . . . . . . .
Select an option to see the answer and solution.
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;
}
Select an option to see the answer and solution.
C++ is . . . . . . . .
Select an option to see the answer and solution.
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;
}
Select an option to see the answer and solution.
How compile-time polymorphisms are implemented in C++?
Select an option to see the answer and solution.
What does modularity mean?
Select an option to see the answer and solution.
How many types of polymorphism are there in C++?
Select an option to see the answer and solution.
Which of the following shows multiple inheritances?
Select an option to see the answer and solution.
What happens if a pointer is deleted twice in a program as shown in the following C++ statements?
int *ptr = new int;
delete ptr;
delete ptr;
Select an option to see the answer and solution.
Which of the following is correct about new and malloc?
Select an option to see the answer and solution.