Home

C++ Programming 1000+ MCQ with answer for SSC Scientific Assistant

Thursday 9th of March 2023

Sharing is caring

1. 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
2. Inline function specifier reduces the overheads associated with a normal function call.
A. True
B. False
C.
D.
Answer : A
3. The members of a class by default are private.
A. True
B. False
C.
D.
Answer : A
4. 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
5. 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
6. 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
7. 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
8. 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
9. ios containes a pointer to streambuf.
A. True
B. False
C.
D.
Answer : A
10. In C++, the stream base class is
A. iostream
B. iofstream
C. ios
D. stdio
Answer : C
11. 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
12. The value of 'this' pointer can be changed.
A. True
B. False
C.
D.
Answer : B
13. 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
14. Private members of a structure can be accessed directly from the outside of the structure.
A. True
B. False
C.
D.
Answer : B
15. 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
16. Constructor returns void type value.
A. True
B. False
C.
D.
Answer : B
17. The template function declaration specifies
A. template class
B. a generic class
C. exception
D. identifier
Answer : B
18. 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
19. 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
20. In C++, identifiers have to be declared at the beginning of the blocks.
A. True
B. False
C.
D.
Answer : A
21. Dynamic memory can be allocated by the following declaration
A. new
B. volatile
C. static
D. ==
Answer : A
22. Class is similar to a variable.
A. True
B. False
C.
D.
Answer : B
23. 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
24. Static data member occurs in only class scope.
A. True
B. False
C.
D.
Answer : B
25. We cannot have the address of a constructor.
A. True
B. False
C.
D.
Answer : A
26. 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
27. Sharing of common information are achieved by the concept of
A. Virtual copying
B. Inheritance
C. Encapsulation
D. None of these
Answer : B
28. Scope resolution operator has the highest precedence.
A. True
B. False
C.
D.
Answer : A
29. 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
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. iostream is inheried from istream, ostream and ios class.
A. True
B. False
C.
D.
Answer : B
32. 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
33. 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
34. Objects get destroyed in the reverse order as they are created.
A. True
B. False
C.
D.
Answer : A
35. 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
36. 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
37. cc ___________ option is used only to create object file
A. -a
B. -o
C. -c
D. none of these
Answer : B
38. 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
39. Inline functions_____________ call overload.
A. Increase
B. Reduce
C. None of the above are correct
D.
Answer : B
40. 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
41. A destructor can have arguments like constructor.
A. True
B. False
C.
D.
Answer : B
42. :: is known as
A. scope resolution operator
B. global operator
C. Both (a) & (b)
D. None of these
Answer : A
43. The exception is processed using
A. unexpected()
B. perform()
C. catch()
D. try()
Answer : C
44. 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
45. A constructor cannot be explicitly called.
A. True
B. False
C.
D.
Answer : A
46. The ?: can be used to replace
A. if-else statement
B. wild cards
C. no meaning in C++
D. returns the value
Answer : A
47. An object is an allocated space in memory.
A. True
B. False
C.
D.
Answer : A
48. Static member functions have file scope.
A. True
B. False
C.
D.
Answer : A
49. 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
50. The following syntax is valid. void inline gram_ panchayat :: show_gram_ panchayat_info().
A. True
B. False
C.
D.
Answer : B

Sharing is caring