0% found this document useful (0 votes)
26 views3 pages

C++ MCQs: 60 Questions & Answers

The document contains 60 multiple choice questions (MCQs) related to C++ programming, covering topics such as language development, syntax, data types, object-oriented programming principles, and standard library usage. An answer key is provided at the end, indicating the correct options for each question. This resource serves as a study guide for individuals looking to test their knowledge of C++.

Uploaded by

vitthaladkute95
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views3 pages

C++ MCQs: 60 Questions & Answers

The document contains 60 multiple choice questions (MCQs) related to C++ programming, covering topics such as language development, syntax, data types, object-oriented programming principles, and standard library usage. An answer key is provided at the end, indicating the correct options for each question. This resource serves as a study guide for individuals looking to test their knowledge of C++.

Uploaded by

vitthaladkute95
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

60 Multiple Choice Questions (MCQs) on C++

1. Who developed C++? A) Dennis Ritchie B) Bjarne Stroustrup C) James Gosling D) Guido van
Rossum

2. C++ is an extension of which language? A) Java B) Python C) C D) Pascal

3. Which symbol is used to end a statement in C++? A) : B) . C) ; D) ,

4. Which header file is used for cout and cin? A) stdio.h B) iostream C) conio.h D) stream

5. Which is the correct syntax for output? A) print() B) cout << "Hello"; C) printf() D) output()

6. Which data type stores decimal values? A) int B) char C) float D) bool

7. Which is a valid variable name? A) 1num B) num-1 C) num_1 D) float

8. Size of bool is typically: A) 1 byte B) 2 bytes C) 4 bytes D) 8 bytes

9. Which keyword declares a constant variable? A) static B) final C) const D) fixed

10. Which data type stores true/false? A) int B) bool C) char D) double

11. Which is the scope resolution operator? A) . B) :: C) -> D) *

12. Which operator is used for dynamic memory allocation? A) alloc B) malloc C) new D) create

13. Which operator deletes dynamic memory? A) free B) delete C) remove D) clear

14. Which operator has highest precedence? A) + B) * C) = D) &&

15. Which is NOT a logical operator? A) && B) || C) ! D) &

16. Which statement is used for decision making? A) for B) if C) while D) goto

17. Which loop executes at least once? A) for B) while C) do-while D) none

18. Which keyword exits a loop? A) exit B) break C) stop D) end

19. Which keyword skips the current iteration? A) pass B) skip C) continue D) goto

20. Which statement selects from multiple choices? A) if B) else C) switch D) goto

21. Function calling itself is called: A) iteration B) looping C) recursion D) nesting

22. Which feature allows same function name with different parameters? A) Inheritance B)
Polymorphism C) Encapsulation D) Abstraction

23. Which keyword is used to define a class? A) struct B) class C) object D) define

24. Members of a class are accessed using: A) : B) . C) -> D) *

25. Which access specifier makes members private by default? A) struct B) class C) union D) enum

26. Constructor name must be same as: A) function B) object C) class D) variable

27. Which symbol is used for destructor? A) ! B) ~ C) # D) $

28. How many constructors can a class have? A) One B) Two C) Three D) Multiple

29. Destructor is called when: A) object is created B) object goes out of scope C) program starts D)
constructor runs

30. Which constructor has no parameters? A) Copy B) Parameterized C) Default D) Static


31. Which symbol is used for inheritance? A) : B) -> C) . D) *

32. Which inheritance allows one child, multiple parents? A) Single B) Multiple C) Multilevel D)
Hybrid

33. Which keyword prevents inheritance? A) static B) const C) final D) private

34. Which keyword is used for runtime polymorphism? A) static B) inline C) virtual D) const

35. Which binding happens at runtime? A) Static B) Early C) Compile-time D) Dynamic

36. Which STL container stores elements in sequence? A) map B) set C) vector D) pair

37. Which container stores key–value pairs? A) vector B) list C) map D) array

38. Which header file is required for file handling? A) fstream B) stdio.h C) iostream D) conio.h

39. Which operator is used to access pointer members? A) . B) :: C) -> D) *

40. Which function is used to read a file line? A) read() B) getline() C) scan() D) input()

41. Which concept hides implementation details? A) Polymorphism B) Inheritance C) Abstraction D)


Encapsulation

42. Which keyword refers to current object? A) this B) self C) current D) object

43. Which is NOT an OOP principle? A) Encapsulation B) Polymorphism C) Compilation D)


Inheritance

44. Which keyword is used to handle exceptions? A) error B) catch C) handle D) thrower

45. Which block handles exceptions? A) try B) throw C) catch D) error

46. Which operator is ternary? A) ?: B) :: C) ** D) %%

47. Which function deallocates memory? A) delete B) free C) clear D) remove

48. Which keyword is used to inherit privately? A) private B) protected C) public D) static

49. Which feature supports code reuse? A) Inheritance B) Compilation C) Debugging D) Execution

50. Which function starts program execution? A) start() B) run() C) main() D) init()

51. Which keyword defines template? A) template B) typename C) generic D) class

52. Which container does not allow duplicates? A) vector B) list C) set D) deque

53. Which keyword is used for namespace? A) using B) namespace C) scope D) include

54. Which type of polymorphism is function overloading? A) Runtime B) Compile-time C) Dynamic


D) Late binding

55. Which operator overloads insertion? A) >> B) << C) :: D) ->

56. Which keyword stops exception propagation? A) stop B) break C) catch D) handle

57. Which access specifier allows derived class access? A) private B) protected C) public D) static

58. Which is a smart pointer? A) auto_ptr B) int_ptr C) raw_ptr D) void_ptr

59. Which C++ standard introduced auto keyword? A) C++98 B) C++03 C) C++11 D) C++14

60. Which header supports STL algorithms? A) algorithm B) vector C) iterator D) numeric
Answer Key
1-B, 2-C, 3-C, 4-B, 5-B, 6-C, 7-C, 8-A, 9-C, 10-B, 11-B, 12-C, 13-B, 14-B, 15-D, 16-B, 17-C, 18-B,
19-C, 20-C, 21-C, 22-B, 23-B, 24-B, 25-B, 26-C, 27-B, 28-D, 29-B, 30-C, 31-A, 32-B, 33-D, 34-C,
35-D, 36-C, 37-C, 38-A, 39-C, 40-B, 41-C, 42-A, 43-C, 44-B, 45-C, 46-A, 47-A, 48-A, 49-A, 50-C,
51-A, 52-C, 53-B, 54-B, 55-B, 56-C, 57-B, 58-A, 59-C, 60-A

You might also like