Home

C++ Programming 1000+ MCQ with answer for CAT

Thursday 9th of March 2023

Sharing is caring

1. Private members of a structure can be accessed directly from the outside of the structure.
A. True
B. False
C.
D.
Answer : B
2. A pure virtual function is a virtual function that has
A. no definition in its base class
B. a definition in its base class
C. a definition in at least one derived class
D. definition in base class and at least one derived class
Answer : A
3. Public data members can be accessed
A. Only from the base class itself
B. Both form the base class and from its derived classes
C. From the class which is friend of the base class
D. None of the above are correct
Answer : B
4. By using protected, one can create class members that are private to their class but
A. that can not be inherited and accessed by a derived class
B. that can still be inherited and accessed by a derived class
C. that can be public
D. none of the above
Answer : B
5. Class is similar to a variable.
A. True
B. False
C.
D.
Answer : B
6. A base class is inherited by
A. derived class
B. inline function
C. constructor
D. none of the above
Answer : A
7. A class that contains at least one pure virtual function is called as
A. pure class
B. abstract class
C. base class
D. derived class
Answer : B
8. When one object initializes another object the following function is invoked
A. copy constructor
B. new
C. instantiation
D. none of the above
Answer : A
9. Static data member can be declared as const too.
A. True
B. False
C.
D.
Answer : A
10. iostream is inheried from istream, ostream and ios class.
A. True
B. False
C.
D.
Answer : B
11. The && and || operators
A. Compare two numeric values
B. Combine two numeric values
C. Compare two Boolean values
D. Combine two Boolean values
Answer : C
12. Delete operator is used
A. To allocate storage
B. To deallocate storage
C. To delete variable name
D. None of the above are correct
Answer : B
13. In C++, an identifier must be initialized using constant expression.
A. True
B. False
C.
D.
Answer : B
14. It is possible to allow non member function access to private members of a class by declaring it as
A. public
B. friend
C. private
D. not possible
Answer : B
15. In C++, the exception handler is invoked with a-
A. try block
B. throw exception
C. catch function
D. abort()
Answer : B
16. A function that is called automatically when an object is destroyed is known as
A. instantiation
B. function prototype
C. constructor
D. destructor
Answer : D
17. The binding that binds a function call at run time is called
A. early binding
B. run time binding
C. late binding
D. linking
Answer : C
18. The members of a class by default are private.
A. True
B. False
C.
D.
Answer : A
19. Static member functions have file scope.
A. True
B. False
C.
D.
Answer : A
20. Sharing of common information are achieved by the concept of
A. Virtual copying
B. Inheritance
C. Encapsulation
D. None of these
Answer : B
21. Which of the following is not a component of file system
A. Access method
B. Auxiliary storage management
C. Free integrity mechanism
D. None of the above
Answer : C
22. _______ argument(s) are passed in case of unary overloaded operators.
A. Two
B. One
C. No
D. None of the above
Answer : B
23. When a language has the capacity to produce new data type, it is said to be
A. Reprehensible
B. Encapsulated
C. Overload
D. Extensible
Answer : D
24. Class members are _______________ by default
A. Private
B. protected
C. public
D. None of the above are correct
Answer : A
25. If a friend function is declared inside a class it can access all data members of the class.
A. True
B. False
C.
D.
Answer : A
26. Scope resolution operator has the highest precedence.
A. True
B. False
C.
D.
Answer : A
27. In C++, the keyword auto can be used for
A. Automatic assignment of data to object during instantiation
B. Automatic call of a function
C. To declare a local variable
D. It is not a keyword in C++
Answer : C
28. Objects get destroyed in the reverse order as they are created.
A. True
B. False
C.
D.
Answer : A
29. A normal C++ operator that acts in a special way on newly defined data types is said to be
A. Glorified
B. Encapsulated
C. Classified
D. Overloaded
Answer : D
30. In a for loop with a multi-statement loop body, semicolons should appear following
A. The for statement itself
B. The closing brace in a multi-statement loop body
C. Each statement within the loop body.
D. The test expression
Answer : C
31. Protected members cannot be inherited.
A. True
B. False
C.
D.
Answer : B
32. By default, members cannot be inherited.
A. True
B. False
C.
D.
Answer : A
33. Dynamic memory can be allocated by the following declaration
A. new
B. volatile
C. static
D. ==
Answer : A
34. By default, C++ uses the following method of passing arguments
A. Call-by-Reference
B. Call-by-Value
C. Call-by-Pointer
D. None of the above
Answer : B
35. _______ argument(s) are passed in case of binary overloaded operators.
A. Two
B. One
C. No
D. None of the above
Answer : A
36. The scope resolution operator is -
A. ::
B. ;
C. <<
D. ->
Answer : A
37. A direct access file is:
A. A file in which recoreds are arranged in a way they are inserted in a file
B. A file in which records are arranged in a particular order
C. Files which are stored on a direct access storage medium
D. None of the above
Answer : C
38. The value of 'this' pointer can be changed.
A. True
B. False
C.
D.
Answer : B
39. The exception is processed using
A. unexpected()
B. perform()
C. catch()
D. try()
Answer : C
40. You can read input that consists of multiple lines of text using
A. The normal cout<< combination
B. The cin.get() function with one argument
C. The cin.get() function with two argument
D. The cin.get() function with three argument
Answer : C
41. One of the important features of an abstract class is
A. it need not have any object
B. it should be used only as a derived class
C. it need not have any members
D. none of the above
Answer : A
42. The signature of a function is
A. The return type
B. The number and type of arguments
C. The class of a function
D. None of the above
Answer : D
43. this' is an implicit pointer.
A. True
B. False
C.
D.
Answer : A
44. Reference to an object behaves like a constant pointer.
A. True
B. False
C.
D.
Answer : B
45. Which of the following is true about const member functions?
A. const members can be invoked on both const as well as nonconst objects
B. const members can be invoked only on const objects and not on nonconst objects
C. nonconst members can be invoked on const objects as well as nonconst objects
D. none of the above
Answer : B
46. :: is known as
A. scope resolution operator
B. global operator
C. Both (a) & (b)
D. None of these
Answer : A
47. "[]" Operator is a unary operator.
A. True
B. False
C.
D.
Answer : A
48. Classes are useful because they
A. Are removed from memory when not in use
B. Permit data to be hidden from other classes
C. Bring together all aspects of an entity in one place
D. Can closely model objects in the real world
Answer : B
49. this' pointer has to be used while accessing data members in a member function.
A. True
B. False
C.
D.
Answer : A
50. We can make function inline by using the keyword 'inline'.
A. True
B. False
C.
D.
Answer : A

Sharing is caring