C++ interview questions part 37

C++ interview questions part 37

Take as many assements as you can to improve your validate your skill rating

Total Questions: 20

1. Which of the following is an abstract data type?

Correct Answer is : 14

2. Which concept means the addition of new components to a program as it runs?

Correct Answer is : 311

3. Which of the following explains the overloading of functions?

Correct Answer is : Pre Increment is faster than post-increment

4. Which of the following approach is used by C++?

Correct Answer is : call by reference

5. Which operator is overloaded for a cout object?

Correct Answer is : Deriving new classes from existing classes

6. Which of the following cannot be used with the virtual keyword?

Correct Answer is : 3

7. Which concept is used to implement late binding?

Correct Answer is : private

8. Which of the following supports the concept that reusability is a desirable feature of a language?

Correct Answer is : all the members are inherited by the class but are hidden and cannot be accessible

9. Which of the following is a static polymorphism mechanism?

Correct Answer is : 12

10. Which of the following is true? I) All operators in C++ can be overloaded. II) The basic meaning of an operator can be changed.

Correct Answer is : 1510

11. What happens if a class does not have a name?

Correct Answer is : All the functions which are declared in the base class and is re-defined/overridden by the derived class

12. Which of the following statement is true? I) In Procedural programming languages, all function calls are resolved at compile-time II) In Object Oriented programming languages, all function calls are resolved at compile-time

Correct Answer is : virtual int func();

13. Which members are inherited but are not accessible in any case?

Correct Answer is : Segmentation Fault

14. Which of the following is correct in C++?

Correct Answer is : Hello this is class B

15. Which of the following is used to make an abstract class?

Correct Answer is : They are used to hide objects

16. Which is the following is correct about new and malloc?

Correct Answer is : both late binding and dynamic linkage

17. What is virtual inheritance?

Correct Answer is : A virtual function that has no definition relative to the base class

18. What is the output of the following C++ code? #include 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; }

Correct Answer is : Constructor of A followed by B

19. What is the output of the following C++ code? #include 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; }

Correct Answer is : Destructor of B followed by A

20. What is the output of the following? #include 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; }

Correct Answer is : Segmentation Fault

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon