Programming C++ MCQs for Programming competition

49
Score: 0
Attempted: 0/49
1. Which of the following is a valid C++ identifier?



2. What is the output of the following code?
int x = 5; cout << ++x;




3. Which operator is used to access a member function through a pointer?
5. Which of the following is NOT a valid loop in C++?



6. What is the output?
int a = 10, b = 20; cout << (a & b);




7. What will be the output?
int x = 3; int y = x++; cout << y;




8. Which of the following is a correct way to declare a pointer to int?



9. What will happen if you divide an int by 0?



10. What is the output of this code?
char c = 'A'; cout << ++c;




11. Which of the following is used for dynamic memory allocation?



12. Output?
int x = 5; if(x = 0) cout << "Yes"; else cout << "No";




13. Which keyword is used to define a constant in C++?



14. What is the output?
int arr[3] = {1,2,3}; cout << arr[1];




15. Which of the following is true about references in C++?



16. What is the output?
int x = 7; cout << (x>>1);




17. Which of the following is correct to define a class?



18. Which of the following is the correct syntax for a constructor?



19. Output?
int a=2, b=3; cout << (a^b);




20. Which of the following is correct to declare a function pointer?



21. What is the output?
int a = 10; int* p = &a; cout << *p;




22. Which of the following is used to handle exceptions?



23. Which operator is used to allocate memory dynamically in C++?



24. What will be the output?
int x=10; cout << (x==10 ? "Yes" : "No");




25. Which of the following is correct for multi-level inheritance?



26. Output?
int x=5; int y=++x + x++; cout << y;




27. Which of the following is true about virtual functions?



28. Which keyword is used to prevent inheritance?



29. Output?
int a=5; int b=2; cout << a/b;




30. Which of the following is true about inline functions?



31. What is the output?
int a = 5; cout << a<< endl << ++a;




32. Which of the following is a proper template syntax?



33. Output?
int x=1; x = x << 2; cout << x;




34. Which of the following is true about destructors?



35. Which of the following is NOT a valid access specifier?



36. Output?
int x=5; int y=–x + x–; cout << y;




37. Which of the following is true about const pointer?



38. Which of the following allows function overloading?



39. Which of the following is a syntax error?



40. Output?
int x = 10; x += 5; cout << x;




41. Which of the following is a correct function declaration?



42. Output?
int a=5; cout << (a!=5 ? "Yes" : "No");




43. Which of the following is true for pointers?



44. Which of the following is correct way to pass by reference?



45. Output?
int x=1; int y=++x*2; cout << y;




46. Which of the following is true about static variables in function?



47. Output?
int arr[3]={1,2,3}; cout << arr[3];




48. Which of the following is true for operator overloading?



49. What is the output?
int x=10; cout << x%3;




Programming C Plus Plus MCQs Homepage

shamil memory table

Computer Science Repeated MCQs Book Download

 

Leave a Reply

Contents Copyrights Reserved By T4Tutorials