C++ MCQ Questions And Answers
1. Who is the developer of C++?
a) Dennis Ritchie
b) Ken Thompson
c) Brian Kernighan
d) Bjarne Stroustrup
2. Which type of language is a C++ ?
a) Low-level language
b) Middle-level language
c) High-level Language
d) None of the above
3. Which of the following is not a member of class ?
a) Virtual function
b) Friend function
c) Const function
d) Static function
4. How many types of Constructor are there in C++ ?
a) One
b) Two
c) Three
d) None
5. C++ class holds ?
a) Data
b) Functions
c) Both a & b
d) Arrays
6. Void occupy how many bytes in memory ?
a) 0
b) 1
c) 2
d) 4
7. Which of the following symbol is used to denote a pre-processor statement ?
a) #
b) $
c) %
d @
8. C++ statements ends with a ?
a) ,
b) ;
c) :
d) None
9. Comments are used to _______ ?
a) Make the program run faster
b) Make a program compile easier
c) Increase the size of executable program
d) To help others read & understand the program
10. Syntax refers to ______ ?
a) Saving program on hard disk
b) Rules used to create a program
c) Both a & b
d) None
11. How many types of errors in C++ ?
a) 1
b) 2
c) 3
d) 4
12. Which of the following storage classes have global visibility ?
a) auto
b) static
c) extern
d) register
13. The data members & member functions of a class are by-default ?
a) Public
b) Private
c) Protected
d) Both a & b
14. Relationship of base class and derive class comes under ?
a) Inheritance
b) Abstraction
c) Encapsulation
d) Polymorphism
15. Function overriding is the example of _____ ?
a) Compile time polymorphism
b) Runtime polymorphism
c) Botha &b
d) None
16. Which of the following can’t be friend ?
a) Class
b) Object
c) Function
d) None of the above
17. Which of the following is the address of operator ?
a) #
b) &
c) %
d @
18. Which Loop is Faster in C++ ?
a) For
b) While
c) Do while
d) All work at same speed
19. Size of a Turbo C/C++ Compiler is ?
a) 16 Bit
b) 32 Bit
c) 64 Bit
d) None of the above
20. Do-While loop is also known as ?
a) Per tested
b) Exit control
c) Entry control
d) All of the above
21. What was the name of C+ + Earlier ?
a) C++
b) CPP
c) C with Classes
d) None of the above
22. In which year C+ + was developed ?
a) 1995
b) 1983
c) 1979
d) 1972
23. The term OOPS stands for ?
a) Object oriented programming
b) Object oriented programming system
c) Oriented oriented programming language
d) Office oriented programming security
24. C++is a language ?
a) Object oriented programming
b) Semi-object oriented programming
c) Procedural oriented programming
d) None of the above
25. What is the size of int datatype in CPP ?
a) 1Byte
b) 2 Bytes
c) 4 Bytes
d) Depends on compiler
26. Which type of language is C+ +?
a) Statically typed language
b) Dynamically typed language
c) Both a & b
d) Procedural
27. In which Lab C+ + was developed ?
a) IBM
b) Bell Lab
c) ANSI
d) SDL
28. Which of the following is a format string ?
a) &
b) \n
c) %d
d) None
29. The if-else statement can be replaced by which operator ?
a) Bitwise operator
b) Arithmetic operator
c) Conditional operator
d) Logical operator
30. Destructor has the same name as the constructor and itis preceded by ____ ?
a) !
b) #
c) ?
d) ~
31. Wrapping data & function in a single unit is known as ?
a) Abstraction
b) Polymorphism
c) Encapsulation
d) None of the above
32. Which of the following class allows only to create single object ?
a) Virtual class
b) Singleton class
c) Abstract class
d) Friend class
33. How run-time polymorphism are implemented in C++ ?
a) Using inheritance
b) Using virtual function
c) Both a and b
d) Using templates
34. What is the other name used for functions inside a class ?
a) Data member
b) Member variable
c) Member function
d) Class function
35. Which operator is overloaded for a cout object ?
a) <
b) >
c) <<
d) >>
36. Which Datatype is best suited to represent logical values ?
a) int
b) char
c) float
d) boolean
37. Which of the following is the default return value of function ?
a) void
b) int
c) char
d) float
38. You can never use address of variable ?
a) auto
b) register
c) global
d) static
39. The default storage for local variables is ?
a) static
b) extern
c) Register
d) auto
40. In OOP abstraction refers to ?
a) Hiding the details
b) Showing only essential info. of the application
c) Reuse once written code again & again
d) Both a & b
41. Which of the following will not return a value ?
a) int
b) void
c) empty
d) null
42. Which block should be placed after try block ?
a) catch
b) throw
c) either catch or throw
d) None of these
43. An inline function is expanded during at ____?
a) Run-time
b) Compile-time
c) Never expanded
d) All of these
44. From which function the execution of a C++ program starts ?
a) new()
b) start()
c) main()
d) sqrt()
45. Which of the following is important in a function ?
a) Return_type
b) Function_name
c) Both a & b
d) Parameter
46. What is the only function all C+ + programs must contain ?
a) new function
b) start function
c) inline function
d) main function
47. The constants are also called as ?
a) const
b) pre-processor
c) literals
d) none
48. An exception can be generated by using which keyword in C++?
a) catch
b) throw
c) throws
d) threw
49. Array Index startat____?
a) 0
b) 1
c) -1
d) None
50. Which of the following is address of operator ?
a) *
b) []c) &&
d) &
51. Which looping process is best used when we known the number of iterations ?
a) for loop
b) while loop
c) do-while
d) All of these
52. Which of the following is scope resolution operator ?
a) :
b) ::
c) ?:
d) None
53. What is the following operator ( ?:) called ?
a) If-else o/p
b) Scope resolution
c) Conditional
d) Ternary
54. goto can be classified into ?
a) Variable
b) Operator
c) Function
d) Label
55. Total types of errors in C+ + ?
a) 1
b) 2
c) 3
d) 4
56. Identify the storage classes that have global visibility ?
a) static
b) auto
c) extern
d) register
57. What does a C+ + class hold ?
a) Data
b) Function
c) Both a & b
d) Arrays
58. What is the name of ‘ * ‘ operator in pointer ?
a) Address of operator
b) Multiplication operator
c) Value at address operator
d) All of the above
59. The destination statement for the go to label is identified by what label ?
a) :
b) $
c) #
d @
60. Which of the following is correct example of pre-increment operator ?
a) +n
b) –n
c) ++n
d) n++
61. Which of the following data type is supported in C++ but notin C?
a) int
b) float
c) double
d) bool
62. Which of the following approach uses C+ + ?
a) Procedural
b) Top-Down
c) Bottom-up
d) All of these
63. Do-While loop is also known as____?
a) Per tested
b) Entry control
c) Exit control
d) All of these
64. What is the Range of signed char ?
a) 0 to 127
b) 0 to 255
c) -128 to 127
d) 127 to -128
65. The value 20.58 can represented using which datatype ?
a) int
b) void
c) double
d) none
66. In CPP, cin and cout are the pre-defined Stream ?
a) Object
b) Operator
c) Function
d) Datatype
67. ASCII value of ‘ \0 ’ character is ?
a) 0
b) 32
c) 48
d) 65
68. Which of the following is Logical AND Operator ?
a) !
b) ||
c) &
d) &&
69. Which of the following is a subscript operator ?
a) *
b) ()
c) {}
d) []
Show Answer
70. Which loop is guaranteed to execute at-least once ?
a) for loop
b) while loop
c) do-while
d) None of these
71. Which of the following is not a type of Constructor in C++?
a) Copy constructor
b) Friend constructor
c) Default constructor
d) Parameterized constructor
72. Which type of value accepts switch statement ?
a) int
b) char
c) float
d) both a & b