Home

C++ Programming MCQ Solved Paper for SBI Clerk

Thursday 9th of March 2023

Sharing is caring

1. A destructor can have arguments like constructor.
A. True
B. False
C.
D.
Answer : B
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. 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
4. 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
5. 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
6. 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
7. Private members of a structure can be accessed directly from the outside of the structure.
A. True
B. False
C.
D.
Answer : B
8. 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
9. 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
10. By default, C++ uses the following method of passing arguments
A. Call-by-Reference
B. Call-by-Value
C. Call-by-Pointer
D. None of the above
Answer : B
11. 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
12. 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
13. ios containes a pointer to streambuf.
A. True
B. False
C.
D.
Answer : A
14. 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
15. main() returns a value of type
A. real
B. char
C. int
D. null
Answer : C
16. 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
17. We can make function inline by using the keyword 'inline'.
A. True
B. False
C.
D.
Answer : A
18. In C++, the exception handler is invoked with a-
A. try block
B. throw exception
C. catch function
D. abort()
Answer : B
19. 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
20. The template function declaration specifies
A. template class
B. a generic class
C. exception
D. identifier
Answer : B
21. cc ___________ option is used only to create object file
A. -a
B. -o
C. -c
D. none of these
Answer : B
22. Data objects can be initialized when allocating memory using 'new'.
A. True
B. False
C.
D.
Answer : A
23. Scope resolution operator has the highest precedence.
A. True
B. False
C.
D.
Answer : A
24. The characteristic that data can be manipulated only through member functions that are part of the class is called
A. Encapsulation
B. Data dependency
C. Inheritance
D. Instantiation
Answer : A
25. Inline functions_____________ call overload.
A. Increase
B. Reduce
C. None of the above are correct
D.
Answer : B
26. 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
27. 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
28. "[]" Operator is a unary operator.
A. True
B. False
C.
D.
Answer : A
29. 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
30. 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
31. The ?: can be used to replace
A. if-else statement
B. wild cards
C. no meaning in C++
D. returns the value
Answer : A
32. The exception is processed using
A. unexpected()
B. perform()
C. catch()
D. try()
Answer : C
33. 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
34. The value of 'this' pointer can be changed.
A. True
B. False
C.
D.
Answer : B
35. 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
36. 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
37. Static data member can be declared as const too.
A. True
B. False
C.
D.
Answer : A
38. Inline function specifier reduces the overheads associated with a normal function call.
A. True
B. False
C.
D.
Answer : A
39. 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
40. 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
41. _____________ operator must have one class object
A. +
B. new
C. all
D. None of these
Answer : B
42. 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
43. We cannot have the address of a constructor.
A. True
B. False
C.
D.
Answer : A
44. 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
45. Static data member occurs in only class scope.
A. True
B. False
C.
D.
Answer : B
46. An object is an allocated space in memory.
A. True
B. False
C.
D.
Answer : A
47. iostream is inheried from istream, ostream and ios class.
A. True
B. False
C.
D.
Answer : B
48. 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
49. Element double Array[7] is which element of the array?
A. sixth
B. seventh
C. eighth
D. impossible to tell
Answer : C
50. 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

Sharing is caring