Home

C++ Programming 1000+ MCQ with answer for RRB Group D

Thursday 9th of March 2023

Sharing is caring

1. Dynamic memory can be allocated by the following declaration
A. new
B. volatile
C. static
D. ==
Answer : A
2. Class is similar to a variable.
A. True
B. False
C.
D.
Answer : B
3. cc ___________ option is used only to create object file
A. -a
B. -o
C. -c
D. none of these
Answer : B
4. :: is known as
A. scope resolution operator
B. global operator
C. Both (a) & (b)
D. None of these
Answer : A
5. 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
6. 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
7. 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
8. 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
9. 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
10. Private members of a structure can be accessed directly from the outside of the structure.
A. True
B. False
C.
D.
Answer : B
11. 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
12. 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
13. The member of a structure can be accessed through a pointer by
A. ->
B. dot operator
C. ::
D. >>
Answer : A
14. Objects get destroyed in the reverse order as they are created.
A. True
B. False
C.
D.
Answer : A
15. Static member functions have file scope.
A. True
B. False
C.
D.
Answer : A
16. iostream is inheried from istream, ostream and ios class.
A. True
B. False
C.
D.
Answer : B
17. A class that contains at least one pure virtual function is called as
A. pure class
B. abstract class
C. base class
D. derived class
Answer : B
18. 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
19. The ?: can be used to replace
A. if-else statement
B. wild cards
C. no meaning in C++
D. returns the value
Answer : A
20. Inline function specifier reduces the overheads associated with a normal function call.
A. True
B. False
C.
D.
Answer : A
21. A function that is called automatically when an object is destroyed is known as
A. instantiation
B. function prototype
C. constructor
D. destructor
Answer : D
22. The following syntax is valid. void inline gram_ panchayat :: show_gram_ panchayat_info().
A. True
B. False
C.
D.
Answer : B
23. ios containes a pointer to streambuf.
A. True
B. False
C.
D.
Answer : A
24. 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
25. 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
26. Static data member occurs in only class scope.
A. True
B. False
C.
D.
Answer : B
27. 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
28. Inline functions_____________ call overload.
A. Increase
B. Reduce
C. None of the above are correct
D.
Answer : B
29. 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
30. 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
31. Member function cannot be called from within a constructor.
A. True
B. False
C.
D.
Answer : A
32. 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
33. 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
34. The value of 'this' pointer can be changed.
A. True
B. False
C.
D.
Answer : B
35. 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
36. An object is an allocated space in memory.
A. True
B. False
C.
D.
Answer : A
37. 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
38. 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
39. 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
40. _____________ operator must have one class object
A. +
B. new
C. all
D. None of these
Answer : B
41. 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
42. 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
43. When you overload an arithmetic assignment operator, the result
A. Goes in the object to the right of the operator
B. Goes in the object to the left of the operator
C. Goes in the object of which the operator is a member
D. Must be returned
Answer : B
44. _______ argument(s) are passed in case of binary overloaded operators.
A. Two
B. One
C. No
D. None of the above
Answer : A
45. 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
46. A constructor cannot be explicitly called.
A. True
B. False
C.
D.
Answer : A
47. 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
48. 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
49. _______ argument(s) are passed in case of unary overloaded operators.
A. Two
B. One
C. No
D. None of the above
Answer : B
50. In C++, an identifier must be initialized using constant expression.
A. True
B. False
C.
D.
Answer : B

Sharing is caring