C++ interview questions part 4

C++ interview questions part 4

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

Total Questions: 20

1. What is the other name of run-time polymorphism?

Correct Answer is : template < class T > class allocator;

2. Which of the following is correct about static polymorphism?

Correct Answer is : Generic

3. Which of the following is correct about dynamic polymorphism?

Correct Answer is : Generic

4. Which of the following operator(s) can be used with pointers? i) – only ii) +, * iii) +, – iv) +, -, * v) / vi) + only

Correct Answer is : any type of object

5. What is std in C++?

Correct Answer is : any type of object

6. What is the output of the following C++ code? #include   int main(int argc, char const *argv[]) { cout<<"Hello World"; return 0; }

Correct Answer is : Node-based

7. Which of the following syntax can be used to use a member of a namespace without including that namespace?

Correct Answer is : Node-based

8. Which of the following code will give error on compilation? ================code 1================= #include using namespace std; int main(int argc, char const *argv[]) { cout<<"Hello World"; return 0; } ======================================== ================code 2================= #include int main(int argc, char const *argv[]) { std::cout<<"Hello World"; return 0; } ========================================

Correct Answer is : Random access

9. What happens if the below program is executed in C and C++? #include int main() { foo(); } int foo() { printf("Hello"); return 0; }

Correct Answer is : Random access

10. What happens if the below program is executed in C and C++? #include int main(void) { const int j = 20; int *ptr = &j; printf("*ptr: %d\n", *ptr); return 0; }

Correct Answer is : End

11. What happens if the below line is executed in C and C++? int *p = malloc(10);

Correct Answer is : End

12. What happens if the below line is executed in C and C++? const int a;

Correct Answer is : Container adaptor

13. What happens if the following program is executed in C and C++? #include int main(void) { int new = 5; printf("%d", new); }

Correct Answer is : Container adaptor

14. What happens if the following program is executed in C and C++? #include void main() { printf("Hello World"); }

Correct Answer is : Only on that container

15. What happens if the following program is executed in C and C++? #include void func(void) { printf("Hello"); } void main() { func(); func(2); }

Correct Answer is : Only on that container

16. What happens if the following program is executed in C and C++? #include void func() { printf("Hello"); } void main() { func(); func(2); }

Correct Answer is : 4

17. Which of the following type is provided by C++ but not C?

Correct Answer is : 4

18. Which of the following feature is not provided by C?

Correct Answer is : 20

19. How many parameters does the throw expression can have?

Correct Answer is : 20

20. Where exception are handled?

Correct Answer is : y => 202

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon