Home

C++ Programming MCQ Solved Paper for SSC JHT

Thursday 9th of March 2023

Sharing is caring

1. 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
2. A destructor can have a return type.
A. True
B. False
C.
D.
Answer : B
3. _____________ operator must have one class object
A. +
B. new
C. all
D. None of these
Answer : B
4. Constructor returns void type value.
A. True
B. False
C.
D.
Answer : B
5. Class is similar to a variable.
A. True
B. False
C.
D.
Answer : B
6. main() returns a value of type
A. real
B. char
C. int
D. null
Answer : C
7. 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
8. 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
9. The ?: can be used to replace
A. if-else statement
B. wild cards
C. no meaning in C++
D. returns the value
Answer : A
10. cc ___________ option is used only to create object file
A. -a
B. -o
C. -c
D. none of these
Answer : B
11. 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
12. Class members are _______________ by default
A. Private
B. protected
C. public
D. None of the above are correct
Answer : A
13. 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
14. 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
15. 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
16. 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
17. In C++, the exception handler is invoked with a-
A. try block
B. throw exception
C. catch function
D. abort()
Answer : B
18. 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
19. 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
20. In C++, the stream base class is
A. iostream
B. iofstream
C. ios
D. stdio
Answer : C
21. 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
22. 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
23. _______ argument(s) are passed in case of unary overloaded operators.
A. Two
B. One
C. No
D. None of the above
Answer : B
24. ios containes a pointer to streambuf.
A. True
B. False
C.
D.
Answer : A
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. 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
27. 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
28. Objects get destroyed in the reverse order as they are created.
A. True
B. False
C.
D.
Answer : A
29. Static data member can be declared as const too.
A. True
B. False
C.
D.
Answer : A
30. We cannot have the address of a constructor.
A. True
B. False
C.
D.
Answer : A
31. The member of a structure can be directly accessed by
A. ->
B. dot operator
C. ::
D. >>
Answer : B
32. 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
33. 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
34. The value of 'this' pointer can be changed.
A. True
B. False
C.
D.
Answer : B
35. 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
36. The new operator always returns a void pointer.
A. True
B. False
C.
D.
Answer : A
37. 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
38. 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
39. "[]" Operator is a unary operator.
A. True
B. False
C.
D.
Answer : A
40. 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
41. 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
42. :: is known as
A. scope resolution operator
B. global operator
C. Both (a) & (b)
D. None of these
Answer : A
43. 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
44. Member function cannot be called from within a constructor.
A. True
B. False
C.
D.
Answer : A
45. 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
46. Protected members cannot be inherited.
A. True
B. False
C.
D.
Answer : B
47. An object is an allocated space in memory.
A. True
B. False
C.
D.
Answer : A
48. Static data member occurs in only class scope.
A. True
B. False
C.
D.
Answer : B
49. 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
50. Dynamic memory can be allocated by the following declaration
A. new
B. volatile
C. static
D. ==
Answer : A

Sharing is caring