

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.
451. |
If all the classes used parameterized constructors and no default constructor then, ___________ |
A. | The object of lower level classes can’t be created |
B. | Object of lower level classes must call parent class constructors explicitly |
C. | Object of lower level classes must define all the default constructors |
D. | Only object of first class can be created, which is first parent |
Answer» C. Object of lower level classes must define all the default constructors | |
452. |
How many abstract classes can be used in multilevel inheritance? |
A. | Only 1 |
B. | Only 2 |
C. | At least one less than number of levels |
D. | Can’t be used |
Answer» D. Can’t be used | |
453. |
Can abstract classes be used in multilevel inheritance? |
A. | Yes, always |
B. | Yes, only one abstract class |
C. | No, abstract class doesn’t have constructors |
D. | No, never |
Answer» B. Yes, only one abstract class | |
454. |
All the classes must have all the members declared private to implement multilevel inheritance. |
A. | True |
B. | False |
Answer» C. | |
455. |
In multilevel inheritance one class inherits _______________ |
A. | Only one class |
B. | More than one class |
C. | At least one class |
D. | As many classes as required |
Answer» B. More than one class | |
456. |
What is minimum number of levels for a implementing multilevel inheritance? |
A. | 1 |
B. | 2 |
C. | 3 |
D. | 4 |
Answer» D. 4 | |
457. |
Multilevel inheritance allows _________________ in the program. |
A. | Only 7 levels of inheritance |
B. | At least 7 levels of inheritance |
C. | At most 16 levels of inheritance |
D. | As many levels of inheritance as required |
Answer» E. | |
458. |
If all the classes use private inheritance in multilevel inheritance then ____________ |
A. | It will not be called multilevel inheritance |
B. | Each class can access only non-private members of its parent |
C. | Each subsequent class can access all members of previous level parent classes |
D. | None of the members will be available to any other class |
Answer» C. Each subsequent class can access all members of previous level parent classes | |
459. |
Which Class is having highest degree of abstraction in multilevel inheritance of 5 levels? |
A. | Class at 1st level |
B. | Class 2nd last level |
C. | Class at 5th level |
D. | All with same abstraction |
Answer» B. Class 2nd last level | |
460. |
If there are 3 classes. Class C is derived from class B and B is derived from A, Which class destructor will be called at last if object of C is destroyed. |
A. | A |
B. | B |
C. | C |
D. | All together |
Answer» B. B | |
461. |
If there are 5 classes, E is derived from D, D from C, C from B and B from A. Which class constructor will be called first if the object of E or D is created? |
A. | A |
B. | B |
C. | C |
D. | A and B |
Answer» B. B | |
462. |
Which among the following best defines multilevel inheritance? |
A. | A class derived from another derived class |
B. | Classes being derived from other derived classes |
C. | Continuing single level inheritance |
D. | Class which have more than one parent |
Answer» C. Continuing single level inheritance | |
463. |
If base class contains 2 nested classes, will it be possible to implement single level inheritance? |
A. | Yes, always |
B. | Yes, only if derived class also have nested classes |
C. | No, it will use more than 2 classes which is wrong |
D. | No, never |
Answer» B. Yes, only if derived class also have nested classes | |
464. |
Which constructor will be called first from the classes involved in single inheritance from object of derived class? |
A. | Base class constructor |
B. | Derived class constructor |
C. | Both class constructors at a time |
D. | Runtime error |
Answer» B. Derived class constructor | |
465. |
Single level inheritance will be best for___________ |
A. | Inheriting a class which performs all the calculations |
B. | Inheriting a class which can print all the calculation results |
C. | Inheriting a class which can perform and print all calculations |
D. | Inheriting a class which can perform and print all calculations |
Answer» C. Inheriting a class which can perform and print all calculations | |
466. |
Which language doesn’t support single level inheritance? |
A. | Java |
B. | C++ |
C. | Kotlin |
D. | All languages support it |
Answer» E. | |
467. |
Single level inheritance is safer than _____________ |
A. | Multiple inheritance |
B. | Interfaces |
C. | Implementations |
D. | Extensions |
Answer» B. Interfaces | |
468. |
Which concept will result in derived class with more features (consider maximum 3 classes)? |
A. | Single inheritance |
B. | Multiple inheritance |
C. | Multilevel inheritance |
D. | Hierarchical inheritance |
Answer» C. Multilevel inheritance | |
469. |
Which among the following is false for single level inheritance? |
A. | There can be more than 2 classes in program to implement single inheritance |
B. | There can be exactly 2 classes to implement single inheritance in a program |
C. | There can be more than 2 independent classes involved in single inheritance |
D. | The derived class must implement all the abstract method if single inheritance is used |
Answer» D. The derived class must implement all the abstract method if single inheritance is used | |
470. |
If single level inheritance is used and an abstract class is created with some undefined functions, can its derived class also skip some definitions? |
A. | Yes, always possible |
B. | Yes, possible if only one undefined function |
C. | No, at least 2 undefined functions must be there |
D. | No, the derived class must implement those methods |
Answer» E. | |
471. |
Single level inheritance supports _____________ inheritance. |
A. | Runtime |
B. | Compile time |
C. | Multiple inheritance |
D. | Language independency |
Answer» B. Compile time | |
472. |
If single inheritance is used, program will contain ________________ |
A. | At least 2 classes |
B. | At most 2 classes |
C. | Exactly 2 classes |
D. | At most 4 classes |
Answer» B. At most 2 classes | |
473. |
If class A and class B are derived from class C and class D, then ________________ |
A. | Those are 2 pairs of single inheritance |
B. | That is multilevel inheritance |
C. | Those is enclosing class |
D. | Those are all independent classes |
Answer» B. That is multilevel inheritance | |
474. |
Which among the following defines single level inheritance? |
A. | One base class derives another class |
B. | One derived class inherits from one base class |
C. | One base class inherits from one derived class |
D. | One derived class derives from another derived class |
Answer» C. One base class inherits from one derived class | |
475. |
If multi-level inheritance is used, First class B inherits class A, then C inherits B and so on. Till how many classes can this go on? |
A. | Only till class C |
B. | Only till class J |
C. | Only till class Z |
D. | There is no limit |
Answer» E. | |
476. |
How many classes can be inherited by a single class in java? |
A. | Only 1 |
B. | Only 27 |
C. | Only 255 |
D. | Only 1024 |
Answer» B. Only 27 | |
477. |
How many classes can be inherited by a single class in multiple inheritance (C++)? |
A. | Only 2 |
B. | Only 27 |
C. | Only 1024 |
D. | Any number of classes can be inherited |
Answer» E. | |
478. |
Which type of inheritance cannot involve private inheritance? |
A. | Single level |
B. | Multiple |
C. | Hybrid |
D. | All types can have private inheritance |
Answer» E. | |
479. |
In hierarchical inheritance, all the classes involve some kind of inheritance. (True/ False) |
A. | True |
B. | False |
Answer» C. | |
480. |
If class A has two nested classes B and C. Class D has one nested class E, and have inherited class A. If E inherits B and C, then: |
A. | It shows multiple inheritance |
B. | It shows hierarchical inheritance |
C. | It shows multiple inheritance |
D. | Multiple inheritance among nested classes, and single level for enclosing classes |
Answer» E. | |
481. |
If 6 classes uses single level inheritance with pair classes (3 pairs), which inheritance will this be called? |
A. | Single |
B. | Multiple |
C. | Hierarchical |
D. | Multilevel |
Answer» B. Multiple | |
482. |
Which type of inheritance results in diamond problem? |
A. | Single level |
B. | Hybrid |
C. | Hierarchical |
D. | Multilevel |
Answer» C. Hierarchical | |
483. |
How many types of inheritance can be used at a time in single program? |
A. | Any two types |
B. | Any three types |
C. | Any 4 types |
D. | Any type, any number of times |
Answer» E. | |
484. |
Which among the following best describes multiple inheritance? |
A. | Two classes being parent of any other classes |
B. | Three classes being parent of other classes |
C. | More than one class being parent of other child classes |
D. | More than one class being parent of single child |
Answer» E. | |
485. |
How many types of inheritance are possible in C++? |
A. | 2 |
B. | 3 |
C. | 4 |
D. | 5 |
Answer» E. | |
486. |
How can you make the private members inheritable? |
A. | By making their visibility mode as public only |
B. | By making their visibility mode as protected only |
C. | By making their visibility mode as private in derived class |
D. | It can be done both by making the visibility mode public or protected |
Answer» E. | |
487. |
The private members of the base class are visible in derived class but are not accessible directly. |
A. | True |
B. | False |
Answer» B. False | |
488. |
If a derived class object is created, which constructor is called first? |
A. | Base class constructor |
B. | Derived class constructor |
C. | Depends on how we call the object |
D. | Not possible |
Answer» B. Derived class constructor | |
489. |
While inheriting a class, if no access mode is specified, then which among the following is true? (in C++) |
A. | It gets inherited publicly by default |
B. | It gets inherited protected by default |
C. | It gets inherited privately by default |
D. | It is not possible |
Answer» D. It is not possible | |
490. |
Members which are not intended to be inherited are declared as: |
A. | Public members |
B. | Protected members |
C. | Private members |
D. | Private or Protected members |
Answer» D. Private or Protected members | |
491. |
If a base class is inherited in protected access mode then which among the following is true? |
A. | Public and Protected members of base class becomes protected members of derived class |
B. | Only protected members become protected members of derived class |
C. | Private, Protected and Public all members of base, become private of derived class |
D. | Only private members of base, become private of derived class |
Answer» B. Only protected members become protected members of derived class | |
492. |
Which access type data gets derived as private member in derived class: |
A. | Private |
B. | Public |
C. | Protected |
D. | Protected and Private |
Answer» B. Public | |
493. |
Which type of inheritance leads to diamond problem? |
A. | Single level |
B. | Multi-level |
C. | Multiple |
D. | Hierarchical |
Answer» D. Hierarchical | |
494. |
Which is the correct syntax of inheritance? |
A. | class derived_classname : base_classname{ /*define class body*/ }; |
B. | class base_classname : derived_classname{ /*define class body*/ }; |
C. | class derived_classname : access base_classname{ /*define class body*/ }; |
D. | class base_classname :access derived_classname{ /*define class body*/ }; |
Answer» D. class base_classname :access derived_classname{ /*define class body*/ }; | |
495. |
Which among the following is correct for hierarchical inheritance? |
A. | Two base classes can be used to be derived into one single class |
B. | Two or more classes can be derived into one class |
C. | One base class can be derived into other two derived classes or more |
D. | One base class can be derived into only 2 classes |
Answer» D. One base class can be derived into only 2 classes | |
496. |
Which programming language doesn’t support multiple inheritance? |
A. | C++ and Java |
B. | C and C++ |
C. | Java and SmallTalk |
D. | Java |
Answer» E. | |
497. |
Which among the following is correct for multiple inheritance? |
A. | class student{public: int marks;}s; class stream{int total;}; class topper:public student, public stream{ }; |
B. | class student{int marks;}; class stream{ }; class topper: public student{ }; |
C. | class student{int marks;}; class stream:public student{ }; |
D. | class student{ }; class stream{ }; class topper{ }; |
Answer» B. class student{int marks;}; class stream{ }; class topper: public student{ }; | |
498. |
Which among the following best defines single level inheritance? |
A. | A class inheriting a derived class |
B. | A class inheriting a base class |
C. | A class inheriting a nested class |
D. | A class which gets inherited by 2 classes |
Answer» C. A class inheriting a nested class | |
499. |
How many basic types of inheritance are provided as OOP feature? |
A. | 4 |
B. | 3 |
C. | 2 |
D. | 1 |
Answer» B. 3 | |
500. |
Which among the following best describes the Inheritance? |
A. | Copying the code already written |
B. | Using the code already written once |
C. | Using already defined functions in programming language |
D. | Using the data and functions into derived segment |
Answer» E. | |