C++ interview questions part 2

C++ interview questions part 2

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

Total Questions: 20

1. Which of the following statement is not true about preprocessor directives?

Correct Answer is : They end with a semicolon

2. Regarding the following statement which of the statements is true? const int a = 100;

Correct Answer is : Declares a constant a whose value will be 100

3. The difference between x and ‘x’ is

Correct Answer is : The first one refers to a variable whose identifier is x and the second one refers to the character constant x

4. How to declare a wide character in the string literal?

Correct Answer is : L prefix

5. Which of the following is called insertion/put to operator?

Correct Answer is : abstract class

6. A language which has the capability to generate new data types are called ________________

Correct Answer is : 0

7. Which of the following is not a fundamental type is not present in C but present in C++?

Correct Answer is : pure virtual function

8. What is the size of a boolean variable in C++?

Correct Answer is : 2010

9. Which of the following is C++ equivalent for scanf()?

Correct Answer is : 45417

10. Which of the following is C++ equivalent for printf()?

Correct Answer is : ubuntu is awesome

11. Which of the following is the correct difference between cin and scanf()?

Correct Answer is : 212

12. Which of the following is an exit-controlled loop?

Correct Answer is : Function which does not have definition of its own

13. Which of the following is an entry-controlled loop?

Correct Answer is : We cannot make an instance of an abstract base class

14. In which part of the for loop termination condition is checked? for(I;II;III) {IV}

Correct Answer is : base class only

15. What is dynamic binding?

Correct Answer is : Class specifically used as a base class with atleast one pure virtual functions

16. What is static binding?

Correct Answer is : A virtual function declared in a base class

17. What is name mangling in C++?

Correct Answer is : virtual return_type func() = 0;

18. What is the output of the following program in both C and C++? #include int main(int argc, char const *argv[]) { printf("%d\n", (int)sizeof('a')); return 0; }

Correct Answer is : Pure virtual function is implemented in derived classes

19. What is the output of the following C++ code? #include int main(int argc, char const *argv[]) { char a = 'a'; printf("%d\n", (int)sizeof(a)); return 0; }

Correct Answer is : Pure virtual function has no implementation in the base class whereas virtual function may have an implementation in the base class

20. Which of the following syntax for declaring a variable of struct STRUCT can be used in both C and C++?

Correct Answer is : Class B

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon