Home

C++ Programming 1000+ MCQ with answer for SBI PO

Thursday 9th of March 2023

Sharing is caring

1. A constructor cannot be explicitly called.
A. True
B. False
C.
D.
Answer : A
2. By default, members cannot be inherited.
A. True
B. False
C.
D.
Answer : A
3. this' is an implicit pointer.
A. True
B. False
C.
D.
Answer : A
4. In C++, the exception handler is invoked with a-
A. try block
B. throw exception
C. catch function
D. abort()
Answer : B
5. The member of a structure can be directly accessed by
A. ->
B. dot operator
C. ::
D. >>
Answer : B
6. 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
7. 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
8. Overloaded functions
A. Are a group of functions with the same name
B. All have the same number and types of arguments
C. Make life simpler for programmer
D. May fail unexpectedly due to stress
Answer : A
9. In C++, the stream base class is
A. iostream
B. iofstream
C. ios
D. stdio
Answer : C
10. Constructor returns void type value.
A. True
B. False
C.
D.
Answer : B
11. _______ argument(s) are passed in case of binary overloaded operators.
A. Two
B. One
C. No
D. None of the above
Answer : A
12. An object is an allocated space in memory.
A. True
B. False
C.
D.
Answer : A
13. Class is similar to a variable.
A. True
B. False
C.
D.
Answer : B
14. _____________ operator must have one class object
A. +
B. new
C. all
D. None of these
Answer : B
15. this' pointer has to be used while accessing data members in a member function.
A. True
B. False
C.
D.
Answer : A
16. 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
17. 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
18. 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
19. iostream is inheried from istream, ostream and ios class.
A. True
B. False
C.
D.
Answer : B
20. 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
21. 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
22. 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
23. A variable defined within a block is visible
A. From the point of definition onwards in the program
B. From the point of definition onwards in the function
C. From the point of definition onwards in the block
D. Throughout the function
Answer : C
24. 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
25. In C++, an identifier must be initialized using constant expression.
A. True
B. False
C.
D.
Answer : B
26. Objects get destroyed in the reverse order as they are created.
A. True
B. False
C.
D.
Answer : A
27. 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
28. Private members of a structure can be accessed directly from the outside of the structure.
A. True
B. False
C.
D.
Answer : B
29. The template function declaration specifies
A. template class
B. a generic class
C. exception
D. identifier
Answer : B
30. 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
31. 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
32. Static data member occurs in only class scope.
A. True
B. False
C.
D.
Answer : B
33. If class A is friend of class B and if class B is friend of class C, which of the following is true?
A. Class C is friend of class A
B. Class A is friend of class C
C. Class A and Class C do not have any friend relationship
D. None of the above
Answer : B
34. The following syntax is valid. void inline gram_ panchayat :: show_gram_ panchayat_info().
A. True
B. False
C.
D.
Answer : B
35. 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
36. The new operator always returns a void pointer.
A. True
B. False
C.
D.
Answer : A
37. What is the output of the following program segment - for(i = 1, j = 0; i < 10; i++) j += i; cout <<i<<"
";

A. 10
B. 20
C. 55
D. there is an error in the program
Answer : A
38. The getch() library function
A. Returns a character when any key is pressed
B. Returns a character when ENTER is pressed
C. Display a character on the screen when a key is pressed
D. Does not display a character on the screen
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 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
41. We can make function inline by using the keyword 'inline'.
A. True
B. False
C.
D.
Answer : A
42. Static member functions have file scope.
A. True
B. False
C.
D.
Answer : A
43. 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
44. 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
45. Static data member can be declared as const too.
A. True
B. False
C.
D.
Answer : A
46. 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
47. The value of 'this' pointer can be changed.
A. True
B. False
C.
D.
Answer : B
48. 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
49. Inline function specifier reduces the overheads associated with a normal function call.
A. True
B. False
C.
D.
Answer : A
50. Data objects can be initialized when allocating memory using 'new'.
A. True
B. False
C.
D.
Answer : A

Sharing is caring