Home

C++ Programming MCQ Solved Paper for IBPS SO

Thursday 9th of March 2023

Sharing is caring

1. The value of 'this' pointer can be changed.
A. True
B. False
C.
D.
Answer : B
2. The exception is processed using
A. unexpected()
B. perform()
C. catch()
D. try()
Answer : C
3. 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
4. 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
5. this' pointer has to be used while accessing data members in a member function.
A. True
B. False
C.
D.
Answer : A
6. 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
7. Class is similar to a variable.
A. True
B. False
C.
D.
Answer : B
8. 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
9. 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
10. Static data member can be declared as const too.
A. True
B. False
C.
D.
Answer : A
11. 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
12. 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
13. _______ argument(s) are passed in case of binary overloaded operators.
A. Two
B. One
C. No
D. None of the above
Answer : A
14. Class members are _______________ by default
A. Private
B. protected
C. public
D. None of the above are correct
Answer : A
15. 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
16. 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
17. 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
18. A constructor cannot be explicitly called.
A. True
B. False
C.
D.
Answer : A
19. Element double Array[7] is which element of the array?
A. sixth
B. seventh
C. eighth
D. impossible to tell
Answer : C
20. :: is known as
A. scope resolution operator
B. global operator
C. Both (a) & (b)
D. None of these
Answer : A
21. A base class is inherited by
A. derived class
B. inline function
C. constructor
D. none of the above
Answer : A
22. A destructor can have arguments like constructor.
A. True
B. False
C.
D.
Answer : B
23. 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
24. Scope resolution operator has the highest precedence.
A. True
B. False
C.
D.
Answer : A
25. 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
26. 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
27. By default, members cannot be inherited.
A. True
B. False
C.
D.
Answer : A
28. _____________ operator must have one class object
A. +
B. new
C. all
D. None of these
Answer : B
29. 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
30. Protected members cannot be inherited.
A. True
B. False
C.
D.
Answer : B
31. The scope resolution operator is -
A. ::
B. ;
C. <<
D. ->
Answer : A
32. 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
33. 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
34. 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
35. The template function declaration specifies
A. template class
B. a generic class
C. exception
D. identifier
Answer : B
36. main() returns a value of type
A. real
B. char
C. int
D. null
Answer : C
37. cc ___________ option is used only to create object file
A. -a
B. -o
C. -c
D. none of these
Answer : B
38. 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
39. In C++, the stream base class is
A. iostream
B. iofstream
C. ios
D. stdio
Answer : C
40. 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
41. 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
42. The following syntax is valid. void inline gram_ panchayat :: show_gram_ panchayat_info().
A. True
B. False
C.
D.
Answer : B
43. A destructor can have a return type.
A. True
B. False
C.
D.
Answer : B
44. 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
45. ios containes a pointer to streambuf.
A. True
B. False
C.
D.
Answer : A
46. 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
47. 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
48. 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
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. Dynamic memory can be allocated by the following declaration
A. new
B. volatile
C. static
D. ==
Answer : A

Sharing is caring