set-2
51. Which of the following statements is correct?
Structure elements can be initialized at the time of declaration
Structure members cannot be initialized at the time of declaration
Only integer members of a structure can be initialized at the time of declaration
None of the Above
52. User-defined data types are also called:
Aggregate
Derived
Secondary
All of the Above
53. Functions used to read or write a file in Text Mode:
fprintf(), fscanf()
fread(), fwrite()
fprintf(), fscanf()
read(), write()
54. Correct syntax for opening a file:
FILE *fopen(const char *filename, const char *mode);
FILE *fopen(const char filename, const char mode);
FILE *open(const *filename, const char *mode);
All of the Above
55. What is the function of the mode ‘w+’?
Write and Open for both reading and writing
Open for both reading and writing
Open for writing
Open for both reading and appending in binary mode
56. What is the function of the mode ‘a+’?
Write and Open for both reading and writing
Open for both reading and writing
Open for reading and appending
Open for both reading and appending in binary mode
57. If the mode includes 'b' after the initial letter, what does it indicate?
Text file
Binary file
Big file
None of the Above
58. What does tmpfile() return when it could not create the file?
Stream
NULL
Both Stream and NULL
No result
59. fwrite() can be used only with files that are opened in binary mode:
True
False
Depends on the Situation
All of the Above
60. What are the functions that help to randomly access the file?
fseek()
ftell()
rewind()
All of the Above
61. Data stored in a file can be accessed in:
Sequential and Random
Semi-Sequential and Random
Random only
All of the Above
62. The causes of function overloading are:
Type Conversion
Function with Default Arguments
Function with pass by reference
All of the Above
63. Which of the following is true?
Existing operators can only be overloaded, but new operators cannot be overloaded
The overloaded operator contains at least one operand of the user-defined data type
We cannot use a friend function to overload certain operators
All of the Above
64. Which of the following operators cannot be overloaded?
Scope operator (::) and Sizeof
Member selector(.) and member pointer selector(*)
Ternary operator(?:)
All of the Above
65. Which of the following can be overloaded?
Methods
Constructors
Indexed Properties
All of the Above
66. The function whose definition can be substituted at a place where its function call is made is:
Inline Function
Offline Function
Friend Function
Normal Function
67. How many ways are there to invoke a function in C++?
1
3
2
4
68. At what time does the inline function get expanded?
Compile time
Run time
At the end
Depends on the program
69. In a Function Prototype, where should default parameters appear?
Leftmost side
Rightmost side
In the middle
Anywhere
70. Which one of the following is correct?
Only one parameter of a function can be a default parameter
A minimum of one parameter of a function must be a default parameter
All the parameters of a function can be default parameters
No parameter of a function can be default
71. Execution of the program starts from:
Main
Void
User Defined
Loop
72. In the program, if user and default values are given, the program will take:
Default Value
User Value
NULL Value
Own Value
73. The default return type of a function is:
INT
FLOAT
CHAR
VOID
74. Which of the following is correct?
An object is a runtime entity and created at runtime
An object is an entity that has state and behavior
An object is an instance of a class
All of the Above
75. Which of the following entities can be connected by the dot operator?
A class object and a member of that class
A class object and a class
A class member and a class object
All of the Above
76. Which of the following is also known as an instance of a class?
Member Functions
Class
Object
Member Variables
77. How many objects can be created from an abstract class?
0
1
2
3
78. We can overload:
Operator
Function
Both A & B
Object
79. How many types of access specifiers are there?
2
3
4
5
80. In a single class, which of the following can be used together?
Private Only
Public Only
Protected Only
All
81. Which of the following can restrict class members from being inherited?
Private Only
Public Only
Protected Only
All
82. Which access specifier is used for data members of a class?
Private
Default
Protected
Public
83. Which access specifier should be used for member functions of a class?
Private
Default
Protected
Public
84. In which access specifier can all the parent class members be inherited and accessed from outside the class?
Private
Default
Protected
Public
85. Which access specifier should be used in a class where the instances can’t be created?
Private default constructor
All private constructors
Public
Protected
hich of the following is the scope resolution operator?
::
:::
&
&&
88. Which of the following is the address operator?
@
&
#
%
89. To become a pure object-oriented programming language, which features must be supported?
Encapsulation
Inheritance
Polymorphism
All of the Above
90. The scope resolution operator is used to:
Overload a function in inheritance
Override a function in inheritance
Both of the Above
None of the Above
91. The scope resolution operator is used for:
To specify a particular class
Provides a conceptual framework
Addition
All of the Above
92. Which class allows declaring only one object of it?
Abstract Class
Singleton class
Friend class
All of the Above
93. Which of the following is a member of a class?
Static function
Constant function
Virtual function
All of the Above
94. The other name used for functions inside a class is:
Own Functions
Member Functions
Inside Functions
None of the Above
95. Generally, how many types of member functions are there in C++?
2
3
4
5
96. In the main function, how can a static member function be called?
Using the Dot Operator
Using the Arrow Operator
Using the Dot or Arrow Operator
Using the Dot, Arrow, or using the 'scope resolution operator with class name'
97. Which of the following is correct?
If no constructor is explicitly declared, the compiler automatically creates a default constructor with no data members (variables) or initialization
A constructor is used in classes to initialize data members of the class to avoid errors/segmentation faults.
A copy constructor is a constructor to initialize an object with the values of another object
All of the Above
98. A constructor is used to:
Modify the data whenever required
Destroy an object
Initialize the data members of an object when it is created
None of the Above
99. What will happen if we forget to define a constructor inside a class?
Error Occurs
Segmentation faults
The compiler provides a default constructor
Destructor called
100. How many types of constructors exist in C++?
2
3
4
5
Last updated