DVGC22 Analys
When refactoring code, which of the following practices can lead to problems?
Generating a set of unit tests for the existing code
Using the results of a database query directly
Both using the results of a database query directly and refactoring code that has many external interfaces
Refactoring code that has many external interfaces
Which of the following statement is true for refactoring?
Most basic editing environments do not support simple refactoring
It can be applied to any programming language
It changes the functions of the program itself
None of the above
Refactoring must be performed in small chunks or phases?
True
False
Why is it important to focus refactoring efforts toward code files with the highest risk?
Refactored code is more difficult to test
It is a time-consuming process and requires a lot of work to create value
Refactoring increase the cost of adding new features
It is an unrefined approach to modernization
Why it is important for software professionals to familiarize themselves with the concept of application refactoring?
To extend the lives of business-critical apps that are outdated
Because old software vendors go out of business or are acquired
Because older apps were not designed for mobile compatibility
All of the above
What is the most common cause of refactoring problems?
A lack of proper tools
The fact that it doesn't work
A lack of expertise
The code itself
Bad code increases technical debt and decreases productivity
True
False
You should aim for clean and readable code that just compiles and passes the tests.
True
False
Quick and dirty solutions accumulate debt while refactoring code reduce it.
True
False
Which of the following is not a design pattern category
Creational patterns
Behavioral patterns
Structural patters
Temperamental patterns.
In the context of Creational design patterns, which of the following statement is correct.
These design patterns provide a way to create objects while hiding the creation logic, rather than instantiating objects directly using new operator.
These design patterns are specifically concerned with communication between objects
These design patterns concern class and object composition. Concept of inheritance is used to compose interfaces and define ways to compose objects to obtain new functionalities.
None of the above.
Which design pattern best represent in the following structure and example?
Interpreter Design Pattern
Mediator Design Pattern
Iterator Design Pattern
Command Design Pattern
What is refactoring?
Improving the internal structure of the code without changing its external behaviour.
To restructure the system during the addition of new features to make a new test pass.
Improving the external interface of the system without changing its internal behaviour.
Implementing as many design patterns as possible.
What is Model-View-Controller (MVC)?
An agile design procedure.
An architectural pattern.
A Scrum procedure.
An eXtreme Programming practise.
What is meant by technical debt?
It is the dept developers build up when they buy technical tools before it is approved by their manager.
It represents the cost incurred when the deterioration of a software systems internal structure, that normally occurs as new features are added or old ones changed, is allowed to remain in the system.
It is a dept that is drawn from a developers salary when he produces a solution with a technical quality that is below the state of the art industry standard.
It represents the debt a development team develops as they try to keep the program well structured, since that work leads to a delayed delivery of new functions.
You want to minimize development cost by reusing methods? Which design pattern would you choose?
Free Pattern
No Pattern
Delegation pattern
Singleton Pattern
Immutable Pattern
Adapter Pattern
Which pattern prevents one from creating more than one instance of a variable?
Singleton
Observer
Factory Method
None of the mentioned
In the following statement, which one is true for facade pattern?
Facade pattern is a broker pattern that eases interaction between a client and a subsystem of suppliers by providing a simpler interface to the sub-system
Sub-systems may contain many classes with complex interfaces and relationships, but often clients only need basic services that can be supplied through a simple interface
The broker class, called a façade, provides basic, simplified services to clients by taking upon itself the job of dealing with a complex sub-system
All of the mentioned
The Mediator pattern has the following drawback:
It may also increase collaborator cohesion
Forcing collaborator interaction through the mediator may compromise performance
None of the mentioned
All of the mentioned
Select the a true statement for proxy pattern:
Has exactly the same interface as the real object
Delegates messages that it cannot handle to the real object
Handles routine or illegitimate messages without accessing the real objects
All of the mentioned
Which of the following class can have only one instance?
Singleton Class
Adaptor Class
Proxy Class
Factory Class
In the following example, which design pattern serves as an operation to be performed on the elements of an object structure without changing the classes on which it operates. An American tourist reached Stockholm. The tourist calls the taxi company to dispatches a cab for him. The company dispatched a taxi. The tourist enters the taxi. Now the tourist is no longer in control of his or her own transportation. However, the taxi driver is in control. The following figure graphically illustrates this example.
Visitor Design Pattern
Recreational Design Pattern
Alternative 4
Guest Design Pattern
Which of the following is a commonly used refactoring technique?
Extract Method
Rename Variable
Delete Code
Add Comments
Change Function Signature
What is the main goal of using design patterns in software development?
To provide proven solutions to common design problems
To increase the complexity of the code
To make the code less maintainable
To slow down the development process
Which design pattern is used to separate the presentation layer from the business logic in an application?
Model-View-Controller (MVC)
Observer
Singleton
Factory Method
What is the purpose of technical debt in software development?
To represent the extra work that needs to be done in the future due to choosing an easy but suboptimal solution now
To reduce the overall development cost
To improve code quality
To speed up the development process
Which design pattern is used to encapsulate the creation of objects and provide a way to create different types of objects based on a common interface?
Factory Method
Observer
Singleton
Adapter
Which design pattern is used to define a one-to-many dependency between objects, so that when one object changes state, all its dependents are notified and updated automatically?
Observer
Factory Method
Singleton
Facade
What is the main advantage of using the Singleton design pattern?
Ensures that only one instance of a class is created and provides a global point of access to it
Increases code complexity
Allows for easy creation of multiple instances of a class
Improves code maintainability
What is the purpose of the Adapter design pattern?
To convert the interface of a class into another interface that clients expect
To encapsulate the creation of objects
To define a one-to-many dependency between objects
To separate the presentation layer from the business logic
What is the purpose of refactoring in software development?
To improve code quality and maintainability
To introduce bugs into the code
To increase development time
To make the code more complex
Which of the following is an example of a design pattern?
Singleton
If-else statement
For loop
Switch case
Observer
Which of the following is a code smell that indicates the need for refactoring?
Long method
Duplicate code
Optimized code
Short variable names
Proper indentation
What is the purpose of the Factory design pattern?
To create objects without specifying their exact class
To encapsulate object creation logic
To establish one-to-many dependencies between objects
To separate presentation layer from business logic
Which of the following is an example of a structural design pattern?
Adapter
Singleton
Observer
Strategy
Decorator
What is the purpose of the Observer design pattern?
To establish a one-to-many dependency between objects
To create objects without specifying their exact class
To separate presentation layer from business logic
To encapsulate object creation logic
{"name":"DVGC22 Analys", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"When refactoring code, which of the following practices can lead to problems?, Which of the following statement is true for refactoring?, Refactoring must be performed in small chunks or phases?","img":"https://www.quiz-maker.com/3012/CDN/95-4632718/fr-ga.png?sz=1200"}