Advanced C++ MCQs

50
Score: 0
Attempted: 0/50
1. What is the output of the following code?
int x=10; int y=20; cout << (x<y && x>5);




2. Which of the following is the correct way to declare a pure virtual function?



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




4. What is the output?
char str[]="ABC"; cout << str[1];




5. Which of the following is correct syntax for array initialization?



6. Which of the following is NOT a valid C++ data type?



7. Output?
int a=5, b=2; cout << a%b;




8. What is the output?
int x=1; if(x==1) cout << "True"; else cout << "False";




9. Which of the following is correct about operator precedence?



10. Which of the following is true for friend function?



11. Output?
int a=2; cout << a<<++a;




12. Which of the following is true about references?



13. Output?
int a=5; cout << sizeof(a);




14. Which of the following is a correct STL container?



15. Which of the following is true about templates?



16. Output?
int x=1; x=x<<3; cout << x;




17. Which of the following is correct way to call a base class constructor from derived class?



18. Output?
int x=10; int* p=&x; cout << p;




19. Which of the following is correct way to swap two integers using pointers?



20. Output?
int a=10; cout << ++a << a++;




21. Which of the following is correct about virtual destructor?



22. Output?
int a=5; cout << a>>1;




23. Which of the following is correct to declare a 2D array?



24. Output?
int a=5; int b=3; cout << a|b;




25. Which of the following is NOT a valid member access?
27. Output?
int a=10; int b=20; cout << (a!=b);




28. Which of the following is a correct way to allocate dynamic memory for int array?



29. Which of the following is correct for multiple inheritance?



30. Output?
int a=2; int b=3; cout << (a&&b);




31. Which of the following is true about scope resolution operator (::)?



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




33. Which of the following is correct about const function in class?



34. Output?
int x=10; cout << (x>>2);




35. Which of the following is correct about try-catch block?



36. Output?
int a=5; int b=10; cout << (a>b ? a : b);




37. Which of the following is true for char arrays?



38. Output?
int arr[]={1,2,3,4}; cout << sizeof(arr)/sizeof(arr[0]);




39. Which of the following is true about default arguments?



40. Output?
int x=1; int y=2; cout << (x<y? x:y);




41. Which of the following is NOT a valid C++ comment?



42. Output?
int a=10; int* p=&a; *p=20; cout << a;




43. Which of the following is correct for overloading << operator?



44. Output?
int x=5; cout << (x>0 ? "Positive" : "Negative");




45. Which of the following is true about typecasting?



46. Output?
int x=3; int y=x++ + ++x; cout << y;




47. Which of the following is true about STL map?



48. Output?
int x=5; int* p=NULL; cout << *p;




49. Which of the following is correct about static member function?



50. Output?
int a=10; cout << a– << –a;




12
Score: 0
Attempted: 0/12
Subscribe
1. Processor that translates the source code into object code as a whole is called…



2. ……….. is a procedural language…



3. Bjarne Stroustrup developed…



4. Between the angle brackets the name of ………. is given…



5. Which of the following is true about a header file…



6. If a semicolon is not used at the end of a statement, what message will be displayed by C++?



7. The linker creates a file with the extension…



8. The term used for running the program on the computer is…



9. Syntax errors occur due to…



10. Shortcut key used to compile and run the program in C++ is…



11. A compiler can detect which type of error?



12. Which of the following operators can be categorized…



 

Programming C Plus Plus MCQs Homepage

shamil memory table

Computer Science Repeated MCQs Book Download

Leave a Reply

Contents Copyrights Reserved By T4Tutorials