Home

C++ Programming 1000+ MCQ with answer for RRB JE

Thursday 9th of March 2023

Sharing is caring

1. 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
2. Organizing data with methods that operate on the data and creating a new data type is called encapsulation.
A. True
B. False
C.
D.
Answer : A
3. Inline function specifier reduces the overheads associated with a normal function call.
A. True
B. False
C.
D.
Answer : A
4. 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
5. _____________ operator must have one class object
A. +
B. new
C. all
D. None of these
Answer : B
6. 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
7. 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
8. 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
9. A constructor cannot be explicitly called.
A. True
B. False
C.
D.
Answer : A
10. The members of a class by default are private.
A. True
B. False
C.
D.
Answer : A
11. Static data member occurs in only class scope.
A. True
B. False
C.
D.
Answer : B
12. main() returns a value of type
A. real
B. char
C. int
D. null
Answer : C
13. The value of 'this' pointer can be changed.
A. True
B. False
C.
D.
Answer : B
14. 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
15. Reference to an object behaves like a constant pointer.
A. True
B. False
C.
D.
Answer : B
16. 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
17. 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
18. A destructor can have a return type.
A. True
B. False
C.
D.
Answer : B
19. "[]" Operator is a unary operator.
A. True
B. False
C.
D.
Answer : A
20. In C++, the exception handler is invoked with a-
A. try block
B. throw exception
C. catch function
D. abort()
Answer : B
21. 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
22. We can make function inline by using the keyword 'inline'.
A. True
B. False
C.
D.
Answer : A
23. 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
24. The declaration int **var1; shows that
A. var1 can not be accessed
B. var1 is a pointer to a pointer of type int
C. var1 is a protected data type of integer
D. this type declaration shows an error
Answer : B
25. Which of the following is not a component of file system
A. Access method
B. Auxiliary storage management
C. Free integrity mechanism
D. None of the above
Answer : C
26. 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
27. The exception is processed using
A. unexpected()
B. perform()
C. catch()
D. try()
Answer : C
28. cc ___________ option is used only to create object file
A. -a
B. -o
C. -c
D. none of these
Answer : B
29. When accessing a structure member, the identifier to the left of the dot operator is the name of
A. Structure member
B. Structure tag
C. Structure variable
D. The keyword struct.
Answer : C
30. 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
31. Inline functions_____________ call overload.
A. Increase
B. Reduce
C. None of the above are correct
D.
Answer : B
32. 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
33. We cannot have the address of a constructor.
A. True
B. False
C.
D.
Answer : A
34. 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
35. The scope resolution operator is -
A. ::
B. ;
C. <<
D. ->
Answer : A
36. 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
37. 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
38. The ?: can be used to replace
A. if-else statement
B. wild cards
C. no meaning in C++
D. returns the value
Answer : A
39. 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
40. 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
41. Data objects can be initialized when allocating memory using 'new'.
A. True
B. False
C.
D.
Answer : A
42. A base class is inherited by
A. derived class
B. inline function
C. constructor
D. none of the above
Answer : A
43. By default, members cannot be inherited.
A. True
B. False
C.
D.
Answer : A
44. 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
45. ios containes a pointer to streambuf.
A. True
B. False
C.
D.
Answer : A
46. In C++, the stream base class is
A. iostream
B. iofstream
C. ios
D. stdio
Answer : C
47. 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
48. Member function cannot be called from within a constructor.
A. True
B. False
C.
D.
Answer : A
49. 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
50. Protected members cannot be inherited.
A. True
B. False
C.
D.
Answer : B

Sharing is caring