Create A 50 MCQs From This Lecture and Answer Wil... - 3
The document contains 50 multiple-choice questions related to software design principles, each followed by the correct answer. Key principles discussed include SOLID principles, DRY, KISS, YAGNI, and Separation of Concerns, which guide developers in creating maintainable, scalable, and efficient systems. The questions cover definitions, implications, and recommendations of these principles in software design.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
20 views7 pages
Create A 50 MCQs From This Lecture and Answer Wil... - 3
The document contains 50 multiple-choice questions related to software design principles, each followed by the correct answer. Key principles discussed include SOLID principles, DRY, KISS, YAGNI, and Separation of Concerns, which guide developers in creating maintainable, scalable, and efficient systems. The questions cover definitions, implications, and recommendations of these principles in software design.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7
Okay, here are 50 multiple-choice questions based on the provided lecture slides, with answers
following each question:
Multiple Choice Questions 1. What are software design principles? ○ A) Programming languages ○ B) Fundamental concepts that guide software design ○ C) Hardware requirements ○ D) Project management techniques Answer: B 2. What do software design principles help developers create? ○ A) Inflexible systems ○ B) Systems that are hard to maintain ○ C) Maintainable, scalable, and efficient systems ○ D) Inefficient and rigid systems Answer: C 3. Which of the following is a key software design principle? ○ A) Follow trends blindly ○ B) SOLID Principles ○ C) Ignore scalability ○ D) Increase complexity Answer: B 4. What does the Single Responsibility Principle (SRP) state? ○ A) A class should have multiple reasons to change ○ B) A class should have only one reason to change ○ C) Classes should not have any responsibility ○ D) All classes should depend on each other Answer: B 5. In an e-commerce system, which principle suggests that an Order class and an Invoice class should be separate? ○ A) Open/Closed Principle (OCP) ○ B) Liskov Substitution Principle (LSP) ○ C) Single Responsibility Principle (SRP) ○ D) Dependency Inversion Principle (DIP) Answer: C 6. What does the Open/Closed Principle (OCP) advocate? ○ A) Modifying existing code for new functionality ○ B) Closing software entities for extension ○ C) Opening software entities for modification ○ D) Adding new functionality without altering existing code Answer: D 7. According to OCP, how should new shape types be added in a Shape class example? ○ A) By modifying the original Shape class ○ B) By altering existing code ○ C) Without modifying the original class ○ D) By avoiding interfaces Answer: C 8. What does the Liskov Substitution Principle (LSP) imply? ○ A) Subtypes cannot be substituted for their base types ○ B) Objects of a subclass should not replace objects of a superclass ○ C) Subtypes must be substitutable for their base types ○ D) Base types should not be replaceable with subtypes Answer: C 9. In the Bird class example, which principle suggests that a Penguin class should not inherit a fly() method? ○ A) Open/Closed Principle (OCP) ○ B) Liskov Substitution Principle (LSP) ○ C) Single Responsibility Principle (SRP) ○ D) Interface Segregation Principle (ISP) Answer: B 10.What does the Interface Segregation Principle (ISP) recommend? ○ A) Clients should depend on interfaces they do not use ○ B) Creating large, monolithic interfaces ○ C) Creating fine-grained interfaces ○ D) Avoiding interfaces altogether Answer: C 11.Instead of a single Machine interface with print(), scan(), and fax() methods, what does ISP suggest? ○ A) Combining all methods into one class ○ B) Using a single monolithic interface ○ C) Creating separate interfaces like Printer, Scanner, and FaxMachine ○ D) Avoiding interface implementation Answer: C 12.What does the Dependency Inversion Principle (DIP) state? ○ A) High-level modules should depend on low-level modules ○ B) Low-level modules should depend on high-level modules ○ C) Both should depend on abstractions ○ D) Abstractions should depend on details Answer: C 13.According to DIP, what should dependency be on? ○ A) Concrete implementations ○ B) Details ○ C) Interfaces ○ D) Low-level modules Answer: C 14.In the NotificationService example, what should it depend on, according to DIP? ○ A) Concrete classes like EmailNotification ○ B) Concrete classes like SMSNotification ○ C) An INotification interface ○ D) Implementation details Answer: C 15.What does the DRY principle stand for? ○ A) Don't Repeat Yourself ○ B) Do Repeat Yourself ○ C) Define Requirements ইয়ourself ○ D) Delete Redundant ইয়ourself Answer: A 16.What does the DRY principle advise developers to do? ○ A) Duplicate code ○ B) Avoid duplicating code ○ C) Implement logging separately ○ D) Over-engineer solutions Answer: B 17.What is the recommendation of the KISS principle? ○ A) Keep It Sophisticated and Smart ○ B) Keep It Simple, Stupid ○ C) Keep It Short and Sweet ○ D) Keep It Structured and Solid Answer: B 18.What does simplicity in design lead to? ○ A) Easier maintenance ○ B) Complex codebase ○ C) Difficult debugging ○ D) Harder understanding Answer: A 19.According to KISS, what should be used instead of over-engineering a complex configuration system? ○ A) Complex XML files ○ B) Simple JSON or YAML files ○ C) Large databases ○ D) Obfuscated code Answer: B 20.What does the YAGNI principle stand for? ○ A) ইয়ou Are Gonna Need It ○ B) ইয়ou Aren't Gonna Need It ○ C) ইয়our Application Generates Nothing Important ○ D) ইয়et Another GUI Navigation Implementation Answer: B 21.What does the YAGNI principle advise against? ○ A) Implementing necessary features ○ B) Over-engineering ○ C) Simple solutions ○ D) Basic data retrieval Answer: B 22.According to YAGNI, what should developers avoid? ○ A) Adding basic features ○ B) Anticipating future requirements that may never materialize ○ C) Implementing current needs ○ D) Using simple designs Answer: B 23.What does the Separation of Concerns principle suggest? ○ A) Mixing different sections of software ○ B) Dividing software into distinct sections ○ C) Addressing all concerns in one section ○ D) Creating monolithic applications Answer: B 24.What does the Separation of Concerns principle make the system? ○ A) Harder to understand ○ B) Easier to maintain ○ C) More complex to modify ○ D) Difficult to debug Answer: B 25.In a web application, what does Separation of Concerns recommend instead of mixing database logic with UI components? ○ A) Using a monolithic architecture ○ B) Separating concerns into MVC architecture ○ C) Combining all logic into one file ○ D) Avoiding modular design Answer: B 26.What does Encapsulation involve? ○ A) Exposing all internal workings ○ B) Creating dependencies between components ○ C) Hiding internal workings from the outside world ○ D) Combining unrelated functionality Answer: C 27.What does Encapsulation promote? ○ A) Increased dependencies ○ B) Information hiding ○ C) Exposing internal data ○ D) Complex interactions Answer: B 28.In a BankAccount class, what should be kept private according to Encapsulation? ○ A) deposit() method ○ B) withdraw() method ○ C) account balance ○ D) class name Answer: C 29.What does High Cohesion, Low Coupling aim for? ○ A) Low cohesion within modules and high coupling between modules ○ B) High cohesion within modules and low coupling between modules ○ C) High cohesion and high coupling ○ D) Low cohesion and low coupling Answer: B 30.What does High Cohesion mean? ○ A) Modules interact through many dependencies ○ B) Elements within a module are unrelated ○ C) Elements within a module are closely related ○ D) Modules have minimal interaction Answer: C 31.What does Low Coupling mean? ○ A) Modules interact with each other through tight dependencies ○ B) Modules interact through well-defined interfaces with minimal dependencies ○ C) Modules have high interdependence ○ D) Modules combine unrelated tasks Answer: B 32.In the CustomerService and OrderService example, how should they interact according to High Cohesion, Low Coupling? ○ A) Through direct database access ○ B) By combining their functionalities ○ C) Through well-defined APIs ○ D) With high interdependence Answer: C 33.What does Composition over Inheritance promote? ○ A) Tight coupling ○ B) Code reuse and maintainability ○ C) Complex inheritance hierarchies ○ D) Reduced flexibility Answer: B 34.Instead of an ElectricCar class inheriting from a Car class, what does Composition over Inheritance suggest? ○ A) Creating a single Car class ○ B) Making Car class inherit from ElectricCar ○ C) Having an ElectricCar class with a Battery component ○ D) Avoiding classes Answer: C 35.What does POLA stand for? ○ A) Principle of Least Action ○ B) Principle of Least Astonishment ○ C) Principle of Large Applications ○ D) Principle of Layered Architecture Answer: B 36.What does the Principle of Least Astonishment (POLA) aim for? ○ A) Surprising behaviors ○ B) Confusing interfaces ○ C) Intuitive and unsurprising design ○ D) Increased errors Answer: C 37.According to POLA, what should a ‘Save’ button in a text editor do? ○ A) Trigger a print action ○ B) Delete the file ○ C) Save the file ○ D) Open a new window Answer: C 38.What do Performance Considerations in design involve? ○ A) Ignoring algorithmic efficiency ○ B) Avoiding data structures ○ C) Considering algorithmic efficiency, data structures, and resource utilization ○ D) Maximizing resource waste Answer: C 39.For quick lookups in a large dataset, what does the lecture suggest using? ○ A) List ○ B) Array ○ C) HashMap ○ D) Stack Answer: C 40.What do Scalability and Flexibility in design mean? ○ A) Designing systems for minimal growth ○ B) Avoiding adaptation to changing requirements ○ C) Designing systems to accommodate growth and adapt to change ○ D) Creating rigid architectures Answer: C 41.How should a cloud-based application be designed to scale, according to the lecture? ○ A) By relying on a single powerful server ○ B) To scale horizontally by adding more servers ○ C) To limit user growth ○ D) With significant architectural changes for growth Answer: B 42.What does Testability in design promote? ○ A) Avoiding automated tests ○ B) Designing code that is easy to test ○ C) Manual testing only ○ D) Complex testing procedures Answer: B 43.What design pattern, mentioned in the lecture, makes unit testing easier by separating business logic from the user interface? ○ A) Singleton ○ B) Factory ○ C) MVC ○ D) Observer Answer: C 44.Which principle encourages abstracting common functionality into reusable components? ○ A) KISS ○ B) DRY ○ C) YAGNI ○ D) SOLID Answer: B 45.What is the primary goal of software design principles? ○ A) To write complex code ○ B) To create maintainable and scalable systems ○ C) To increase development time ○ D) To limit system adaptability Answer: B 46.Which SOLID principle focuses on creating fine-grained interfaces? ○ A) SRP ○ B) OCP ○ C) LSP ○ D) ISP Answer: D 47.What does the DRY principle aim to prevent? ○ A) Code reuse ○ B) Code duplication ○ C) Code abstraction ○ D) Code complexity Answer: B 48.Which principle advises developers to "Do it simple"? ○ A) DRY ○ B) KISS ○ C) YAGNI ○ D) SOLID Answer: B 49.What is the benefit of applying the Separation of Concerns principle? ○ A) It increases system complexity ○ B) It makes the system easier to understand ○ C) It reduces maintainability ○ D) It combines unrelated logic Answer: B 50.What does the Principle of Least Astonishment (POLA) try to minimize? ○ A) Code length ○ B) User and developer confusion ○ C) System performance ○ D) Development costs Answer: B