Home

XAT - C++ Programming 1000+ MCQ [Solved] PDF Download

Thursday 9th of March 2023

Sharing is caring

1. In C++, an identifier must be initialized using constant expression.
A. True
B. False
C.
D.
Answer : B
2. The members of a class can be made private by
A. declaring them private
B. by default they are private
C. by declaring them in the beginning of the program immediately after main()
D. they are always public
Answer : A
3. Static data member can be declared as const too.
A. True
B. False
C.
D.
Answer : A
4. The following syntax is valid. void inline gram_ panchayat :: show_gram_ panchayat_info().
A. True
B. False
C.
D.
Answer : B
5. 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
6. 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
7. 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
8. 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
9. Data objects can be initialized when allocating memory using 'new'.
A. True
B. False
C.
D.
Answer : A
10. The member of a structure can be accessed through a pointer by
A. ->
B. dot operator
C. ::
D. >>
Answer : A
11. The template function declaration specifies
A. template class
B. a generic class
C. exception
D. identifier
Answer : B
12. The value of 'this' pointer can be changed.
A. True
B. False
C.
D.
Answer : B
13. 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
14. :: is known as
A. scope resolution operator
B. global operator
C. Both (a) & (b)
D. None of these
Answer : A
15. 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
16. The new operator always returns a void pointer.
A. True
B. False
C.
D.
Answer : A
17. _______ argument(s) are passed in case of binary overloaded operators.
A. Two
B. One
C. No
D. None of the above
Answer : A
18. 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
19. Static data member occurs in only class scope.
A. True
B. False
C.
D.
Answer : B
20. By default, members cannot be inherited.
A. True
B. False
C.
D.
Answer : A
21. 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
22. 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
23. iostream is inheried from istream, ostream and ios class.
A. True
B. False
C.
D.
Answer : B
24. 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
25. The ?: can be used to replace
A. if-else statement
B. wild cards
C. no meaning in C++
D. returns the value
Answer : A
26. Private members of a structure can be accessed directly from the outside of the structure.
A. True
B. False
C.
D.
Answer : B
27. 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
28. 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
29. this' pointer has to be used while accessing data members in a member function.
A. True
B. False
C.
D.
Answer : A
30. We cannot have the address of a constructor.
A. True
B. False
C.
D.
Answer : A
31. A constructor cannot be explicitly called.
A. True
B. False
C.
D.
Answer : A
32. 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
33. 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
34. "[]" Operator is a unary operator.
A. True
B. False
C.
D.
Answer : A
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. Class is similar to a variable.
A. True
B. False
C.
D.
Answer : B
37. 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
38. 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
39. Inline functions_____________ call overload.
A. Increase
B. Reduce
C. None of the above are correct
D.
Answer : B
40. Objects get destroyed in the reverse order as they are created.
A. True
B. False
C.
D.
Answer : A
41. ios containes a pointer to streambuf.
A. True
B. False
C.
D.
Answer : A
42. We can make function inline by using the keyword 'inline'.
A. True
B. False
C.
D.
Answer : A
43. _______ argument(s) are passed in case of unary overloaded operators.
A. Two
B. One
C. No
D. None of the above
Answer : B
44. Member function cannot be called from within a constructor.
A. True
B. False
C.
D.
Answer : A
45. Constructor returns void type value.
A. True
B. False
C.
D.
Answer : B
46. Scope resolution operator has the highest precedence.
A. True
B. False
C.
D.
Answer : A
47. Dynamic memory can be allocated by the following declaration
A. new
B. volatile
C. static
D. ==
Answer : A
48. 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
49. 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
50. Class members are _______________ by default
A. Private
B. protected
C. public
D. None of the above are correct
Answer : A

Sharing is caring