Home

C++ Programming 1000+ MCQ with answer for CTET

Thursday 9th of March 2023

Sharing is caring

1. A member function can always access the data
A. In the object of which it is a member
B. In the class of which it is a member
C. In the object of the class of which it is a member
D. In the public part of its class
Answer : B
2. In case of nested class, enclosing class can directly access the private data member of nested class.
A. True
B. False
C.
D.
Answer : A
3. 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
4. Dynamic memory can be allocated by the following declaration
A. new
B. volatile
C. static
D. ==
Answer : A
5. Protected 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
6. The value of 'this' pointer can be changed.
A. True
B. False
C.
D.
Answer : B
7. :: is known as
A. scope resolution operator
B. global operator
C. Both (a) & (b)
D. None of these
Answer : A
8. What is the value of Friday in the following - enum days { Monday, Tuesday, Wednesday = -1, Thursday, Friday, Saturday = 6, Sunday}
A. 1
B. 5
C. 0
D. -3
Answer : A
9. this' is an implicit pointer.
A. True
B. False
C.
D.
Answer : A
10. 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
11. Member function cannot be called from within a constructor.
A. True
B. False
C.
D.
Answer : A
12. The exception is processed using
A. unexpected()
B. perform()
C. catch()
D. try()
Answer : C
13. 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
14. 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
15. We can make function inline by using the keyword 'inline'.
A. True
B. False
C.
D.
Answer : A
16. Data objects can be initialized when allocating memory using 'new'.
A. True
B. False
C.
D.
Answer : A
17. Constructor returns void type value.
A. True
B. False
C.
D.
Answer : B
18. The template function declaration specifies
A. template class
B. a generic class
C. exception
D. identifier
Answer : B
19. A base class is inherited by
A. derived class
B. inline function
C. constructor
D. none of the above
Answer : A
20. Pick out the most appropriate statement from the following
A. references are pointers
B. array of references can be created
C. you can not reference a reference variable
D. all of the above
Answer : C
21. The break statement causes an exit
A. Only from the innermost loop
B. Only from the innermost switch
C. From all loops and switch
D. Only from the innermost loops or switch
Answer : A
22. Inline function specifier reduces the overheads associated with a normal function call.
A. True
B. False
C.
D.
Answer : A
23. When accessing a structure member, the identifier to the left of the dot operator is the name of
A. Structure member
B. Structure tag
C. Structure variable
D. The keyword struct.
Answer : C
24. 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
25. Pick out the most appropriate statement
A. All variables must be declared before they are used
B. Variables in C++ need not be declared and the type can be assigned dynamically
C. Variables in C++ can be declared at the end of the program (before the main function terminates)
D. Variables can not be used explicitly in C++
Answer : A
26. _______ argument(s) are passed in case of unary overloaded operators.
A. Two
B. One
C. No
D. None of the above
Answer : B
27. The library function exit() causes an exit from
A. The loop in which it occurs
B. The block in which it occurs
C. The function in which it occurs
D. The program in which it occurs
Answer : D
28. 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
29. In C++, identifiers have to be declared at the beginning of the blocks.
A. True
B. False
C.
D.
Answer : A
30. Which of the following relationship is known as inheritancerelationship?
A. ‘has-a’ relationship
B. ‘is-a’ relationship
C. association relationship
D. none of the above
Answer : A
31. Element double Array[7] is which element of the array?
A. sixth
B. seventh
C. eighth
D. impossible to tell
Answer : C
32. Class members are _______________ by default
A. Private
B. protected
C. public
D. None of the above are correct
Answer : A
33. We cannot have the address of a constructor.
A. True
B. False
C.
D.
Answer : A
34. An object is an allocated space in memory.
A. True
B. False
C.
D.
Answer : A
35. By default, members cannot be inherited.
A. True
B. False
C.
D.
Answer : A
36. Reference to an object behaves like a constant pointer.
A. True
B. False
C.
D.
Answer : B
37. Objects get destroyed in the reverse order as they are created.
A. True
B. False
C.
D.
Answer : A
38. The characteristic that data can be manipulated only through member functions that are part of the class is called
A. Encapsulation
B. Data dependency
C. Inheritance
D. Instantiation
Answer : A
39. Sharing of common information are achieved by the concept of
A. Virtual copying
B. Inheritance
C. Encapsulation
D. None of these
Answer : B
40. 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
41. Static data member occurs in only class scope.
A. True
B. False
C.
D.
Answer : B
42. Protected members cannot be inherited.
A. True
B. False
C.
D.
Answer : B
43. The scope resolution operator is -
A. ::
B. ;
C. <<
D. ->
Answer : A
44. Static member functions have file scope.
A. True
B. False
C.
D.
Answer : A
45. Private members of a structure can be accessed directly from the outside of the structure.
A. True
B. False
C.
D.
Answer : B
46. The string table in C++ holds the
A. string constants in your program
B. program statements in string form
C. variables whose type is of string
D. none of the above
Answer : A
47. Which of the following are good reasons to use an object oriented language?
A. You can define your data types
B. Program statements are simpler than in procedural languages.
C. An OO program can be taught to correct its own errors.
D. It's easier to conceptualize an OO program.
Answer : A
48. "[]" Operator is a unary operator.
A. True
B. False
C.
D.
Answer : A
49. Private data members can be accessed
A. Only from the base class itself
B. Both from the base class and form its derived classes
C. From the class which is a friend of the base class
D. None of the above is correct
Answer : A
50. Operator overloading is
A. Making C++ operators work with objects
B. Making C++ operators more then they can handle
C. Giving new meaning to existing c++ operators
D. Making new C++ operators
Answer : C

Sharing is caring