C++ MCQ Questions And Answers

C++ MCQ Questions And Answers

 

1. Who is the developer of C++?

a) Dennis Ritchie
b) Ken Thompson
c) Brian Kernighan
d) Bjarne Stroustrup

Show Answer
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

Show Answer
c) High-level Language

 

3. Which of the following is not a member of class ?

a) Virtual function
b) Friend function
c) Const function
d) Static function

Show Answer
b) Friend function

 

4. How many types of Constructor are there in C++ ?

a) One
b) Two
c) Three
d) None

Show Answer
c) Three

 

5. C++ class holds ?

a) Data
b) Functions
c) Both a & b
d) Arrays

Show Answer
c) Both a & b

 

6. Void occupy how many bytes in memory ?

a) 0
b) 1
c) 2
d) 4

Show Answer
a) 0

 

7. Which of the following symbol is used to denote a pre-processor statement ?

a) #
b) $
c) %
d @

Show Answer
a) #

 

8. C++ statements ends with a ?

a) ,
b) ;
c) :
d) None

Show Answer
b) ;

 

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

Show Answer
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

Show Answer
b) Rules used to create a program


11. How many types of errors in C++ ?

a) 1
b) 2
c) 3
d) 4

Show Answer
c) 3

 

12. Which of the following storage classes have global visibility ?

a) auto
b) static
c) extern
d) register

Show Answer
c) extern

 

13. The data members & member functions of a class are by-default ?

a) Public
b) Private
c) Protected
d) Both a & b

Show Answer
b) Private

 

14. Relationship of base class and derive class comes under ?

a) Inheritance
b) Abstraction
c) Encapsulation
d) Polymorphism

Show Answer
a) Inheritance

 

15. Function overriding is the example of _____ ?

a) Compile time polymorphism
b) Runtime polymorphism
c) Botha &b
d) None

Show Answer
b) Runtime polymorphism

 

16. Which of the following can’t be friend ?

a) Class
b) Object
c) Function
d) None of the above

Show Answer
b) Object

 

17. Which of the following is the address of operator ?

a) #
b) &
c) %
d @

Show Answer
b) &

 

18. Which Loop is Faster in C++ ?

a) For
b) While
c) Do while
d) All work at same speed

Show Answer
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

Show Answer
a) 16 Bit

 

20. Do-While loop is also known as ?

a) Per tested
b) Exit control
c) Entry control
d) All of the above

Show Answer
b) Exit control


21. What was the name of C+ + Earlier ?

a) C++
b) CPP
c) C with Classes
d) None of the above

Show Answer
c) C with Classes

 

22. In which year C+ + was developed ?

a) 1995
b) 1983
c) 1979
d) 1972

Show Answer
c) 1979

 

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

Show Answer
b) Object oriented programming system

 

24. C++is a language ?

a) Object oriented programming
b) Semi-object oriented programming
c) Procedural oriented programming
d) None of the above

Show Answer
b) Semi-object oriented programming

 

25. What is the size of int datatype in CPP ?

a) 1Byte
b) 2 Bytes
c) 4 Bytes
d) Depends on compiler

Show Answer
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

Show Answer
a) Statically typed language

 

27. In which Lab C+ + was developed ?

a) IBM
b) Bell Lab
c) ANSI
d) SDL

Show Answer
b) Bell Lab

 

28. Which of the following is a format string ?

a) &
b) \n
c) %d
d) None

Show Answer
c) %d

 

29. The if-else statement can be replaced by which operator ?

a) Bitwise operator
b) Arithmetic operator
c) Conditional operator
d) Logical operator

Show Answer
c) Conditional operator

 

30. Destructor has the same name as the constructor and itis preceded by ____ ?

a) !
b) #
c) ?
d) ~

Show Answer
d) ~


31. Wrapping data & function in a single unit is known as ?

a) Abstraction
b) Polymorphism
c) Encapsulation
d) None of the above

Show Answer
c) Encapsulation

 

32. Which of the following class allows only to create single object ?

a) Virtual class
b) Singleton class
c) Abstract class
d) Friend class

Show Answer
b) Singleton 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

Show Answer
c) Both a and b

 

34. What is the other name used for functions inside a class ?

a) Data member
b) Member variable
c) Member function
d) Class function

Show Answer
c) Member function

 

35. Which operator is overloaded for a cout object ?

a) <
b) >
c) <<
d) >>

Show Answer
c) <<

 

36. Which Datatype is best suited to represent logical values ?

a) int
b) char
c) float
d) boolean

Show Answer
d) boolean

 

37. Which of the following is the default return value of function ?

a) void
b) int
c) char
d) float

Show Answer
b) int

 

38. You can never use address of variable ?

a) auto
b) register
c) global
d) static

Show Answer
b) register

 

39. The default storage for local variables is ?

a) static
b) extern
c) Register
d) auto

Show Answer
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

Show Answer
d) Both a & b

 

41. Which of the following will not return a value ?

a) int
b) void
c) empty
d) null

Show Answer
b) void

 

42. Which block should be placed after try block ?

a) catch
b) throw
c) either catch or throw
d) None of these

Show Answer
a) catch

 

43. An inline function is expanded during at ____?

a) Run-time
b) Compile-time
c) Never expanded
d) All of these

Show Answer
b) Compile-time

 

44. From which function the execution of a C++ program starts ?

a) new()
b) start()
c) main()
d) sqrt()

Show Answer
c) main()

 

45. Which of the following is important in a function ?

a) Return_type
b) Function_name
c) Both a & b
d) Parameter

Show Answer
c) Both a & b

 

46. What is the only function all C+ + programs must contain ?

a) new function
b) start function
c) inline function
d) main function

Show Answer
d) main function

 

47. The constants are also called as ?

a) const
b) pre-processor
c) literals
d) none

Show Answer
c) literals

 

48. An exception can be generated by using which keyword in C++?

a) catch
b) throw
c) throws
d) threw

Show Answer
b) throw

 

49. Array Index startat____?

a) 0
b) 1
c) -1
d) None

Show Answer
a) 0


50. Which of the following is address of operator ?

a) *
b) []c) &&
d) &

Show Answer
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

Show Answer
a) for loop

 

52. Which of the following is scope resolution operator ?

a) :
b) ::
c) ?:
d) None

Show Answer
b) ::

 

53. What is the following operator ( ?:) called ?

a) If-else o/p
b) Scope resolution
c) Conditional
d) Ternary

Show Answer
d) Ternary

 

54. goto can be classified into ?

a) Variable
b) Operator
c) Function
d) Label

Show Answer
d) Label

 

55. Total types of errors in C+ + ?

a) 1
b) 2
c) 3
d) 4

Show Answer
c) 3

 

56. Identify the storage classes that have global visibility ?

a) static
b) auto
c) extern
d) register

Show Answer
d) register

 

57. What does a C+ + class hold ?

a) Data
b) Function
c) Both a & b
d) Arrays

Show Answer
c) Both a & b

 

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

Show Answer
c) Value at address operator

 

59. The destination statement for the go to label is identified by what label ?

a) :
b) $
c) #
d @

Show Answer
a) :

 

60. Which of the following is correct example of pre-increment operator ?

a) +n
b) –n
c) ++n
d) n++

Show Answer
c) ++n

 

61. Which of the following data type is supported in C++ but notin C?

a) int
b) float
c) double
d) bool

Show Answer
d) bool

 

62. Which of the following approach uses C+ + ?

a) Procedural
b) Top-Down
c) Bottom-up
d) All of these

Show Answer
c) Bottom-up

 

63. Do-While loop is also known as____?

a) Per tested
b) Entry control
c) Exit control
d) All of these

Show Answer
c) Exit control

 

64. What is the Range of signed char ?

a) 0 to 127
b) 0 to 255
c) -128 to 127
d) 127 to -128

Show Answer
c) -128 to 127

 

65. The value 20.58 can represented using which datatype ?

a) int
b) void
c) double
d) none

Show Answer
c) double

 

66. In CPP, cin and cout are the pre-defined Stream ?

a) Object
b) Operator
c) Function
d) Datatype

Show Answer
a) Object

 

67. ASCII value of ‘ \0 ’ character is ?

a) 0
b) 32
c) 48
d) 65

Show Answer
a) 0

 

68. Which of the following is Logical AND Operator ?

a) !
b) ||
c) &
d) &&

Show Answer
d) &&

 

69. Which of the following is a subscript operator ?

a) *
b) ()
c) {}
d) [] Show Answer

d) []

 

70. Which loop is guaranteed to execute at-least once ?

a) for loop
b) while loop
c) do-while
d) None of these

Show Answer
c) do-while

 

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

Show Answer
b) Friend constructor

 

72. Which type of value accepts switch statement ?

a) int
b) char
c) float
d) both a & b

Show Answer
d) both a & b

 

Leave a Comment