

MCQOPTIONS
Saved Bookmarks
This section includes 916 Mcqs, each offering curated multiple-choice questions to sharpen your Technical Programming knowledge and support exam preparation. Choose a topic below to get started.
201. |
Which language among the following doesn’t allow pointers? |
A. | C++ |
B. | Java |
C. | Pascal |
D. | C |
Answer» C. Pascal | |
202. |
Assigning objects takes place while passing the arguments. |
A. | True |
B. | False |
Answer» C. | |
203. |
Assigning reference to an object _________________ |
A. | Will create another copy of the object |
B. | Will create two different copies of the object |
C. | Will not create any other copy of the object |
D. | Will not refer to the object |
Answer» D. Will not refer to the object | |
204. |
We can assign _____________________ |
A. | Value of one reference variable to another |
B. | Value of any object to another |
C. | Value of any type to any object |
D. | Value of non – reference to another reference |
Answer» B. Value of any object to another | |
205. |
How to make more than one object refer to the same object? |
A. | Initialize it to null |
B. | Initialize the object with another at declaration |
C. | Use constructor to create new object |
D. | Assign the address directly |
Answer» C. Use constructor to create new object | |
206. |
If more than one object refer to the same address, any changes made |
A. | Can be made visible to specific objects |
B. | Will be specific to one object only |
C. | From any object will be visible in all |
D. | Doesn’t changes the values of all objects |
Answer» D. Doesn’t changes the values of all objects | |
207. |
Use of assignment operator ____________________ |
A. | Changes its use, when used at declaration and in normal assignment |
B. | Doesn’t changes its use, whatever the syntax might be |
C. | Assignment takes place in declaration and assignment syntax |
D. | Doesn’t work in normal syntax, but only with declaration |
Answer» B. Doesn’t changes its use, whatever the syntax might be | |
208. |
How many objects can be assigned to a single address? |
A. | Only 1 |
B. | At most 7 |
C. | At most 3 |
D. | As many as required |
Answer» E. | |
209. |
In copy constructor definition, if non const values are accepted only ________ |
A. | Only const objects will be accepted |
B. | Only non – const objects are accepted |
C. | Only const members will not get copied |
D. | Compiler generates an error |
Answer» C. Only const members will not get copied | |
210. |
Declaring a copy constructor doesn’t suppresses the compiler generated copy assignment operator. |
A. | True |
B. | False |
Answer» B. False | |
211. |
If programmer doesn’t define any copy assignment operator then ____________________ |
A. | Compiler gives an error |
B. | Program fails at run time |
C. | Compiler gives an implicit definition |
D. | Compiler can’t copy the member values |
Answer» D. Compiler can’t copy the member values | |
212. |
How the argument passed to a function get initialized? |
A. | Assigned using copy constructor at time of passing |
B. | Copied directly |
C. | Uses addresses always |
D. | Doesn’t get initialized |
Answer» B. Copied directly | |
213. |
If an object is created and another object is assigned to it, then ________________ |
A. | Copy constructor is called to copy the values |
B. | Object is copied directly to the object |
C. | Reference to another object is created |
D. | The new object is initialized to null values |
Answer» D. The new object is initialized to null values | |
214. |
When value of an object is assigned to another object, ___________________ |
A. | It becomes invalid statement |
B. | Its values gets copied into another object |
C. | Its values gets address of the existing values |
D. | The compiler doesn’t execute that statement |
Answer» C. Its values gets address of the existing values | |
215. |
Why temporary object is not created in return by reference? |
A. | Because compiler can’t create temporary objects |
B. | Because the temporary object is created within the function |
C. | Because return by reference just make the objects points to values memory location |
D. | Because return by reference just make the object point to null |
Answer» D. Because return by reference just make the object point to null | |
216. |
If an object is being returned by value then __________________________ |
A. | Its member values are made constant |
B. | Its member values have to be copied individually |
C. | Its member values are not used |
D. | Its member values are copied using copy constructor |
Answer» E. | |
217. |
If an object is passed by reference to a function then it must be returned by reference. |
A. | True |
B. | False |
Answer» C. | |
218. |
Can we return an array of objects? |
A. | Yes, always |
B. | Ye, only if objects are having same values |
C. | No, because objects contain many other values |
D. | No, because objects are single entity |
Answer» B. Ye, only if objects are having same values | |
219. |
If object is passed by reference ____________________ |
A. | Temporary object is created |
B. | Temporary object is created inside the function |
C. | Temporary object is created for few seconds |
D. | Temporary object is not created |
Answer» E. | |
220. |
Which error will be produced if a local object is returned by reference outside a function? |
A. | Out of memory error |
B. | Run time error |
C. | Compile time error |
D. | No error |
Answer» D. No error | |
221. |
How many independent objects can be returned at same time from a function? |
A. | 1 |
B. | 2 |
C. | 3 |
D. | 4 |
Answer» B. 2 | |
222. |
If an object is declared inside the function then ____________________ outside the function |
A. | It can be returned by reference |
B. | It can’t be returned by reference |
C. | It can be returned by address |
D. | It can’t be returned at all |
Answer» C. It can be returned by address | |
223. |
Which is the correct syntax for defining a function which passes an object by reference? |
A. | className& functionName ( ) |
B. | className* functionName( ) |
C. | className-> functionName( ) |
D. | &className functionName() |
Answer» B. className* functionName( ) | |
224. |
Which is the correct syntax for returning an object by value? |
A. | void functionName ( ){ } |
B. | object functionName( ) { } |
C. | class object functionName( ) { } |
D. | ClassName functionName ( ){ } |
Answer» E. | |
225. |
Where the temporary objects (created while return by value) are created? |
A. | Outside the function scope |
B. | Within the function |
C. | Inside the main function |
D. | Inside the calling function |
Answer» C. Inside the main function | |
226. |
Whenever an object is returned by value ____________________ |
A. | A temporary object is created |
B. | Temporary object is not created |
C. | Temporary object may or may not be created |
D. | New permanent object is created |
Answer» B. Temporary object is not created | |
227. |
In which of the following way(s) can the object be returned from a function? |
A. | Can only be returned by value |
B. | Can only be returned by reference |
C. | Can be returned either by value or reference |
D. | Can neither be returned by value nor by reference |
Answer» D. Can neither be returned by value nor by reference | |
228. |
Pass by reference and pass by value can’t be done simultaneously in a single function argument list. |
A. | True |
B. | False |
Answer» C. | |
229. |
In which type is new memory location will be allocated? |
A. | Only in pass by reference |
B. | Only in pass by value |
C. | Both in pass by reference and value |
D. | Depends on the code |
Answer» C. Both in pass by reference and value | |
230. |
If the object is not to be passed to any function but the values of the object have to be used then: |
A. | The data members should be passed separately |
B. | The data members and member functions have to be passed separately |
C. | The values should be present in other variables |
D. | The object must be passed |
Answer» B. The data members and member functions have to be passed separately | |
231. |
What exactly is passed when an object is passed by reference? |
A. | The original object name |
B. | The original object class name |
C. | The exact address of the object in memory |
D. | The exact address of data members |
Answer» D. The exact address of data members | |
232. |
Can data members be passed to a function using the object? |
A. | Yes, it can be passed only inside class functions |
B. | Yes, only if the data members are public and are being passed to a function outside the class |
C. | No, can’t be passed outside the class |
D. | No, can’t be done |
Answer» C. No, can’t be passed outside the class | |
233. |
If an object is passed by value, _________________ |
A. | Temporary object is used in the function |
B. | Local object in the function is used |
C. | Only the data member values are used |
D. | The values are accessible from the original object |
Answer» C. Only the data member values are used | |
234. |
What is the type of object that should be specified in argument list? |
A. | Function name |
B. | Object name itself |
C. | Caller function name |
D. | Class name of object |
Answer» E. | |
235. |
Copy constructor definition requires __________________ |
A. | Object to be passed by value |
B. | Object not to be passed to it |
C. | Object to be passed by reference |
D. | Object to be passed with each data member value |
Answer» D. Object to be passed with each data member value | |
236. |
Pass by reference of an object to a function _______________ |
A. | Affects the object in called function only |
B. | Affects the object in prototype only |
C. | Affects the object in caller function |
D. | Affects the object only if mentioned with & symbol with every call |
Answer» D. Affects the object only if mentioned with & symbol with every call | |
237. |
If object is passed by value, ________________ |
A. | Copy constructor is used to copy the values into another object in the function |
B. | Copy constructor is used to copy the values into temporary object |
C. | Reference to the object is used to access the values of the object |
D. | Reference to the object is used to created new object in its place |
Answer» B. Copy constructor is used to copy the values into temporary object | |
238. |
Which symbol should be used to pass the object by reference in C++? |
A. | & |
B. | @ |
C. | $ |
D. | $ or & |
Answer» B. @ | |
239. |
The object _______________ |
A. | Can be passed by reference |
B. | Can be passed by value |
C. | Can be passed by reference or value |
D. | Can be passed with reference |
Answer» D. Can be passed with reference | |
240. |
Passing object to a function _______________ |
A. | Can be done only in one way |
B. | Can be done in more than one ways |
C. | Is not possible |
D. | Is not possible in OOP |
Answer» C. Is not possible | |
241. |
If static data member are made inline, ______________ |
A. | Those should be initialized outside the class |
B. | Those can’t be initialized with the class |
C. | Those can be initialized within the class |
D. | Those can’t be used by class members |
Answer» D. Those can’t be used by class members | |
242. |
The static data member ______________ |
A. | Can be mutable |
B. | Can’t be mutable |
C. | Can’t be integer |
D. | Can’t be characters |
Answer» C. Can’t be integer | |
243. |
We can use the static member functions and static data member __________________ |
A. | Even if class object is not created |
B. | Even if class is not defined |
C. | Even if class doesn’t contain any static member |
D. | Even if class doesn’t have complete definition |
Answer» B. Even if class is not defined | |
244. |
Which among the following can’t be used to access the members in any way? |
A. | Scope resolution |
B. | Arrow operator |
C. | Single colon |
D. | Dot operator |
Answer» D. Dot operator | |
245. |
The keyword static is used _______________ |
A. | With declaration inside class and with definition outside the class |
B. | With declaration inside class and not with definition outside the class |
C. | With declaration and definition wherever done |
D. | With each call to the member function |
Answer» C. With declaration and definition wherever done | |
246. |
Which keyword should be used to declare the static member functions? |
A. | static |
B. | stat |
C. | const |
D. | common |
Answer» B. stat | |
247. |
The static member functions _______________ |
A. | Can’t be declared const |
B. | Can’t be declared volatile |
C. | Can’t be declared const or volatile |
D. | Can’t be declared const, volatile or const volatile |
Answer» E. | |
248. |
The static members are _____________________ |
A. | Created with each new object |
B. | Created twice in a program |
C. | Created as many times a class is used |
D. | Created and initialized only once |
Answer» E. | |
249. |
Which among the following is not applicable for the static member functions? |
A. | Variable pointers |
B. | void pointers |
C. | this pointer |
D. | Function pointers |
Answer» D. Function pointers | |
250. |
Which is correct syntax to access the static member functions with class name? |
A. | className . functionName; |
B. | className -> functionName; |
C. | className : functionName; |
D. | className :: functionName; |
Answer» E. | |