Object Oriented Programming MCQs

Page No. 44

Which is the correct syntax of inheritance?


aclass derived_classname : base_classname{ /*define class body*/ };

✖


b class base_classname : derived_classname{ /*define class body*/ };

✖


cclass derived_classname : access base_classname{ /*define class body*/ };

✓


dclass base_classname :access derived_classname{ /*define class body*/ };

✖



Which among the following is correct for a hierarchical inheritance?


aTwo base classes can be used to be derived into one single class

✖


bTwo or more classes can be derived into one class

✖


cOne base class can be derived into other two derived classes or more

✓


dOne base class can be derived into only 2 classes

✖



Which programming language doesn’t support multiple inheritance?


aC++ and Java

✖


bC and C++

✖


c Java and SmallTalk

✖


dJava

✓


View Answer Java

Which among the following is correct for multiple inheritance?


aclass student{public: int marks;}s; class stream{int total;}; class topper:public student, public stream{ };

✓


bclass student{int marks;}; class stream{ }; class topper: public student{ };

✖


c class student{int marks;}; class stream:public student{ };

✖


dclass student{ }; class stream{ }; class topper{ };

✖



Which among the following best defines single level inheritance?


aA class inheriting a derived class

✖


bA class inheriting a base class

✓


cA class inheriting a nested class

✖


d A class which gets inherited by 2 classes

✖



How many basic types of inheritance are provided as OOP feature?


a4

✓


b 3

✖


c2

✖


d1

✖


View Answer 4

Which among the following best describes the Inheritance?


aCopying the code already written

✖


b Using the code already written once

✖


cUsing already defined functions in programming language

✖


d Using the data and functions into derived segment

✓



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

✖


cOnly till class Z

✖


dThere is no limit

✓


View Answer There is no limit

How many classes can be inherited by a single class in java?


aOnly 1

✓


bOnly 27

✖


cOnly 255

✖


dOnly 1024

✖


View Answer Only 1

How many classes can be inherited by a single class in multiple inheritance (C++)?


aOnly 2

✖


bOnly 27

✖


c Only 1024

✖


dAny number of classes can be inherited

✓



Goto Page No.

Page 44 of 93

Alphabetical MCQs Categories
—

Here below You find all kind of categories of MCQs in alphabetical order.


"Comprehensive Collection of MCQs: Alphabetically Organized by Subject"
—

"Discover an extensive collection of multiple-choice questions (MCQs) neatly categorized by subject from A to Z. This resource is designed for anyone eager to explore various topics in a straightforward and organized manner. Whether you're a student preparing for exams, an educator seeking supplementary materials, or simply curious about different subjects, this compilation offers a convenient way to learn and assess your knowledge. With questions arranged alphabetically, navigation is effortless, allowing you to delve into subjects of interest at your own pace. Engage, learn, and expand your understanding with this accessible and comprehensive repository of MCQs!"


BolPakistan

bolpakistan.com.pk includes Job Mcqs and Pak Mcqs is the Top Largest Mcqs Forum in World, in which you can read Mcqs of All Subjects, PPSC test preparation, FPSC, NTS and PPSC PAST PAPERS, PPSC PAST MCQS. A Collection of Repeated MCQs for JOBs seekers.

Copyright © 2024, Designed & Developed by BolPakistan