Mcqs cs304
Mcqs cs304
A) Redundancy
B) Complexity
C) Reuse
D) Specialization
A) Association
B) Aggregation
C) Generalization
D) Composition
A) Generalization
B) Inheritance
C) Overriding
D) Subtyping
A) Overloading
B) Extension
C) Redundancy
D) None of the above
12. What kind of relationship is typically required between base and derived classes in
generalization?
A) “Uses A” relationship
B) “Contains A” relationship
C) “Is A” relationship
D) “Has A” relationship
What is the purpose of adding a new class to an existing model with sub-typing and
specialization?
o a) To replace the base class entirely
o b) To reuse some of the base class's state and behavior
o c) To limit the functionality of the base class
o d) To remove all previous class relationships
Which term describes a class that has all the characteristics of a base class, plus
additional characteristics of its own?
o a) Interface
o b) Subclass
o c) Prototype
o d) Encapsulation
In sub-typing, what happens if the new class does not add any unique behavior to the
base class?
o a) It becomes identical to the base class
o b) It fails to compile
o c) It does not function as a derived class
o d) It loses inheritance properties
What is the main advantage of inheriting a new class from an existing class in object-
oriented programming?
o a) Reducing the complexity by creating multiple unrelated classes
o b) Allowing the new class to be completely different from existing ones
o c) Reusing code and adding specialization where needed
o d) Increasing code redundancy
In sub-typing, which principle ensures that objects of a derived class can be used in
place of a base class?
o a) Abstraction Principle
o b) Liskov Substitution Principle
o c) Encapsulation Principle
o d) Polymorphism Principle
If a derived class is expected to maintain the behavior of the base class, which of the
following should it NOT do?
o a) Override methods to change behavior
o b) Add additional methods and properties
o c) Replace the base class’s functionality entirely
o d) Use the inherited base class methods as they are
Which keyword is typically used in object-oriented programming languages to derive
a new class from a base class?
o a) extends
o b) inherits
o c) derive
o d) override
3. When we need to add a class that is behaviorally incompatible with its base
class, we use:
A) Generalization
B) Specialization
C) Inheritance
D) Encapsulation
A) Deriving a new class that is fully compatible with the base class.
B) Adding a class that restricts or changes the behavior of the base class.
C) Extending a base class to add new functionality.
D) Looking at the class hierarchy from top to bottom.
A) Adding a class "Adult" with age restriction to the "Person" class hierarchy.
B) Creating a generic "Vehicle" class for all types of vehicles.
C) Defining a "Person" class with generalized behavior.
D) Using subtyping to allow different "Vehicle" subclasses.
A) Different perspectives, one top to bottom and the other bottom to top.
B) The same perspective, always top to bottom.
C) Opposite perspectives, one right to left and the other left to right.
D) The same perspective, always bottom to top.
9. Which concept would you use if you need to create a class with unique
behaviors not found in the base class?
A) Generalization
B) Abstraction
C) Specialization
D) Aggregation
10. In the example of adding an "Adult" class, the restriction applied is based on:
1. Which term describes the situation where a derived class provides its own
implementation of a method defined in the base class?
A) Inheritance
B) Overloading
C) Overriding
D) Encapsulation
A) Multiple Inheritance
B) Single Inheritance
C) Interface Inheritance
D) Implementation Inheritance
A) Restriction
B) Specialization
C) Extension
D) Abstraction
A) Extension
B) Encapsulation
C) Restriction
D) Polymorphism
A. To be instantiated directly
B. To define specific functionality only
C. To be inherited by other classes
D. To hold data without any methods
A. Concrete implementations
B. Specific instances only
C. Generalized or abstract concepts
D. Specific hardware functions
A. A specific instance
B. A generalized concept
C. A collection of data without methods
D. Only static methods
10. What happens if a class inherits from an abstract class without implementing
all its abstract methods?
What is the purpose of identifying objects with common attributes when designing
an object model?
o A) To create more objects
o B) To simplify the model by grouping shared characteristics in abstract classes
o C) To eliminate concrete classes
o D) To ensure every object is unique
Which of the following best describes a concrete class?
o A) A class that implements an abstract concept
o B) A class that provides a general template for other classes
o C) A class created for real-world entities and instantiates objects in a program
o D) A class that cannot instantiate objects directly
In a well-designed object model, where are concrete classes generally located in the class
hierarchy?
A) The model must also have concrete classes derived from the abstract class.
B) The model cannot contain any concrete classes.
C) The abstract class will not be part of any hierarchy.
D) The object model must not include any other abstract classes.
What is the purpose of having a concrete class in a class hierarchy with an abstract
class?
If there is no concrete class derived from an abstract class in an object model, what can
be concluded?
A) The abstract class is redundant.
B) The object model is correctly structured.
C) The abstract class can exist independently without issues.
D) The model is functioning normally.
Why is it necessary to have concrete classes derived from an abstract class in an object
model?