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.
| 351. |
Which operator among the following must be overloaded using the friend function? |
| A. | << operator only |
| B. | >> operator only |
| C. | Both << and >> operators |
| D. | It’s not mandatory to use friend function in any case |
| Answer» D. It’s not mandatory to use friend function in any case | |
| 352. |
All the operators can be overloaded using the member function operator overloading. |
| A. | True |
| B. | False |
| Answer» C. | |
| 353. |
Which operator among the following can be overloaded using both friend function and member function? |
| A. | Assignment operator |
| B. | Subscript |
| C. | Member selection (arrow operator) |
| D. | Modulus operator |
| Answer» E. | |
| 354. |
Which operator among the following can be overloading using only member function? |
| A. | Assignment operator |
| B. | Addition operator |
| C. | Subtraction operator |
| D. | Multiplication and division operator |
| Answer» B. Addition operator | |
| 355. |
Where in the parameter list is the implicit *this is added? |
| A. | Right most parameter |
| B. | Right most parameter |
| C. | Left most parameter |
| D. | Not added to parameter list |
| Answer» D. Not added to parameter list | |
| 356. |
When the friend operator overloading is converted into member operator overloading _______________ |
| A. | Two parameters of friend function remains same parameters in member operator overloading |
| B. | Two parameters of friend function becomes only one parameter of member function |
| C. | Two parameters of friend function are removed while using member function |
| D. | Two parameters of friend function are made 4 in member operator overloading |
| Answer» C. Two parameters of friend function are removed while using member function | |
| 357. |
If left operand member is specified directly in the function definition, which is the correct implicit conversion of that syntax? |
| A. | *this className |
| B. | *this parameterObject |
| C. | *this returnedObject |
| D. | *this object |
| Answer» E. | |
| 358. |
Which object’s members can be called directly while overloading operator function is used (In function definition)? |
| A. | Left operand members |
| B. | Right operand members |
| C. | All operand members |
| D. | None of the members |
| Answer» B. Right operand members | |
| 359. |
Why the left parameter is removed from parameter list? |
| A. | Because it is of no use |
| B. | Because it is never used in definitions |
| C. | Because it becomes parameter pointed by *this |
| D. | Because it can’t be referred by *this pointer |
| Answer» b. | |
| 360. |
What is the syntax to overload an operator? |
| A. | className::operator(parameters) |
| B. | className:operator(parameters) |
| C. | className.operator(paramteres) |
| D. | className->operator(parameters) |
| Answer» B. className:operator(parameters) | |
| 361. |
If a friend overloaded operator have to be changed to member overloaded operator, which operator should be used with the class name? |
| A. | Scope resolution operator |
| B. | Colon |
| C. | Arrow operator |
| D. | Dot operator |
| Answer» B. Colon | |
| 362. |
If the left operand is pointed by *this pointer, what happens to other operands? |
| A. | Other operands are passed as function return type |
| B. | Other operands are passed to compiler implicitly |
| C. | Other operands must be passed using another member function |
| D. | Other operands are passed as function arguments |
| Answer» E. | |
| 363. |
When the operator to be overloaded becomes the left operand member then ______________ |
| A. | The right operand acts as implicit object represented by *this |
| B. | The left operand acts as implicit object represented by *this |
| C. | Either right or left operand acts as implicit object represented by *this |
| D. | *this pointer is not applicable in that member function |
| Answer» C. Either right or left operand acts as implicit object represented by *this | |
| 364. |
Which among the following is mandatory condition for operators overloading? |
| A. | Overloaded operator must be member function of the left operand |
| B. | Overloaded operator must be member function of the right operand |
| C. | Overloaded operator must be member function of either left or right operand |
| D. | Overloaded operator must not be dependent on the operands |
| Answer» B. Overloaded operator must be member function of the right operand | |
| 365. |
Which among the following are valid ways of overloading the operators? |
| A. | Only using friend function |
| B. | Only using member function |
| C. | Either member functions or friend functions can be used |
| D. | Operators can’t be overloaded |
| Answer» D. Operators can’t be overloaded | |
| 366. |
Which keyword is used to define the inline member function? |
| A. | No keyword required |
| B. | inline |
| C. | inlined |
| D. | line |
| Answer» C. inlined | |
| 367. |
Which keyword is used to define the static member functions? |
| A. | static |
| B. | stop |
| C. | open |
| D. | state |
| Answer» B. stop | |
| 368. |
All type of member functions can’t be used inside a single class. |
| A. | True |
| B. | False |
| Answer» C. | |
| 369. |
Member functions _____________________ |
| A. | Must be defined inside class body |
| B. | Can be defined inside class body or outside |
| C. | Must be defined outside the class body |
| D. | Can be defined in another class |
| Answer» D. Can be defined in another class | |
| 370. |
Which keyword is used to make a nonmember function as friend function of a class? |
| A. | friendly |
| B. | new |
| C. | friend |
| D. | connect |
| Answer» D. connect | |
| 371. |
What is the syntax of a const member function? |
| A. | void fun() const {} |
| B. | void fun() constant {} |
| C. | void const fun() {} |
| D. | const void fun(){} |
| Answer» B. void fun() constant {} | |
| 372. |
What are friend member functions (C++)? |
| A. | Member function which can access all the members of a class |
| B. | Member function which can modify any data of a class |
| C. | Member function which doesn’t have access to private members |
| D. | Non-member functions which have access to all the members (including private) of a class |
| Answer» E. | |
| 373. |
Which among the following best describes the inline member functions? |
| A. | Functions defined inside the class only |
| B. | Functions with keyword inline only |
| C. | Functions defined outside the class |
| D. | Functions defined inside the class or with the keyword inline |
| Answer» E. | |
| 374. |
What are const member functions? |
| A. | Functions in which none of the data members can be changed in a program |
| B. | Functions in which only static members can be changed |
| C. | Functions which treat all the data members as constant and doesn’t allow changes |
| D. | Functions which can change only the static members |
| Answer» D. Functions which can change only the static members | |
| 375. |
Correct syntax to access the static member functions from the main() function is: |
| A. | classObject::functionName(); |
| B. | className::functionName(); |
| C. | className:classObject:functionName(); |
| D. | className.classObject:functionName(); |
| Answer» C. className:classObject:functionName(); | |
| 376. |
How can static member function can be accessed directly in main() function? |
| A. | Dot operator |
| B. | Colon |
| C. | Scope resolution operator |
| D. | Arrow operator |
| Answer» D. Arrow operator | |
| 377. |
What are static member functions? |
| A. | Functions which use only static data member but can’t be accessed directly |
| B. | Functions which uses static and other data members |
| C. | Functions which can be access outside the class with the data members |
| D. | Functions using only static data and can be accessed directly in main() function |
| Answer» E. | |
| 378. |
Simple member functions are ______________________ |
| A. | Ones defined simply without any type |
| B. | Ones defined with keyword simple |
| C. | Ones that are implicitly provided |
| D. | Ones which are defined in all the classes |
| Answer» B. Ones defined with keyword simple | |
| 379. |
How many types of member functions are possible in general? |
| A. | 2 |
| B. | 3 |
| C. | 4 |
| D. | 5 |
| Answer» E. | |
| 380. |
The abstract method definition can be made ___________ in derived class. |
| A. | Private |
| B. | Protected |
| C. | Public |
| D. | Private, public, or protected |
| Answer» E. | |
| 381. |
The abstract methods can never be ___________ in a base class. |
| A. | Private |
| B. | Protected |
| C. | Public |
| D. | Default |
| Answer» B. Protected | |
| 382. |
If a class have all the abstract methods the class will be known as __________ |
| A. | Abstract class |
| B. | Anonymous class |
| C. | Base class |
| D. | Derived class |
| Answer» B. Anonymous class | |
| 383. |
Which among the following is correct for abstract methods? |
| A. | It must have different prototype in the derived class |
| B. | It must have same prototype in both base and derived class |
| C. | It must have different signature in derived class |
| D. | It must have same return type only |
| Answer» C. It must have different signature in derived class | |
| 384. |
Static methods can’t be made abstract in java. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 385. |
If a function declared as abstract in base class doesn’t have to be defined in derived class then ____ |
| A. | Derived class must define the function anyhow |
| B. | Derived class should be made abstract class |
| C. | Derived class should not derive from that base class |
| D. | Derived class should not use that function |
| Answer» C. Derived class should not derive from that base class | |
| 386. |
What is the syntax for using abstract method? |
| A. | <access-modifier>abstract<return-type>method_name (parameter) |
| B. | abs<return-type>method name (parameter) |
| C. | <access-modifier>abstract return-type method name (parameter) |
| D. | <access-modifier>abstract <returning> method name (parameter) |
| Answer» B. abs<return-type>method name (parameter) | |
| 387. |
What is this feature of enforcing definitions of abstract function at compile time called? |
| A. | Static polymorphism |
| B. | Polymorphism |
| C. | Dynamic polymorphism |
| D. | Static or dynamic according to need |
| Answer» D. Static or dynamic according to need | |
| 388. |
The abstract function definitions in derived classes is enforced at _________ |
| A. | Runtime |
| B. | Compile time |
| C. | Writing code time |
| D. | Interpreting time |
| Answer» C. Writing code time | |
| 389. |
It is _________________________ to define the abstract functions. |
| A. | Mandatory for all the classes in program |
| B. | Necessary for all the base classes |
| C. | Necessary for all the derived classes |
| D. | Not mandatory for all the derived classes |
| Answer» D. Not mandatory for all the derived classes | |
| 390. |
How are abstract functions different from the abstract functions? |
| A. | Abstract must not be defined in base class whereas virtual function can be defined |
| B. | Either of those must be defined in base class |
| C. | Different according to definition |
| D. | Abstract functions are faster |
| Answer» B. Either of those must be defined in base class | |
| 391. |
Which among the following best defines the abstract methods? |
| A. | Functions declared and defined in base class |
| B. | Functions only declared in base class |
| C. | Function which may or may not be defined in base class |
| D. | Function which must be declared in derived class |
| Answer» C. Function which may or may not be defined in base class | |
| 392. |
If virtual function of base class is redefined in derived class then, _______________________ |
| A. | It must be declared virtual in derived class also |
| B. | It may or may not be declared virtual in derived class |
| C. | It can must not be declared virtual in derived class |
| D. | It must be declared normally in derived class |
| Answer» C. It can must not be declared virtual in derived class | |
| 393. |
It is __________ to redefine the virtual function in derived class? |
| A. | Necessary |
| B. | Not necessary |
| C. | Not acceptable |
| D. | Good practice |
| Answer» C. Not acceptable | |
| 394. |
The virtual functions must be declared and defined in _____________ class and overridden in ___________ class. |
| A. | Base, base |
| B. | Derived, derived |
| C. | Derived, base |
| D. | Base, derived |
| Answer» E. | |
| 395. |
Which among the following is true for virtual functions? |
| A. | Prototype must be different in base and derived class |
| B. | Prototype must be same in base class and derived class |
| C. | Prototype must be given only in base class |
| D. | Prototype must have different signature in base and derived class |
| Answer» C. Prototype must be given only in base class | |
| 396. |
Which is must condition for virtual function to achieve runtime polymorphism? |
| A. | Virtual function must be accessed with direct name |
| B. | Virtual functions must be accessed using base class object |
| C. | Virtual function must be accessed using pointer or reference |
| D. | Virtual function must be accessed using derived class object only |
| Answer» D. Virtual function must be accessed using derived class object only | |
| 397. |
Virtual functions can’t be made friend function of other classes. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 398. |
Virtual functions can never be made _______________ |
| A. | Static function |
| B. | Parameterized function |
| C. | Default argument function |
| D. | Zero parameter function |
| Answer» B. Parameterized function | |
| 399. |
In which access specifier should a virtual function be defined? |
| A. | Private |
| B. | Public |
| C. | Protected |
| D. | Default |
| Answer» C. Protected | |
| 400. |
The resolving of virtual functions is done at ______________ |
| A. | Compile time |
| B. | Interpret time |
| C. | Runtime |
| D. | Writing source code |
| Answer» D. Writing source code | |