Quiz Week 4
Quiz Week 4
Quiz Week 4
A. Polymorphism allows multiple methods with the same name in different classes.
B. Polymorphism is dependent on referencing context.
C. Overloading and overriding are mechanisms of polymorphism.
D. Polymorphism hinders code organization.
30. What is the process of decomposing a problem into a set of modules to reduce
overall complexity called?
A) Modularization B) Hierarchy C) Aggregation D) Generalization
31. Which principle represents the relationship where a “Rose is a flower”?
A) Inheritance (IS-A) B) Aggregation (HAS-A) C) Generalization D) Encapsulation
32. What is the purpose of function overloading?
A) To create unrelated methods with the same name
B) To allow multiple methods with the same name but different parameters
C) To enhance code reusability
D) To improve performance
33. What does the term “Compile Time Overloading” refer to?
A) The process of resolving function overloading at compile time
B) The dynamic binding of overloaded methods
C) The use of polymorphism
D) The optimization of method calls
34. Which design principle promotes code reusability by allowing a class to inherit
attributes and methods from another class?
A) Encapsulation B) Abstraction C) Inheritance D) Polymorphism
35. Can objects of abstract classes be instantiated? A) Yes B) No
36. What does the process of “Folding Link Attributes into Classes” aim to achieve?
A) Reducing the number of classes in a system
B) Improving encapsulation
C) Enhancing code readability
D) Simplifying the design
37. Which principle ensures that a subclass can be used interchangeably with its
superclass?
A) Liskov Substitution Principle (LSP)
B) Interface Segregation Principle (ISP)
C) Dependency Inversion Principle (DIP)
D) Open-Closed Principle (OCP)
38. What is the term for wrapping data and code into a single unit?
A) Abstraction B) Encapsulation C) Polymorphism D) Inheritance
39. In Java, when a method in a subclass overrides a method in the superclass, what
happens to static variables in the superclass?
A) Static variables in the superclass are not affected by method overriding.
B) Static variables in the superclass are overridden by the corresponding variable values in the
subclass.
C) Static variables in the superclass cannot be overridden.
D) Static variables in the superclass can only be overridden using the super keyword.
40. Which of the following is true ?
A. A class can inherit from many different classes by using the extends
B. A class can inherit from many other interfaces by using the extends
C. An interface can inherit from multiple interfaces by using the extends
D. All statements are false