Home

JEE Main - C++ Programming 1000+ MCQ [Solved] PDF Download

Thursday 9th of March 2023

Sharing is caring

1. new operator is used
A. To dynamically allocate storage
B. To statically allocate storage
C. To allocate storage for a new variable
D. None of the above are correct
Answer : C
2. ios containes a pointer to streambuf.
A. True
B. False
C.
D.
Answer : A
3. Constructor returns void type value.
A. True
B. False
C.
D.
Answer : B
4. An object is an allocated space in memory.
A. True
B. False
C.
D.
Answer : A
5. By default, members cannot be inherited.
A. True
B. False
C.
D.
Answer : A
6. Protected members cannot be inherited.
A. True
B. False
C.
D.
Answer : B
7. The new operator always returns a void pointer.
A. True
B. False
C.
D.
Answer : A
8. this' is an implicit pointer.
A. True
B. False
C.
D.
Answer : A
9. iostream is inheried from istream, ostream and ios class.
A. True
B. False
C.
D.
Answer : B
10. 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
11. The exception is processed using
A. unexpected()
B. perform()
C. catch()
D. try()
Answer : C
12. A copy constructor is used to copy an object member wise to another object of the same class.
A. True
B. False
C.
D.
Answer : A
13. Element double Array[7] is which element of the array?
A. sixth
B. seventh
C. eighth
D. impossible to tell
Answer : C
14. In a class, only the member function can access data, which is not accessible to outside. This feature is called:
A. Data security
B. Data hiding
C. Data manipulation
D. Data definition
Answer : B
15. Static data member occurs in only class scope.
A. True
B. False
C.
D.
Answer : B
16. 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
17. 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
18. Inline functions_____________ call overload.
A. Increase
B. Reduce
C. None of the above are correct
D.
Answer : B
19. 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
20. One of the major disadvantage with late binding is
A. the source code should be made available at compile time
B. the program runs slower
C. dynamic variables can not be used in the program
D. static variables can not be used
Answer : B
21. The value of 'this' pointer can be changed.
A. True
B. False
C.
D.
Answer : B
22. Friend function have access to the
A. private and protected members
B. public members only
C. private members only
D. None of the above are correct
Answer : B
23. In C++, the stream base class is
A. iostream
B. iofstream
C. ios
D. stdio
Answer : C
24. Data objects can be initialized when allocating memory using 'new'.
A. True
B. False
C.
D.
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. 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
27. Dynamic memory can be allocated by the following declaration
A. new
B. volatile
C. static
D. ==
Answer : A
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. Inline function specifier reduces the overheads associated with a normal function call.
A. True
B. False
C.
D.
Answer : A
30. Class members are _______________ by default
A. Private
B. protected
C. public
D. None of the above are correct
Answer : A
31. main() returns a value of type
A. real
B. char
C. int
D. null
Answer : C
32. Static data member can be declared as const too.
A. True
B. False
C.
D.
Answer : A
33. 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
34. A function that is called automatically when an object is created is known as
A. instantiation
B. function prototype
C. constructor
D. structure
Answer : C
35. 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
36. 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
37. In C++, the exception handler is invoked with a-
A. try block
B. throw exception
C. catch function
D. abort()
Answer : B
38. Private members of a structure can be accessed directly from the outside of the structure.
A. True
B. False
C.
D.
Answer : B
39. We can make function inline by using the keyword 'inline'.
A. True
B. False
C.
D.
Answer : A
40. 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
41. A destructor can have a return type.
A. True
B. False
C.
D.
Answer : B
42. Scope resolution operator has the highest precedence.
A. True
B. False
C.
D.
Answer : A
43. 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
44. 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
45. _______ argument(s) are passed in case of unary overloaded operators.
A. Two
B. One
C. No
D. None of the above
Answer : B
46. 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
47. The members of a class by default are private.
A. True
B. False
C.
D.
Answer : A
48. 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
49. 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
50. Objects get destroyed in the reverse order as they are created.
A. True
B. False
C.
D.
Answer : A

Sharing is caring