Home

IBPS RRB - C++ Programming 1000+ MCQ [Solved] PDF Download

Thursday 9th of March 2023

Sharing is caring

1. A constructor cannot be explicitly called.
A. True
B. False
C.
D.
Answer : A
2. 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
3. The following syntax is valid. void inline gram_ panchayat :: show_gram_ panchayat_info().
A. True
B. False
C.
D.
Answer : B
4. 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
5. 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
6. 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
7. 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
8. Inline function specifier reduces the overheads associated with a normal function call.
A. True
B. False
C.
D.
Answer : A
9. this' is an implicit pointer.
A. True
B. False
C.
D.
Answer : A
10. Static data member occurs in only class scope.
A. True
B. False
C.
D.
Answer : B
11. cc ___________ option is used only to create object file
A. -a
B. -o
C. -c
D. none of these
Answer : B
12. Member function cannot be called from within a constructor.
A. True
B. False
C.
D.
Answer : A
13. 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
14. 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
15. Constructor returns void type value.
A. True
B. False
C.
D.
Answer : B
16. 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
17. Private members of a structure can be accessed directly from the outside of the structure.
A. True
B. False
C.
D.
Answer : B
18. Reference to an object behaves like a constant pointer.
A. True
B. False
C.
D.
Answer : B
19. this' pointer has to be used while accessing data members in a member function.
A. True
B. False
C.
D.
Answer : A
20. The template function declaration specifies
A. template class
B. a generic class
C. exception
D. identifier
Answer : B
21. In C++, the exception handler is invoked with a-
A. try block
B. throw exception
C. catch function
D. abort()
Answer : B
22. 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
23. By default, members cannot be inherited.
A. True
B. False
C.
D.
Answer : A
24. 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
25. The member of a structure can be directly accessed by
A. ->
B. dot operator
C. ::
D. >>
Answer : B
26. The new operator always returns a void pointer.
A. True
B. False
C.
D.
Answer : A
27. 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
28. In C++, an identifier must be initialized using constant expression.
A. True
B. False
C.
D.
Answer : B
29. Data objects can be initialized when allocating memory using 'new'.
A. True
B. False
C.
D.
Answer : A
30. 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
31. 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
32. 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
33. 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
34. The scope resolution operator is -
A. ::
B. ;
C. <<
D. ->
Answer : A
35. Class is similar to a variable.
A. True
B. False
C.
D.
Answer : B
36. A base class is inherited by
A. derived class
B. inline function
C. constructor
D. none of the above
Answer : A
37. A destructor can have arguments like constructor.
A. True
B. False
C.
D.
Answer : B
38. In C++, the stream base class is
A. iostream
B. iofstream
C. ios
D. stdio
Answer : C
39. 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
40. Protected members cannot be inherited.
A. True
B. False
C.
D.
Answer : B
41. An object is an allocated space in memory.
A. True
B. False
C.
D.
Answer : A
42. Which of the following can legitimately be passed to a function?
A. A constant
B. A variable
C. A structure
D. A header file
Answer : B
43. "[]" Operator is a unary operator.
A. True
B. False
C.
D.
Answer : A
44. We can make function inline by using the keyword 'inline'.
A. True
B. False
C.
D.
Answer : A
45. ios containes a pointer to streambuf.
A. True
B. False
C.
D.
Answer : A
46. In C++, identifiers have to be declared at the beginning of the blocks.
A. True
B. False
C.
D.
Answer : A
47. _______ argument(s) are passed in case of unary overloaded operators.
A. Two
B. One
C. No
D. None of the above
Answer : B
48. 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
49. 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
50. The value of 'this' pointer can be changed.
A. True
B. False
C.
D.
Answer : B

Sharing is caring