C++ MCQs With Answer

C++ Important MCQs

C++ MCQs

  1. C++ was originally developed by;
  2. (a) Clocksin and Mellish
    (b) Donald E. Knuth
    (c) Sir Richard Hadlee
    (d) Bjame Stroustrup

    (d) Bjame Stroustrup

  3. Which of the followinig are procedural languages?
  4. (a) Pascal
    (b) Smalltalk
    (c) C
    (d) Both(a) and (c)

    (d) Both(a) and (c)

  5. Reusability is a desirable feature of a language as it
  6. (a) decreases the testing time
    (b) lowers the maintenance cost
    (c) reduces the compilation time (d) Both (a) and (b)

    (d) Both (a) and (b)

  7. Choose the correct remarks.
  8. (a) C++ allows any operator to be overloaded.
    (b) Some of the existing operators cannot be overloaded.
    (c) Operator precedence cannot be changed.
    (d) All of the above.

    (c) Operator precedence cannot be changed.

  9. Which of the following operators cannot be overloaded ?
  10. (a) >>
    (b) ?:
    (c) .
    (d) Both (b) and (c)

    (d) Both (b) and (c)

  11. Overloading is otherwise called as
  12. (a) virtual polymorphism
    (b) transient polymorphism
    (c) pseudo polymorphism
    (d) ad-hoc polymorphism

    (d) ad-hoc polymorphism

  13. C++ encourages structuring.a software as a collection of components that are
  14. (a) highly cohesive and loosely coupled
    (b) not highly cohesive but loosely coupled
    (c) highly cohesive and tightly coupled
    (d) not highly cohesive but tightly coupled

    (a) highly cohesive and loosely coupled

  15. cout stands for
  16. (a) class output
    (b) character output
    (c) console output
    (d) call output

    (c) console output

  17. The fields in a structure of a C program are by default
  18. (a) protected
    (b) public
    (c) private
    (d) none of the above

    (b) public

  19. Forgetting to include a file (like cmath or math.h) that is necessary will result in
  20. (a) compilation error
    (b) warning when the program is run
    (c) error at link time
    (d) warning when the program is compiled

    (a) compilation error

  21. Which of the following comments about inline comments are true?
  22. (a) A function is declared inline by typing the keyword inline before the return value of the function.
    (b) A function is declared inline by typing the keyword inline after the return value of the function.
    (c) A function that is declared inline may not be treated inline.
    (d) Both (a) & (c)

    (d) Both (a) & (c)

  23. At what point of time a variable comes into existence in memory is determined by its
  24. (a) scope
    (b) storage class
    (c) data type
    (d) all of the above

    (b) storage class

  25. Which of the following specifiers need not be honored by the compiler?
  26. (a) register
    (b) inline
    (c) static
    (d) Both (a) & (b)

    (d) Both (a) & (b)

  27. Which of the following cannot be declared static?
  28. (a) Class
    (b) Object
    (c) Functions
    (d) Both (a) & (b)

    (d) Both (a) & (b)

  29. Which of the following cannot be declared static?
  30. (a) Class
    (b) Object
    (c) Functions
    (d) Both (a) & (b)

    (d) Both (a) & (b)

  31. Let class APE be a friend of class SAPIEN. Let class HUMAN be a child class of SAPIEN and let MONKEY be a child class of APE. Then
  32. (a) SAPIEN is not a friend of APE
    (b) APE is not a friend of HUMAN
    (c) MONKEY is not a friend of SAPIEN
    (d) All of these

    (d) All of these

  33. A class having no name
  34. (a) cannot be passed as an argument
    (b) cannot have a constructor
    (c) cannot have a destructor
    (d) All of these

    (d) All of these

  35. for a method to be an interface between the outside world and a class, it has to be declared
  36. (a) private
    (b) protected
    (c) public
    (d) external

    (c) public

  37. Choose the correct statements from the following:
  38. (a) In a struct, the access control is public by default.
    (b) In a class, the access control is private by default.
    (c) In a class, the access control is public by default.
    (d) Both (a) & (b)

    (d) Both (a) & (b)

  39. The fields in a class, of a C++ program are by default
  40. (a) protected
    (b) public
    (c) private
    (d) none of the above

    (c) private

  41. A constructor is called whenever
  42. (a) an object is declared
    (b) an object is used
    (c) a class is declared
    (d) a class is used

    (a) an object is declared

  43. Which of the following remarks about the differences between constructors and destructors are correct ?
  44. (a) Constructors can take arguments but destructors cannot.
    (b) Constructors can be overloaded but destructors cannot be overloaded.
    (c) Destructors can take arguments but constructors cannot.
    (d) Both (a) and (b)

    (d) Both (a) and (b)

  45. Choose the correct statements.
  46. (a) A destructor is not inherited
    (b) A constructor cannot be called explicitly
    (c) A constructor is not inherited
    (d) All of these

    (d) All of these

  47. Choose the correct statements regarding inline functions.
  48. (a) It speeds up execution
    (b) It slows down execution
    (c) It increases the code size
    (d) Both (a) and (c)

    (d) Both (a) and (c)

  49. If many functions-have the same name, which of the following information, if present, will be used by the compiler to invoke the correct function to be used?
  50. (a) The operator : :
    (b) The return value of the function
    (c) Function signature
    (d) Both (a) & (c)

    (d) Both (a) and (c)

  51. Which of the following parameter passing mechanism(s) is/are supported by C++, but not by C?
  52. (a) Pass by value
    (b) Pass by reference
    (c) Pass by value-result
    (d) All of the above

    (b) Pass by reference

  53. Which of the following type of functions is an ideal candidate for being declared inline?
  54. (a) A function that is small and is not called frequently.
    (b) A function that is small and is called frequently.
    (c) A function that is not small and is not called frequently.
    (d) A function that is not small and is called frequently.

    b) A function that is small and is called frequently.

  55. Which of the following decides if a function that is declared inline is indeed going to be treated inline in the executable code?
  56. (a) Compiler
    (b) Linker
    (c) Loader
    (d) Preprocessor

    (a) Compiler

  57. Which of the following type of functions is an ideal candidate for being declared inline?
  58. (a) A function that is small and is not called frequently.
    (b) A function that is small and is called frequently.
    (c) A function that is not small and is not called frequently.
    (d) A function that is not small and is called frequently.

    (b) A function that is small and is called frequently

  59. One of the disadvantages of pass-by reference is that the called function may inadvertently corrupt the caller's data. This can be avoided by
  60. (a) passing pointers
    (b) declaring the formal parameters constant
    (c) declaring the actual parameters constant
    (d) all of the above

    (b) declaring the formal parameters constant

  61. Data hiding is used to create
  62. (a) inline functions
    (b) private class members
    (c) nonscalar type
    (d) cryptic code

    (b) private class members

  63. Friendship may be granted to
  64. (a) no member functions of other classes
    (b) one member function from one other class
    (c) one member function each from as many classes as appropriate
    (d) as many member functions of other classes as appropriate.

    (d) as many member functions of other classes as appropriate.

  65. If My Class is a friend of Your-Class, which is true?
  66. (a) Your Class is a friend of My Class
    (b) Your Class is not a friend of MY Class
    (c) Your c!ass may or may not be a friend of My Class
    (d) Your Class cannot be a friend of My Class.

    (c) Your c!ass may or may not be a friend of My Class

  67. Forcing a variable type to become another type before accessing an appropriate function is called
  68. (a) regression
    (b) recursion
    (c) conversion
    (d) coersion

    (d) coersion

  69. The programming language feature that allows the sameoperation to be carried out differently depending on the object is
  70. (a) polymorphism
    (b) inheritance
    (c) allocation
    (d) mangling

    (a) polymorphism

  71. Specifically, overloading involves
  72. (a) one function with a variety of arguments
    (b) multiple functions defined with the same name
    (c) one function with multiple names
    (d) multiple functions with different names.

    (b) multiple functions defined with the same name

  73. Object-oriented programmers primarily focus on
  74. (a) procedures to be performed
    (b) step-by-step statements needed to solve a problem
    (c) objects and the tasks that must be performed with those objects
    (d) physical orientation of objects within a program.

    (c) objects and the tasks that must be performed with those objects

  75. Which of the following is the correct syntax to print the message in C++ language?
  76. (a) cout << "Hello world!";
    (b) Cout << "Hello world! ;
    (c) Out << "Hello world!;
    (d) None of the above

    (a) cout << "Hello world!";

  77. c++ is a type of language
  78. (a) Low Level Language
    (b) middle-level language
    (c) Hight level Language
    (d) None

    (b) middle-level language

  79. c++ is a high-level language
  80. (a) object-oriented programming language
    (b) middle-level language
    (c) Hight level Language
    (d) None

    (a) object-oriented programming language

  81. what is the use of c++ programming language in real life?
  82. (a) operating systems,embedded software, autonomous cars
    (b) games
    (c) medical technology
    (d) All of above

    (d) All of above

  83. which of the following is the correct identifier?
  84. (a) 7var_name
    (b) 7VARNAME
    (c) VAR_1234
    (d) $var_name

    (c) VAR_1234

  85. which of the following comment syntax is correct to create a single-line comment in the c++ program?
  86. (a) //commment
    (b) comment//
    (c) #comment
    (d) None

    (a) //commment

  87. for inserting a new line in c++ program, which one of the following statements can be used?
  88. (a) \n
    (b) \t
    (c) n//
    (d) \\n

    (a) \n

  89. which of the following is called extraction/get from operator?
  90. (a) <<
    (b) >>
    (c) <
    (d) >

    (b) >>

C++ MCQs With Answer
C++ MCQs With Answer
Cover Topics

"C++ MCQs With Answer","c++ multiple choice questions and answers pdf","c++ multiple choice questions with answers","c++ mcq online test","C++ Important MCQs,c++ quiz,c++ questions pdf","C++ Programming Multiple Choice Questions and Answers" ,"C++ (CPP) mcq, C++ MCQ","C++ Programming quiz answers PDF"

Post a Comment

We welcome relevant and respectful comments. Off-topic or spam comments may be removed.

Previous Post Next Post