You are on page 1of 124

GRILE CTS FINAL

 
GRILE CTS
1. The term "zombie code" refers to:
a. Source code that contains many TODO comments
b) Legacy code
c. Source code containing commented pieces of code
d. The source code used
 
2. One way to avoid frequent updates (new versions) for the developed application is:
a. Moving code constants to the database
b. Writing short methods
c. Using enumerations to the detriment of strings
d. Establishing fixed data to which updates are launched
 
3. Design by contract is mentioned by the following principle:
a Liskov Substitution
b) Interface segregation
c) Single responsibility
d) Open closed
 
4. The letter “I” in the SOLID principle comes from:
a) Iskov Substitution
b) Investment Dependency
c Interface Dependency
d Interface Segregation
 
5. The Hungarion Notation system refers to:
a. Writing class names with capital letters
b. Using the date type in the variable name
c. Using underscore in variable names
d. Using visibility in naming attributes
 
6. Copying and pasting a piece of code (Copy / Paste) leads to the violation of the following principle:
a YAGNI
b) SOLID
c) KISS
d. DRY
 
7. The following code sequence violates the principle:
 
Class Processing {
Public void showUsers () {
//}.}
Public void processingDate () {
//…}
Pulib void savesInDb Constants () {
// ..}
};
Interface segregation
b) Liskov substitution
c) Open-closed
d) Single responsibility
 
8. The following code sequence refers to:
 
Class View extends… {
Public View (DataService _dataService, LoginService _loginService) {
_dataService = super.dataService;
_loginService = super.loginService;
}
};
Liskov substitution
b) Interface segregation
c) KISS
d) Dependency inversion
 
9. The following hierarchy of classes applies the principle:
 
Resizable Interface {
// ..}
Class Large screen implements Resizable {
// ..}
Class ScreenMic implements Scalable {
// ..}
a. KISS
b) Interface segregation
c) Single responsibility
d) Design by contract
 
 
 
 
10. The following code sequence violates the principle:

 
a. KISS
b) YAGNI
c. DRY
d) SOLID
 
11. Which of the following Git commands is used to copy changes to the Repository on the server on the
work machine
a. $ git commit
b. $ git pull
c. $ git push
d. $ git add
 
12. Which of the following Git commands is used to create a local copy of the project on the Main Repo
a. $ gitinit
b. $ git clone
c. $ git pull
d. $ git add
e. $ git push
 
13. Which of the following Git commands is used to save changes in a work session
a. $ git branch
b. $ git commit
c. $ git init
d. $ git status
e. $ git pull
 
14. Which of the following Git commands is used to pass to the branch named Project_CTS
a. $ git branch
b. $ git goes project_CTS
c. $ git checkout –b project_CTS
d. $ git checkout project_CTS
 
15. Which of the following Git commands determines the current status of the project
a. $ git init
b. $ git log
c. $ git add
d. $ git status
 
16. The following scenario is considered:
 
“ACME Inc. develop a software solution for a restaurant, you have the waiter to be able to take orders
directly from the mobile phone. The orders are taken from the customer and they are created on the
spot, being automatically assigned the specialized kitchen on that dish, the ingredients used and other
special requirements of the customer. These details are provided by the application, without the need
for the intervention of the waiter who only selects the required dish. The orders are sent to the chefs at
the end of the order for the respective table, and will be executed according to the degree of load of
each chef. "
What pattern offers a solution to this problem?
Command
b) Chain of Responsibility
c) Memento
d) State
 
17. Which of the following concepts is not a mandatory component used in defining a design pattern:
a. The advantages and disadvantages offered by the pattern
b. The problem for which the pattern offers a solution
c. The name of the pattern
d. Implementing the pattern in java
e. The solution offered by the pattern described by diagrams or pseudo-code
 
18. A design pattern represents:
a. A solution to a common problem in poo
b. An algorithm used in poo
c. A data structure used in poo
d. A scheme for a particular type of class
 
19. Which of the following GoG design patterns is of the Behavioral type:
a. Decorator
b) Strategy
c. Builder
d. Singleton
 
20. What GoF pattern must be implemented if you want to implement a solution that allows the choice
at run-time of the agglomeration / function necessary to process a data set. The solution must allow the
modification of the function library but not of the class that manages the data.
a.Wrapper
b) Facade
c. Decorator
d) Strategy
 
21. Which combination represents the correct types of design patterns?
Creational, Behavioral, Structural
b. Creations, Mediators, Adapters
c. Creations, Consumers, Composites
d. Mediators, Structural, Creative
 
22. What pattern allows to extend the functionality of an object, dynamically, to run-time?
a. Facade
b) Adapter
c Composite
d. Decorator
 
23. Memento is a design pattern of type:
a. Mediator
b) Behavioral
c. It is not a design pattern
d. Creational
e. Adapter
f. Structural
 
24. You are trying to add to your Solution a class written in another project to serve different clients. All
other classes have the same interface, but the added class has a completely different interface from
what customers expect . However, it contains all the necessary functionalities. What kind of refactoring
is needed to make this class right in your system, with minimal effort?
a. The proxy pattern applies
b. The builder pattern is applied
c. Apply the adapter patter
d. A new class is defined that implements the expected interface and is copied by copy & paste from
those class in this
e. The façade pattern is applied
 
25. If you want to implement a solution in which all customers using class A have access to the same
type A instance, which GoF pattern will be used:
a. No pattern is needed because the solution is implemented by marking class A as final
b. Singleton is implemented for class A.
c. There is NO need for a pattern because the Solution implements by defining class A as abstract
d. A reminder for class A is implemented
 
26. Choose the incorrect statement about TDD:
a. The steps in TDD are: Write and run tests, Correct method, Refactor
b. If the test generates fails, the test is corrected
c. It is based on the repetition of a simple development cycle
d. TDD describes the concept of Test Driven Development
 
27. There is no principle of Correct boundary conditions specific to the analysis of the data used in Unit
Testing:
a. Value has the type required by the variable type
b. The code refers to external components that are not directly controlled
c. The value has the correct format
d. The value is between the accepted limits (maximum and minimum)
e. The set of values must be ordered or not
f. The value exists
 
28. Consider the following UniTest. What is displayed after its execution ?
 
a.Before Test1 Test2 After
b Before Test1 After Test2 After
c Before Test1 After Before Test2 After
d Before Test1 Before Test2 After
 
29. Choose the correct statement regarding Unit Testing
a. A test unit is a sequence of code written by a programmer to evaluate a class or method
b. It takes place in the development phase and is a tool for programmers
c. All listed signatures are correct
d. A test unit evaluates how a method works in a well-defined context
e. Simple and fast method of testing the source code by programmers
 
30. Consider the following UnitTest. What is displayed after its execution ?

a.Before Test1 Before Test2 After


b.Before Test1 Test2 After
c Before Test1 After Before Test2 After
d Before Test1 After Test2 After
 
31. Which of the following statements about Git is not true:
a. There is no central control authority - everyone has the same rights
b. It is a distributed version control system
c. All users work on development machines offline without permanently connecting the Repository
d. It is a centralized version control system
e. All users have access to the change history
 
32. The Hollywood principle ("Don't call us, we'll call you") inspired the following SOLID principle:
Single responsibility
b) Interface segregation
c) Liskov substitution
d) Dependency inversion
 
33. Choose the statement that is not a feature of Unit Testing
a. It takes place in the development phase and is a tool for programmers
b. A test unit is a sequence of code written by a programmer to evaluate a class or method
c. Simple and fast method of testing the source code by programmers
d. All the statements listed are correct
e. A test unit evaluates how a method works in a well-defined context
 
34. A class of the “OtherOperations” type that contains operations that were not grouped in the class
violates:
Interface segregation
b) Open closed
c) Single responsibility
d) Liskov substitution
 
35. The YAGNI principle refers to:
a. Creating constructors with parameters in all classes where there is a constructor without parameters
b. A priori writing of all classes, attributes and methods that may be necessary
c. A priori writing only the interfaces that will be needed
d. Writing all the classes, attributes and methods that are absolutely necessary
 
36. If you want to implement a solution in which complex objects are built through a mechanism
independent of the process of effective realization of objects and the client does not know the internal
details of the object, the most appropriate GoF pattern is:
a. Singleton
b) Adapter
c. Builder
d. Decorator
e. Factory
 
37. Which of the following Git commands shows all commits that have been made:
a. $ git log
b. $ git init
c. $ git status
d. $ git add
 
38. What design pattern is used to model the behavior at the onClick event for a Button element?
a) Observer
b) Chain of responsibility
c. States
d) Visitor
 
GRIDS - 100% CORRECT
 
Choose the untrue statement about the Decorator design pattern:
Choose an option:
a. multiple decorations can be made by continuous inheritance
b . cannot modify or add functionality to objects at runtime
c. is used to change the functionality of an object at runtime
d. is used to add new functionality to an object at runtime
Feedback
The correct answer is: it cannot modify or add functionality to objects at runtime
 
 
Choose the phrase that suggests using the Decorator design pattern:
Choose an option:
a. family of objects
b. new functionalities
c) single court
d. optional attributes
Feedback
The correct answer is: new features
 
 
What is the difference between Decorator and Strategy.
Choose an option:
a. Decorator can change behavior, and Strategy can change the whole class.
b. The decorator can change the whole class, and Strategy changes the behavior.
c. Decorator can only change the methods of a class, and Strategy changes the whole class.
d. Decorator can modify the attributes of a class, and Strategy modifies the methods in which we use
them.
Feedback
The correct answer is: Decorator can change the whole class, and Strategy can change behavior.
 
 
Decorator is a design pattern:
Choose an option:
a. creational
b. behavioral
c. structural
d. functional
Feedback
The correct answer is: structural
 
 
Decorator pattern design:
Choose an option:
a. It is used to change the functionality of an object at runtime.
b. All the above variants.
c. Multiple decorations can be made by continuous inheritance.
d. It is also used to add new functionality to an object at runtime.
Feedback
The correct answer is: All of the above.
 
What is the advantage of creating a facade for frameworks?
Choose an option:
a. We do not need to know all the classes, methods and attributes in that framework
b. It is the only design pattern where multiple inheritance is possible
c. The number of methods within the classes is considerably reduced
Feedback
The correct answer is: We do not need to know all the classes, methods and attributes in that
framework
 
 
What does Facade entail?
Choose an option:
a. Make a face that ADA frameworks and be usable without requiring knowledge of all classes.
b. All answers are correct.
c. The Facade class includes methods that use methods from the framework classes.
d. Facade class hides complexity through its calls.
Feedback
The correct answer is: All answers are correct.
 
 
The Facade design pattern is used:
Choose an option:
a. It is used whenever it is necessary to work with several frameworks and it is not desired to modify the
existing code.
b. All the above variants
c. For all available frameworks.
d. Because it makes it easier to work with very complex frameworks.
Feedback
The correct answer is: Because it makes it easier to work with very complex frameworks.
 
 
It's true about the Facade design pattern:
Choose an option:
a. implements new functionalities at runtime
b. helps build a family of objects
c. hides the complexity of the frameworks
d. is used to avoid high consumption of resources
Feedback
The correct answer is: hide the complexity of the frameworks
 
 
 
 
Facade is a design pattern:
Choose an option:
a. structural
b. functional
c) behavioral
d. creational
Feedback
The correct answer is: structural
 
Adapter is a design pattern:
Choose an option:
a. functional
b. creational
c. structural
d. behavioral
Feedback
The correct answer is: structural
 
 
Choose the statement that is NOT true about the Adapter:
Choose an option:
a. is used when it is necessary to work with different frameworks, without modifying the existing code
b. the object adapter is a shape of it
c. the class adapter is a form of it
d. brings new functionalities
Feedback
The correct answer is: it brings new functionalities
 
 
Choose the phrase that suggests using the Adapter design pattern:
Choose an option:
a. the use of classes from different frameworks, which do not have a common interface
b. avoiding high consumption of resources
c. the existence of a family of objects
d. implementation of new functionalities at the time of running
Feedback
The correct answer is: use classes from different frameworks that do not have a common interface
 
 
Which of the following is an important feature of the adapter?
Choose an option:
a. The adapter adds functionality so that in class we no longer need functionality.
b. No variant is correct.
c. The adapter adds the functionality used in the classes to be able to stop using those classes.
d . The adapter does not add functionality because it is made by existing classes .
Feedback
The correct answer is: The adapter does not add functionality because it is made by existing classes.
 
 
Which of the following is the structure of an Adapter?
Choose an option:
Target - Adapter - Target
b. Adapt - Target - Adapter
c. Target - Adapter - Adaptee
Feedback
The correct answer is: Target - Adapter - Adaptee
 
 
What are the 2 types of Adapter:
Choose an option:
a. attribute adapter and functionality adapter
b. class adapter and attribute adapter
c. object adapter and functionality adapter
d. class adapter and object adapter
Feedback
The correct answer is: class adapter and object adapter
 
 
How many types of adapters are there:
Choose an option:
a. None of the above
b.2
c.4
d.3
Feedback
The correct answer is: 2
 
 
Choose the design pattern that helps create clones for objects whose construction would require high
resource consumption:
Choose an option:
a) Prototype
b) Abstract Factory
c. Builder
d. Factory
Feedback
The correct answer is: Prototype
 
 
Choose the phrase that suggests using the Prototype design pattern:
Choose an option:
a. the existence of a family of objects
b. implementation of new functionalities
c. optional attributes of an object
d . avoiding high resource consumption
Feedback
The correct answer is: avoid high consumption of resources
 
 
Prototype is of the type:
Choose an option:
Behavioral;
b) Structural;
c. None of the above.
d) Creational;
Feedback
The correct answer is: Creational;
 
 
Prototype is a design pattern:
Choose an option:
a. functional
b) structural
c. creational
d. behavioral
Feedback
The correct answer is: creational
 
 
Prototype is used for
Choose an option:
a. Structured creation of complex objects;
b. Creating a single instance;
c . Cloning instances of an existing prototype;
d. Creating objects in a certain context.
Feedback
The correct answer is: Cloning instances of an existing prototype;
 
A. The interface (which can also be the abstract class), the concrete classes, the class that creates the
objects;
Choose an option:
a. A concrete class and an abstract class;
b. All variants;
c. An interface and an abstract class;
Feedback
The correct answer is: An interface and an abstract class;
 
 
Choose the correct statement about Factory:
Choose an option:
a. Pattern for creating a single instance
b. Pattern for extending an object in a transparent way
c. Describe methods that can be applied on an inhomogeneous structure
d. Pattern that defines a method for creating objects from the same family
Feedback
The correct answer is: Pattern that defines a method for creating objects from the same family
 
 
Choose the design pattern that is not used when you want to create a family of objects:
Choose an option:
a) Abstract Factory
b. Builder
c Factory Method
d. Factory
Feedback
The correct answer is: Builder
 
 
Choose the phrase that indicates the use of the Factory pattern design:
Choose an option:
a. single instance
b. new functionalities
c) optional attributes
d. family of objects
Feedback
The correct answer is: family of objects
 
 
What is the correct statement about Factory Method?
Choose an option:
a . Similar to Simple Factory, only it no longer uses enum
b. It is used to set only the required attributes
c. It is necessary to use a switch
d. Use an enum
Feedback
The correct answer is: Similar to Simple Factory, only it no longer uses enum
 
 
What Factory pattern is based on composition?
Choose an option:
a. all Factory type patterns
b) Simple Factory
c) Abstract Factory
d) Factory Method
Feedback
The correct answer is: Abstract Factory
 
 
 
The Factory design pattern is used for:
Choose an option:
a. The existence of a family in an application
b. All variants.
c. It is easy to implement;
d. Creating GUI views;
Feedback
The correct answer is: All options.
 
 
Factory is a design pattern:
Choose an option:
a. functional
b. behavioral
c. creational
d. structural
Feedback
The correct answer is: creational
 
 
In which case is the Factory NOT used?
Choose an option:
a. All variants
b. The existence of a family of objects in an application
c. DocumentBuilder in Android
d. Creating GUI views
Feedback
The correct answer is: DocumentBuilder in Android
 
 
It is not a component for Simple Factory:
Choose an option:
a. A public method that gives access to a single instance
b. A class that encapsulates the process of creating objects
c. A common interface for created objects
d. The concrete types of classes that implement the interface
Feedback
The correct answer is: A public method that gives access to a single court
 
 
Factory type patterns:
Choose an option:
a. Promote loose coopling and are based on the Dependency Inversion Principle
b. They are difficult to implement
c. They are of the structural type
d. They are used to clone new instances of a prototype
Feedback
The correct answer is: Promote loose coopling and are based on the Dependency Inversion Principle
 
 
Disadvantages for Factory Method:
Choose an option:
a. New objects belonging to the same family can be generated
b. Builders are private, classes cannot be extended
c. Implement the Dependency Inversion principle
d. Different types of objects are managed as a unit through a common interface
Feedback
The correct answer is: Builders are private, classes cannot be extended
 
 
The phrase according to which the Factory design pattern is recognized:
Choose an option:
a. None of the above.
b) Both variants;
c. Chaining of objects;
d. Family of objects, or objects with the same family;
Feedback
The correct answer is: Family of objects, or objects with the same family;
 
A Complex objects, by specifying certain properties;
Choose an option:
a. None of the above
b. Simple objects without the need to specify properties ;
c. All objects.
Feedback
The correct answer is: Simple objects without the need to specify properties;
 
 
Choose the correct statement about Builder:
Choose an option:
a. It is a structural pattern
b. Pattern for the structured creation of complex objects through a mechanism independent of the
process of making objects
c. Pattern for cloning new instances of an existing prototype
d. Save and restore the state of an object
Feedback
The correct answer is: Pattern for the structured creation of complex objects through a mechanism
independent of the process of making objects
 
 
Choose the wrong statement about Builder:
Choose an option:
a. The client builds complex objects, without knowing the internal details of the object
b. The object construction process can be used to define different objects in the same family
c. Objects are managed through a common interface
d. Provides a single access point, globally visible, to a single instance
Feedback
The correct answer is: Provide a single access point, globally visible, to a single instance
 
 
Choose the design pattern according to the situations when an object has a series of obligatory
attributes, and others optional
Choose an option:
a) Prototype
b) Adapter
c. Factory
d. Builder
Feedback
The correct answer is: Builder
 
 
Builder is a design pattern:
Choose an option:
a. structural
b. functional
c. creational
d. behavioral
Feedback
The correct answer is: creational
 
 
What statement about Builder is FALSE?
Choose an option:
a. It is used to create objects with many attributes, some of which are optional and others mandatory
b. Helps to build objects
c. It is used to create several objects in the same family
d. It is a creational design pattern
Feedback
The correct answer is: It is used to create multiple objects in the same family
 
 
Which component is NOT used in the design structure of the Builder pattern?
Choose an option:
a. The concrete class for which the Builder is to be created
b) Factory Interface
c. The interface that defines the build method
d. The class that implements the interface that defines the build method
Feedback
The correct answer is: Factory interface
 
 
The components of the Builder are:
Choose an option:
a . Abstract interface (AbstractBuilder), abstract class and a concrete class.
b. Class to define a framework, simplified interface;
c) Existing class, interface
d. None of the above.
Feedback
The correct answer is: AbstractBuilder, abstract class and a concrete class.
 
 
How can the Builder design pattern be implemented?
Choose an option:
a. The complex object is created in the Builder class constructor
b. The complex object is created in the build () method
c. All the above variants
d. Using an Inner class
Feedback
The correct answer is: All of the above
 
 
Design Builder pattern is used when desired:
Choose an option:
a. building a class family
b. building complex objects with many attributes
c. merging two classes
d. the construction of a single instance of an object
Feedback
The correct answer is: building complex objects with many attributes
 
 
Not part of the Builder pattern components:
Choose an option:
a. A private constructor (callable only in class)
b. The abstract class that defines the complex object that is constructed
c. The concrete class that builds the parts and based on them, the final object
d. The abstract interface that defines the methods by which parts of the concrete object are constructed
Feedback
The correct answer is: A private builder (callable only in class)
 
 
 
Represents an advantage of the Builder pattern:
Choose an option:
a. Centralized management of a resource through a single court
b. Does not allow duplication of instances
c. Flexibility of the object creation algorithm, because the client chooses which parts to create
d. New objects belonging to the same family can be generated
Feedback
The correct answer is: Flexibility of the object creation algorithm, because the client chooses which parts
to create
 
 
Represents a disadvantage of the Builder pattern:
Choose an option:
a. High level of complexity
b. It can become a bottleneck that affects the performance of the application
c. When creating objects, attributes can be omitted
d. Increase the number of wrapper classes
Feedback
The correct answer is: When creating objects, attributes can be omitted
 
 
1. What type is the Singleton pattern design?
Choose an option:
a. single instance
b) structural
c. creational
d. behavioral
Feedback
The correct answer is: creational
 
 
3. Which of the following actions is not related to the correct implementation for Singleton?
Choose an option:
a. declaring a static public method that provides access to the static singleton type court
b. the declaration of a public builder
c. declaring a static volatile instance
d. synchronization of the static method
Feedback
The correct answer is: declare a public builder
 
 
 
4. Which of the following actions is not a type of implementation for singleton?
Choose an option:
a. lazy initialization
b . component base
c) inner static helper class
d. thread safe
Feedback
The correct answer is: base component
 
 
1. Select the component that the classes represent in the structure of a design pattern.
Choose an option:
a. behavior
b. correlations
c. structure
d. participants
Feedback
The correct answer is: participants
 
 
1.Which of the following design patterns is not structural?
Choose an option:
a) chain of responsibility
b) adapter
c. bridge
d. composite
Feedback
The correct answer is: chain of responsibility
 
 
 
2. Which of the following is not an advantage of design patterns?
Choose an option:
a. allow easier understanding of source code and refactoring
b. helps to communicate between programmers
c. represent solutions used and tested by the community
d . analysis time is long
Feedback
The correct answer is: the analysis time is long
 
 
2. It is not a creational pattern design:
Choose an option:
a) Prototype
b) Adapter
c. Builder
d. Singleton
Feedback
The correct answer is: Adapter
 
 
3. Which of the following is not a component of a design pattern?
Choose an option:
to structure
b. implementation
c. name
d . refactoring
Feedback
The correct answer is: refactoring
 
 
 
3. It is not a structural design pattern:
Choose an option:
a. Proxy
b. Decorator
c) Template
d) Facade
Feedback
The correct answer is: Template
 
 
4. Which of the following steps is the first to use a design pattern?
Choose an option:
a. identifying the problem
b. deisgn pattern mapping - problem
c. implementation of methods
d. identification of participants
Feedback
The correct answer is: identify the problem
 
 
 
4. It is a structural design pattern:
Choose an option:
a) Abstract Factory
b) State
c. Proxy
d) Command
Feedback
The correct answer is: Proxy
 
 
5. This is a behavioral design pattern:
Choose an option:
a . member
b) Composite
c Flyweight
d) Prototype
Feedback
The correct answer is: States
 
 
6. It is a creational design pattern:
Choose an option:
a. State
b) Facade
c) Template
d) Prototype
Feedback
The correct answer is: Prototype
 
 
What is NOT an advantage of design patterns?
Choose an option:
a. Helps to communicate between programmers
b. There are solutions used and tested by the community
c. Leads to avoid rewriting the source code
d . The time spent on architectural analysis is short
Feedback
The correct answer is: The time spent on architectural analysis is short
 
Which of the annotations are used in TestSuite?
Choose an option:
a. @SuiteClasses
b. @RunWith
c. @Category
d. All the above variants
Feedback
The correct answer is: All of the above
 
 
 
Which of the following statements is correct regarding JUnit3?
Choose an option:
a. Use @Tag - for custom suites
b. The constructor with a parameter in the TestCase class is not implemented
c. The created TestCase must extend the TestCase class
d. No correct answer
Feedback
The correct answer is: The created TestCase must extend the TestCase class
 
 
Which of the following annotations for the structure of a JUni5 test is correct?
Choose an option:
a. @BeforeClass
b. @BeforeAll
c. @Before
d. @After
Feedback
The correct answer is: @BeforeAll
 
 
Which of the following is true?
Choose an option:
a. None of the above
b. All the above variants
c. TestSuite is composed of several TestCases
d. The specific annotations are @RunWith, @SuiteClasses, @Category
Feedback
The correct answer is: All of the above
Which of the following is used to group TestCases and run them together?
Choose an option:
TestResult
b) TestCaseCollection
c) Assert
d . TestSuite
Feedback
The correct answer is: TestSuite
 
 
Which of the following is a collection of test cases?
Choose an option:
a) Assert
b) TestCase
c) TestResult
d . TestSuite
Feedback
The correct answer is: TestSuite
 
 
What is the difference between Dummies methods and Stub methods?
Choose an option:
a. Dummies methods also handle the number of calls made to the methods of these objects.
b. There are no differences
c. Methods from a Stub are used when we do not need to call the methods in that object.
d. Stub methods will return conserved / hardcoded responses
Feedback
The correct answer is: Methods from a Stub will return conserved / hardcoded responses
 
 
How do you define a test suite?
Choose an option:
a. May contain any type of test, visual or non-functional
b . All the above options
c. "validation suite" means a collection of test cases that are intended to be used to test a software
program
d. A generic term for certain cases in which a production object is replaced for testing purposes
Feedback
The correct answer is: All of the above
 
 
Before what methods should the @BeforeAll annotation in the current class be executed?
Choose an option:
a. @TestTemplate and @Test
b. All the above variants
c. @ParameterizedTest and @TestFactory
d. @Test, @RepeatedTest, @ParameterizedTest and @TestFactory
Feedback
The correct answer is: @Test, @RepeatedTest, @ParameterizedTest and @TestFactory
 
 
When is a Mock testing used?
Choose an option:
a. Whenever the user wants
b. All the above variants
c. When an object does not simulate the behavior of a real object
 
 
When can we use a dummy object?
Choose an option:
a. When we need hardcoded answers
b. When we do not have to call the methods in that object
c. When we need a method that returns nothing
d. When we want to test the correctness of a method
Feedback
The correct answer is: When we do not have to call the methods in that object
 
 
Which of the statements is correct?
Choose an option:
a. The methods of a Dummy object do nothing or return 0 or null
b. Dummy object is an object which comply with the interface t of
c. All the above variants
d. When we have to use the real object, we actually use a dummy object
Feedback
The correct answer is: All of the above
 
 
Which of the statements is correct?
Choose an option:
a. When we have to use the real object, we actually use a dummy object
b. All the above variants
Question 5
 
 
 
 
Which of the following statements is true?
Choose an option:
a. Spy counts the results obtained
b. When we want to test the correctness of a method we use Fake objects
c. Stub is an object used when we want the external references not to influence the tested method
d. Unlike Dummy, Stub objects use hardcoded method responses
Feedback
The correct answer is: Unlike Dummy, Stub objects use hardcoded method responses
 
 
What is the difference between Dummies methods and Stub methods?
Choose an option:
a. Dummies methods also manage the number of calls made to the methods of these objects.
b. There are no differences
c. Methods from a Stub will return conserved / hardcoded responses
Feedback
The correct answer is: Methods from a Stub will return stored / hardcoded responses
 
 
What is the difference between a Stub object and a Spy object?
Choose an option:
a. Stub is an object that behaves similarly to a real one, but has a simplified version, and Spy manages
the number of calls
b. Spy is an object that respects the interface but the methods do nothing, unlike Stub where the
methods return hardcoded responses
c. Spy is a Stub or Fake that manages and counts the number of calls
Feedback
The correct answer is: Spy is a Stub or Fake that manages and counts the number of calls
 
 
What is a Dummy Object?
Choose an option:
a . an object that respects the interface, but the methods do nothing or return 0 or null
b. an object that has no methods
c. an object that manages the number of calls made
d. an object whose methods return hardcoded responses
Feedback
The correct answer is: an object that respects the interface, but the methods do nothing or return 0 or
null
 
 
What is a Fake Object?
Choose an option:
a. an object whose methods return hardcoded responses
b. a simplified real object
c. an object that behaves like a real one, but has a simplified version, for which we can determine
which values to return the methods
d. an object used when we want the external references not to influence the tested method
Feedback
The correct answer is: an object that behaves like a real one, but has a simplified version, for which we
can determine what values to return the methods
 
 
 
What is a double test?
Choose an option:
a. All of the above
b. Testing twice by the same method
 
 
The difference between the Stub and the Fake object is:
Choose an option:
a. methods corresponding to a Fake object do nothing or return 0 / NULL
b . methods corresponding to a Stub object return hardcoded values
c. Stub also counts the number of calls made for methods
d. Fake also counts the number of calls made for methods
Feedback
The correct answer is: methods corresponding to a Stub object return hardcoded values
 
 
It is a test duplicate that returns hardcoded values:
Choose an option:
a. None of the above
b) Dummy
c. Mock
d. Stub
Feedback
The correct answer is: Stub
 
 
Represents a Stub or Fake that counts the number of calls made for the methods of these objects:
Choose an option:
a.Dummy
b) FakeCounter
c. Mock
d . Spy
Feedback
The correct answer is: Spy
 
 
Select the correct version of the test lining concept:
Choose an option:
a. is an object that brings a much more complex implementation of the initial methods, covering all
testing cases
b. None of the above
c. represents an object that fits the interface of the required collaborator, but cannot be replaced
d. represents an object that fits the interface of the required collaborator and can be replaced
Feedback
The correct answer is: it represents an object that fits the interface of the required collaborator and can
be replaced
There are objects used when you do not want to call the related methods, because they do nothing or
return 0 / NULL:
Choose an option:
a.Dummy
b. Mock
c) Stub
d) Fake
Feedback
The correct answer is: Dummy
 
 
The "Isolated" principle helps:
Choose an option:
a. When a test fails, the developer must debug to identify what is wrong and where the problem is.
b. If a test fails, the developer must trust that the method needs to be improved but not consider the
test to be wrong.
c. When a test fails, the developer does not have to debug to identify what is wrong and where the
problem is.
d. If the tests pass, the developer should have high confidence that the code is correct and error-free.
Feedback
The correct answer is: When a test is to ueaza, the developer is not required to debug to identify what is
wrong and it was and where the problem is.
 
 
Which of the following statements about SELF-VALIDATING is true?
Choose an option:
a.
If a test fails, the developer must trust that the method must be improved but not consider the test to
be wrong.
b. When a test fails, the developer does not have to debug to identify what is wrong and where the
problem is.
c. The tests should be performed repeatedly, without other interventions
d. The results obtained should be identical regardless of the number of runs of these tests
Feedback
The correct answer is:
If a test fails, the developer must trust that the method must be improved but not consider the test to
be wrong.
 
 
Which of the following is not true about the ISOLATED principle?
Choose an option:
a. The test can be repeated for other methods
b. The test should be isolated and say exactly where the problem is and what the problem is
c. Every test must have a single reason to fail
Feedback
The correct answer is: The test can be repeated for other methods
Choose an option:
Repeatable
b . Single Responsibility
c Self-Validating
d) Fast
Feedback
The correct answer is: Single Responsibility
 
 
What does the FIRST principle mean?
Choose an option:
a, free, isolated, rapid, self-validating, timely
b . fast, isolated, repeatable, self-validating, timely
c.free, isolated, repeatable, self-validating, timely
d. fast, integrated, repeatable, self-validating, timely
Feedback
The correct answer is: fast, isolated, repeatable, self-validating, timely
 
 
What does Self-validating entail?
Choose an option:
a. The tests should be performed repeatedly without further intervention
b. When the test fails, the developer does not have to debug to identify what is wrong and where the
problem is
c. The test should be isolated and say exactly where and what the problem is
d. If a test fails, the developer must trust that the method needs to be improved, not the test
Feedback
The correct answer is: If a test fails, the developer must trust that the method needs to be improved,
not the test.
 
 
What does the isolated subprinciple imply?
Choose an option:
a. all the correct options
b. the tests must be implemented in different packages
c. when a test fails, the developer does not have to debug to identify the error
d. no variant is correct
Feedback
The correct answer is: when a test fails, the developer does not have to debug to identify the error
 
 
What does the Self-Validating sub-principle entail?
Choose an option:
a. When a test fails, the developer does not have to debug to identify the error
b. the tests must be implemented in different packages
c. no variant is correct
d. all correct options
Feedback
The correct answer is: when a test fails, the developer does not have to debug to identify the error
 
 
What does I represent in FIRST?
Choose an option:
Reverse relationship
b. All the above variants
c Isolated
d) Independent
Feedback
The correct answer is: All of the above
 
 
What does S represent in FIRST?
Choose an option:
a) Self-Validating
b) Single
c) Structural
d. Speed
Feedback
The correct answer is: Self-Validating
 
 
What is the concept of FIRST called, which means that the developer must have great confidence in the
implemented tests?
Choose an option:
a.Timely
b) Self-Validating
c Self-Tested
d) Isolated
Feedback
The correct answer is: Self-Validating
 
 
The letter "R" in the FIRST principle means:
Choose an option:
a. Repeatable
b) Relief
c) Resource
d) Reserve
Feedback
The correct answer is: Repeatable
 
 
 
The letter "T" in the FIRST principle means:
Choose an option:
Think
b . Timely
c Task
d Team
Feedback
The correct answer is: Timely
 
 
Which of the following is a specific test, especially for lists?
Choose an option:
a. time
b. no variant is correct
c) ordering
d. conformance
Feedback
The correct answer is: ordering
 
 
Which of the following alternative names does NOT correspond to the format conformity?
Choose an option:
Compliance Testing
b) Conformity assessment
c Type Testing
d) Structural Testing
Feedback
The correct answer is: Structural Testing
 
 
Which of the following is not a correct principle?
Choose an option:
a . Limit
b. The interval
c) Order
d. Cardinality of results
Feedback
The correct answer is: Limit
 
 
Which statement is correct regarding the sub-principle Does it exist in what?
Choose an option:
a. We need to check if the method has 0 elements, 1 element or n elements.
b. All are correct
c. Certain methods depend on the external things or objects external to these methods. These elements
must be checked and controlled.
 
 
What do we need to check for the Range subprinciple?
Choose an option:
a. the first element is larger or smaller than the last element
b. no variant is correct
c. the initial and final values for the index have the same value
d. both variants are correct
Feedback
The correct answer is: both options are correct
 
 
What does not need to be checked when testing the range:
 
Choose an option:
a.
The first element is larger or smaller than the last element
b.
The initial and final values for the index have the same value
c.
What happens if the index is higher than the upper limit
d.
What happens if the index is negative
Feedback
The correct answer is:
What happens if the index is higher than the upper limit
 
 
What do Reference Tests Mean?
Choose an option:
a. All of the above
b. These tests are performed using test duplicates
c. Prerequisites are needed for the method to work normally
d. Methods that depend on external things must be verified
Feedback
The correct answer is: All of the above
 
 
What does Existence testing entail?
Choose an option:
a. Certain intervals are set for the input and output values
b. We need to ask ourselves what happens to the method if a parameter does not exist or is null
c. Certain methods depend on things or objects that exist outside the method (for example, stack
extraction works if there are items in the stack)
d. In the case of lists, we must check if the order of the items is the desired one
Feedback
The correct answer is: We need to ask ourselves what happens to the method if a parameter does not
exist or is null
 
 
What does T represent in CORRECT?
Choose an option:
a . Time
b) Type
c Timely
d) Transparent
Feedback
The correct answer is: Time
 
 
What tests does the Existence principle entail?
Choose an option:
a. The test should be isolated and say exactly where the problem is and what the problem is
b. Testing whether the method has 0 elements, 1 element or n elements
c. Testing if a parameter does not exist is null or 0
Feedback
The correct answer is: Testing if a parameter does not exist, is null or 0
 
 
The right question for Existence is:
Choose an option:
a. It is known as: Compliance testing
b.
If applied in many areas where something should meet certain specific standards.
c. This principle is also used to set the limit conditions for Boundary tests in Right-BICEP.
d.
We have to ask ourselves what happens to the method if a parameter does not exist, if it is null or if it
is 0
Feedback
The correct answer is:
We have to ask ourselves what happens to the method if a parameter does not exist, if it is null or if it is
0
 
 
What does the Reference sub-principle refer to?
Choose an option:
a. We need to check if the method has 0 elements, 1 element or n elements
b. Several intervals are set for certain methods. This will be tested for all these intervals.
c. At which they are performed using test duplicates (stub, fake, dummy, mock)
Feedback
The correct answer is: The ones that are performed using test duplicates (stub, fake, dummy, mock)
 
 
 
 
 
The letter "O" in CORRECT means:
Choose an option:
a. Obligation
b) Order
c. Originality
d) Pray
Feedback
The correct answer is: Order
 
 
There is no Correct boundary conditions specific to the data analysis used in Unit Testing:
Choose an option:
a. The value is between the limits (maximum and minimum) accepted
b. The code refers to external components that are not directly controlled
c. The value has the correct format
d. Value has the type required by the variable type
Feedback
The correct answer is: Value has the type required by the variable type
 
 
CORRECT principle:
Choose an option:
a. conformance, Ordering, Range, References, Existence, cardinality, Time
b) Conformance, Ordering, Range, References, Experience, Cleanliness, Time
c) Conformance, Ordering, Range, References, Existence, Cleanliness, Time
d) Conformance, Ordering, Range, Rapidity, Existence, Cleanliness, Time
Feedback
The correct answer is: Conformance, Ordering, Range, References, Existence, Cardinality, Time
 
 
Which of the following statements about performance is false?
Choose an option:
a. In addition to testing the correctness of the results of the methods, it is very important to check the
processing performance
b. For different methods, it is possible to test how well that method works
c. The verification of the performance is made from the point of view of the consumed resources, not
being important the time necessary to obtain the results
d. Performance testing is performed when the input or result of a method is represented by a list or a
very large number of elements
Feedback
The correct answer is: Checking the performance is done in terms of resources consumed, not being
important the time required to obtain results
 
 
Which of the following statements is not related to the term Cross-Check?
Choose an option:
a. For each method, we can try to test it using a different method
b. Testing the new method is done by the old method, even if it consumes more resources
c. Certain methods can be tested by applying the inverse rule: starting from the result, you must reach
the same input from which it started initially.
d. Another problem solving method can be used to verify / test the newly implemented method
Feedback
The correct answer is: Certain methods can be tested by applying the inverse rule: starting from the
result, you must reach the same input from which it initially started
 
 
Which of the following concepts does not refer to unit testing?
Choose an option:
Assertion
b) June
c) Skeleton
d Rubber Duck
Feedback
The correct answer is: Rubber Duck
 
 
 
Which of the following is part of Right-BICEP?
Choose an option:
Glass Box Testing
b) Code-Based Testing
c) Inverse relationship
d. All the above variants
Feedback
The correct answer is: Inverse relationship
 
 
What is Right BICEP?
Choose an option:
a. a testing principle used only by experienced people
b . the most widely used testing principle
c. a test method
Feedback
The correct answer is: the most used test principle
 
 
What does B (Boundery) mean about the Right-BICEP test?
Choose an option:
a. we must test the methods for the range limits
b. Certain methods can be tested by applying the inverse rule: starting from the result, you must reach
the same input from which it initially started
c. For each method, we can try to test it using another method.
d. No variant is correct
Feedback
The correct answer is: we need to test the methods for the range limits
What does Cross-Check entail?
Choose an option:
a. Starting from the result, you must reach the same input from which it started initially
b. We need to test the situations in which the application could crack
c. None of the above
d. For each method, we can try to test it using another method
Feedback
The correct answer is: For each method, we can try to test it using a different method
 
 
What does the Right principle entail?
Choose an option:
a. Reverse relationships
b. The results provided by the method are correct
c. The performance of the application must be verified
d. The limits of the results provided by the method are correct
Feedback
The correct answer is: The results provided by the method are correct
 
 
What is RIGHT?
Choose an option:
a. If the limits provided by a method are correct
b. If all inverse relations are verified
c. If the results provided by a method are correct
Feedback
The correct answer is: If the results provided by a method are correct
 
 
From what points of view is the performance check done?
Choose an option:
a. resources consumed and time required to obtain results
b. all variants are correct
c. written lines of code
d. time required to write the code and resources consumed
Feedback
The correct answer is: resources consumed and time required to obtain results
 
 
From the Right-BICEP principle, what does Boundary NOT mean?
Choose an option:
a. The methods for the range limits are tested
b. The tests are done only for the lower and upper limits, if any.
c. The interval in which the values of the input parameters can be determined is determined
d. The methods for the limits of the intervals and outside them are tested
Feedback
The correct answer is: Test the methods for the limits of the intervals and outside them
 
Reverse relationship means:
Choose an option:
a.  Testing the methods by applying the inverse rule: starting from the result, you must reach the same
input from which it started initially.
b. The verification of the performance is made both from the point of view of the consumed resources,
and from the time necessary for obtaining the results.
c. This situation is possible when the implemented method has been designed to increase productivity
or if the old method consumes too many resources.
Feedback
The correct answer is: Testing the methods by applying the inverse rule: starting from the result, you
must reach the same input from which it initially started.
 
 
 
What does the concept of Inverse Relationshp refer to?
Choose an option:
a. Every time we test a method, the first thing that should be checked is that this method gives the
correct results.
b. In addition to testing the correctness of the results of the methods, it is very important to check the
processing performance.
c. For each method, we can try to test it using another method
d. Certain methods can be tested by applying the inverse rule: starting from the result, you must reach
the same input from which it initially started
Feedback
The correct answer is: Certain methods can be tested by applying the inverse rule: starting from the
result, you must reach the same input from which it initially started
 
 
Letter I of BICEP comes from:
Choose an option:
Interface Segregation
b) Interface Dependency
c) Investment Dependency
d) Iskov Substitution
Feedback
The correct answer is: Inversion Dependency
 
 
The main feature of Performance testing is:
Choose an option:
a. This verification is done without verifying the specifications of the developed project.
b. Does not apply to all methods. It usually applies to mathematical methods.
c. Testing the new method is done by the old method, even if it consumes more resources.
Feedback
The correct answer is: This check is done without checking the specifications of the developed project.
 
 
 
The main feature of the Right test is:
Choose an option:
a. This check is done without checking the specified t for in the project developed.
b. Every time we test a method, the first thing that should be checked is that this method gives the
correct results.
c. This verification is done without verifying the specifications of the developed project.
Feedback
The correct answer is: This check is done without checking the specifications of the developed project.
 
 
The cause of the most common software errors is:
Choose an option:
a. programming errors
b . specification errors
c. None of the above
d. design errors
Feedback
The correct answer is: specification errors
 
 
What is the concept of Setup?
Choose an option:
a. Collection of test cases
b. A method / stage of destroying objects after completion of tests
Question 3
 
 
A TestCase class is an object of the design pattern:
Choose an option:
a. Strategy
b) Visitor
c) Command
d) State
e. Mediator
Feedback
The correct answer is: Command
 
 
What does the assertArrayEquals () method do?
Choose an option:
a. Test each element in the vector one by one using the equals () method.
b. Test if 2 arrays have the same instances and if they have the same length.
c. Test if 2 arrays have the same length.
Feedback
The correct answer is: Test each element in the vector one by one using the equals () method.
 
 
 
What is the difference between the assertEquals () method and assertSame ()?
Choose an option:
a. assertEquals () compares by .equals () while assertSame () compares by the == operator.
b. The assertSame () method can have 3 parameters + the optional one.
c. The assertSame () method compares only primitive data types.
Feedback
The correct answer is: assertEquals () compares with .equals () while assertSame () compares with the ==
operator.
 
 
Whitebox testing is known to them under the name:
Choose an option:
a. Clear Box Testing
b) Linera Teasting
c) Functional Box Testing
Feedback
The correct answer is: Clear Box Testing
 
 
By whom is the BlackBox tested?
Choose an option:
a. By customers
b. By those who make the application
c . By those who do not know the internal architecture of the tested application
Feedback
The correct answer is: By those who do not know the internal architecture of the tested application
 
 
Reasons not to use Unit Testing:
Choose an option:
a. There are many frameworks and tools that simplify the writing and running process
b. It is stated in the specifications that we must do tests
c. Increases the rate of identification bugs in the code writing phase
d. They can be run automatically whenever needed
Feedback
The correct answer is: It is specified in the specifications that we have to do tests
 
 
According to which two design patterns, does JUnit work?
Choose an option:
Bridge and Command
b. Composite and Strategy
c) Adaper and Mediator
d) Flyweight and Observer
e) Composite and Command
Feedback
The correct answer is: Composite and Command
 
The advantage of WhiteBox testing is:
Choose an option:
a. Testing is more in-depth, with the possibility of covering most cases
b. The tester does not need to know programming
c. The tests will have a small number of entries
d. The tests are performed from the user's point of view
Feedback
The correct answer is: Testing is more in-depth, with the possibility of covering most cases
 
 
What does BlackBox testing entail?
Choose an option:
a. Testing components about which there is complete information
b. None of the above
c. Testing the public interface of some components without having information regarding the
implementation, internal structure, etc.
d. Automatic testing of the application after the implementation of some modifications so as to avoid
the recurrence of previous errors
Feedback
The correct answer is: Testing the public interface of some components without having information
about the implementation, internal structure, etc.
 
 
What does the void assertSame method (parm1, parm2) imply?
Choose an option:
a. The method tests if the 2 parameters are equal.
b. The method returns a Boolean variable after testing.
c. The method tests whether 2 objects refer to the same object.
Feedback
The correct answer is: The method tests whether 2 objects refer to the same object.
 
 
Which of the statements is correct?
Choose an option:
a. JUnit is an adaptation of xUnit
b. All the above variants
c. Unit Testing is performed in a well-defined context in the test specifications
d. Fixture is a set of objects used in the test
Feedback
The correct answer is: All of the above
 
 
 
JUnit features:
Choose an option:
a. The goal is to write tests that fail so that errors are corrected in time
b. Simplifying tests helps quickly identify bugs
c. All variants
d. A test method can contain multiple assets
Feedback
The correct answer is: All options
 
 
Choose a unit test feature:
Choose an option:
a . Each test validates a behavior in the application
b. It presents long and comprehensive explanations
Feedback
The correct answer is: Each test validates a behavior in the application
 
 
What is the concept of Assertion?
Choose an option:
a. There are exceptions thrown by Test Case.
b . It is a static class whose methods help test the code.
c. It is a framework through which tests are written and run.
Feedback
The correct answer is: It is a static class whose methods help test the code.
 
 
Which Assert method checks if an object is null?
Choose an option:
assertFalse
b. assertNull
c. fail
d) assertEquals
Feedback
The correct answer is: assertNull
 
 
Choose an option:
a. JUnit 3 needs a version of JDK 1.2 while JUnit 4 needs a newer version than JDK 5
b. JUnit 3 needs a version of JDK 3 while JUnit 4 needs a newer version than JDK 7
Feedback
The correct answer is: JUnit 3 needs a version of JDK 1.2 while JUnit 4 needs a newer version than JDK 5
 
 
In the void assertEquals method (message, expected, actual, delta), what is the significance of the last
parameter?
Choose an option:
a. delta represents the margin of error for the real values, this realizing an interval + -delta.
b. delta is a boolean parameter that indicates whether expected is equal to current or not.
c. delta indicates that the integer values must not exceed that range.
Feedback
The correct answer is: delta represents the margin of error for the real values, this realizing a + -delta
interval.
 
Which of the following Assert methods is not found in JUnit?
Choose an option:
assertSame
b . Assert.IsNotNull
c) assertEquals
d. assertTrue
Feedback
The correct answer is: Assert.IsNotNull
 
 
WhiteBox testing is NOT known as:
Choose an option:
a . Behavioral testing
b. Structural testing
c) Clear Box Testing
d Code-Base Testing
Feedback
The correct answer is: Behavioral testing
 
 
What is Unit Testing?
Choose an option:
a. Refers to the individual testing of a component, code part, class or method
b. None of the above
c. All the above variants
d. It is a method used to check if the application works according to customer requirements
Feedback
The correct answer is: Refers to individual testing of a component, code part, class, or method
 
 
"Objects can be replaced at any time with instances of derived classes without affecting functionality"
describes:
Choose an option:
Dependency inversion principle
b) Open-close principle
c) Interface segregation principle
d) Liskov Substitution
Feedback
The correct answer is: Liskov Substitution
 
 
When is the use of comments indicated?
Choose an option:
a. When you are not currently using a particular piece of code
b. When you want to explain how a method written by you works
c. When you want to apologize
d. When you write ALL comments
Feedback
The correct answer is: When you write TODO comments
 
 
Which statement is false regarding naming conventions?
Choose an option:
a. When there are complementary variables, the names must not be symmetrical
b. If the name of a method contains a conjunction ("and", "or", "or") we are most likely talking about
two methods
c. The methods must clearly describe what they do
d. In Java it is recommended to use the camelCase naming convention for naming variables
Feedback
The correct answer is: When there are complementary variables, the names do not have to be
symmetrical
 
 
Which of the following statements is correct?
Choose an option:
a. The variables will be declared as abstract as possible
b. Always try to get out of office as soon as possible
c. Using methods with at least 2 parameters
d. Any method is recommended to have at least three levels of nested structures
Feedback
The correct answer is: Always try to get out of service as soon as possible
 
 
Which of the following statements is false?
Choose an option:
a. If and switch structures increase complexity
b. It is recommended that the methods have a maximum of 2 parameters
c. All methods in a class must be related to that class
d. The complexity must be directly proportional to the number of lines of code
Feedback
The correct answer is: The complexity must be directly proportional to the number of lines of code
 
 
Which of the following principles is derived from KISS?
Choose an option:
a. DRY
b) YAGNI
c) SOLID
Feedback
The correct answer is: YAGNI
 
 
Which of the following follows name convections?
Choose an option:
a. boolean isActive = true;
b. all are correct
c) firstMethod ();
d. calculationChiria Si Media ();
Feedback
The correct answer is: boolean isActive = true;
 
 
Which of the following is not a Clean Code principle?
Choose an option:
a. SOLID
b) YAGNI
c REST
d) KISS
Feedback
The correct answer is: REST
 
 
Which of the following statements is correct regarding the Utils class?
Choose an option:
a. is like a magnet
b. is the class with the most methods
c. is the class with the fewest methods
d. may contain only static methods
Feedback
The correct answer is: it's like a magnet
 
 
Which of the following is not a principle?
Choose an option:
a . Keep it sure and simple
b) Don’t repeat yourself
c) You ain't gonna need it
d) SOLID
Feedback
The correct answer is: Keep it sure and simple
 
 
Which of the following are Clean Code rules in methods?
Choose an option:
a. A and B
b. avoid parameter methods
c. the variables will be declared as close as possible to their use
d. comment on unused code
Feedback
The correct answer is: the variables will be declared as close as possible to their use
 
 
Which of the following principles does not represent Clean Code?
Choose an option:
a. The code must be easy to maintain
b. The code must be easy to read
c. The code must be easy to understand
d. The code must not be easily modified
Feedback
The correct answer is: The code must not be easily modified
 
 
 
Which of the following follows the principles of Clean Code?
Choose an option:
a . var a = 4 * i;
b) var a = 4 * i;
c) var a = 4 * i;
d) var a = 4 * i;
Feedback
The correct answer is: var a = 4 * i;
 
 
What is the Interface Segregation principle?
Choose an option:
a. A class must always have only one responsibility and only one
b. Objects should not be forced to implement methods that are not useful
c. Several specialized interfaces are always preferable to a single general interface
d. Usually the use of enum denotes a wrong class design
Feedback
The correct answer is: Multiple customizable interfaces are always preferable to a single general
interface
 
 
Which operators are exceptions to the rule and are not separated from operands by a space?
Choose an option:
a. Ternal
b
c) Unari
Feedback
The correct answer is: Unari
 
 
What does "glass breaking code" mean?
Choose an option:
a. code difficult to modify
b. code closely related to other sequences in the code
c) bad code
d. code that has dependencies in many external modules
Feedback
The correct answer is: code that has dependencies in many external modules
 
 
What Bad Code means:
Choose an option:
a. Hard to read and understand
b. Independent of other code sequences
c) Easy to decipher.
d. It does not break when you change it
Feedback
The correct answer is: Hard to read and understand
 
 
What does refactoring mean?
Choose an option:
a. Rewrite the code in a way that better adapts to the new specifications
b. Automatic code testing based on use cases
c. Use-based development
Feedback
The correct answer is: Rewrite the code in a way that better adapts to the new specifications
 
 
What does Clean Code mean?
Choose an option:
a. The code must be easy to modify
b. The code must be easy to understand
c. The code must be easy to read
 
 
What does the Interface Segregation principle entail?
Choose an option:
a. we do not risk that by modifying the "contract" of a client to modify the contracts of other clients
b. several specialized interfaces are always preferable to a single general interface
c. objects should not be forced to implement methods that are not useful
d . all options are correct
Feedback
The correct answer is: all variants are correct
 
 
What does the Open-Close principle entail?
Choose an option:
a. no variant is correct
b . closed for modifications and open for extensions
c. can be open or closed for modifications, infusion of how we establish from the beginning
d. open for modifications and closed for extensions
Feedback
The correct answer is: closed for changes and open for extensions
 
What does the principle of Single Responsibility entail?
Choose an option:
a. all of the above are correct
b. none of the above is correct
c. a class must always have only one responsibility and only one
d. only the one who creates the class is responsible for it
Feedback
The correct answer is: a class must always have only one responsibility and only one
 
 
What principle is violated when implementing methods we do not use?
Choose an option:
a . YAGNI
b) Single Responsibility
c) KISS
d. DRY
Feedback
The correct answer is: YAGNI
 
 
What is the concept of DRY?
Choose an option:
a. There should be no code copied in multiple places
b. A class must do one thing
c. The code should be written as simply as possible
d. Programming on interfaces that uses abstractions
Feedback
The correct answer is: No code copied to multiple places
 
 
What is the concept of KISS?
Choose an option:
a . One method has to do one thing
b. If we don't need a method, we don't write it
c. The methods are separated by a single blank line
d. Creating the most specialized interfaces
Feedback
The correct answer is: A method must do one thing
 
 
What is the YAGNI concept?
Choose an option:
a. The parameters are separated by commas and spaces
b. Programming on interfaces, not implementations
c. If we don't need a method, we don't write it
d. Objects should not be forced to implement methods that are not useful
Feedback
The correct answer is: If we don't need a method, we don't write it
The code should be easy to:
Choose an option:
a. Modified
b. All the above variants
c) Read
d) Understood
Feedback
The correct answer is: All of the above
 
 
Copying and pasting a piece of code (Copy / Paste) violates the following principle:
Choose an option:
a. SOLID
b) KISS
c YAGNI
d. DRY
Feedback
The correct answer is: DRY
 
 
How do you recognize a Bad Code?
Choose an option:
a. is too intuitive / easy to understand
b . it is difficult to read and understand
c. does not display the expected result
d. contains syntax errors
Feedback
The correct answer is: it is difficult to read and understand
 
 
How is the cyclomatic complexity of the methods calculated?
Choose an option:
a=M+A+N+3
b . M = A - N + 2
c M = A + 2N
d M = 2A + N
Feedback
The correct answer is: M = A - N + 2
 
 
Where does the letter D in SOLID come from?
Choose an option:
Dependency investment
b) Design Pattern
c) Dependency visualization
d) Dependency loop
e. Dry
Feedback
The correct answer is: Dependency inversion
 
 
Interface segregation principle:
Choose an option:
a. Several specialized interfaces are always preferable to several general interfaces
b. We thus risk that by modifying the "contract" of a client to modify the contracts of other clients
c. Objects are forced to implement methods that are not useful
d. Objects should not be forced to implement methods that are not useful
Feedback
The correct answer is: Objects should not be forced to implement methods that are not useful
 
 
What does Dependency Inversion Principle mean?
Choose an option:
a. Several specialized interfaces are always preferable to a single general interface
b. Badly chosen names are a magnet for lazy programmers
c. Programming is done using interfaces, abstractions and not concrete classes
d. Methods with more than 2 parameters should be avoided
Feedback
The correct answer is: Programming is done using interfaces, abstractions and not concrete classes
 
 
What does the Liskov substitution mean?
Choose an option:
a. Objects can be replaced at any time with instances of derived classes without affecting functionality
b. The classes that work together will be placed next to each other as much as possible
c. Classes must be open for extensions
d. Programming based on abstractions that does not depend on concrete classes
Feedback
The correct answer is: Objects can be replaced at any time with instances of derived classes without
affecting functionality
 
 
What does zombie code mean?
Choose an option:
a. Unused commented code
b. Source code
c. Informative comments
d. TODO type commands
Feedback
The correct answer is: Commented unused code
 
 
The principles of clean code are:
Choose an option:
a. Strategy
b . Dry
c. Solid
d) State
Feedback
The correct answer is: Dry
 
 
The programming consists of:
Choose an option:
a. write code and read code
b. tell the computer what to do
c. write code, read code, tell another person what we want a computer to do
d. to write code
Feedback
The correct answer is: write code, read code, tell another person what we want a computer to do
 
 
The Hungarian Notaion system refers to:
Choose an option:
a. Using special characters in the name of the class
b. Writing class names in capital letters
c. Using underscore in variable names
d. Specifying the date type in the class name
Feedback
The correct answer is: Specify the date type in the class name
 
 
A principle of the Clean Code is:
Choose an option:
a YAGNI
b) CORRECT
c WhiteBox
d.Right - BICEP
Feedback
The correct answer is: YAGNI
 
 
UpperCamelCase refers to:
Choose an option:
a. Using underscore in variable names
b. Using special characters in the name of the class
c. Writing class names in capital letters
d . Specifying the date type in the class name
Feedback
The correct answer is: Specify the date type in the class name
 
 
 
ANSWER GRIDS
 
What does implementation for Abstract Factory entail?
Choose an option:
a. We have a single factory with which we obtain objects from all families of objects
from a certain category
b. For each object there is a method
c. All the above variants
d. Each factory will create two or more types of objects
The correct answer is: All of the above
 
Prototype Pattern Design:
Choose an option:
a. Helps to demand clones for objects whose construction takes a long time
b. Helps to request clones for objects whose construction consumes a lot of resources
c. Both variants
d. None of the variants
The correct answer is: Both options
 
Which of the following statements about Inner Static Helper Class is false?
Choose an option:
a. The nested class can be accessed from outside the class because it is public
b. Combine Eager Initialization with Lazy Initialization
c. Contains a nested class in the Singleton class
d. The nested class is loaded only when the instance creation function is called
The correct answer is: The nested class can be accessed from outside the class because it is public
 
What is the correct way to implement the Builder design pattern?
Choose an option:
a. The creation of the complex object is done in the build () method based on the settings made
b. All variants are correct
c. Implementation that involves the use of a nested class
d. The creation of the complex object is done in the Builder class constructor
The correct answer is: All options are correct
 
What characterizes the Builder design pattern?
Choose an option:
a. All options are correct
b. Used for object families
c. Helps to create concrete objects
d. Introduces a new level of object abstraction
The correct answer is: Help create concrete objects
 
What is the correlation between the Singleton design pattern and Factory?
Choose an option:
a. the factory can generate a single instance
b. the factory can be unique
c. through the factory the leaf nodes are created
d. container nodes are created through the factory
The correct answer is: the factory can be unique
 
 
 
Which of the following is a feature for Eager Initialization?
Choose an option:
a. If the Singleton class is not used, the instance is not created;
b. It involves the initialization of the court even if it is not used;
c. Eager Initialization ensures that the method will not be called by another thread
until the method already called on an execution thread is finished;
d. Eager Initialization involves the use of an enumeration for the unique creation of the instance;
The correct answer is: It involves initializing the instance even if it is not used;
 
What is the name Factory?
Choose an option:
a. All variants
b. It offers the possibility of creating concrete objects from a family of objects, without knowing it
exactly the concrete type of the object
c) No variant
d. The phrase by which it is recognized is a family of objects or objects of the same
family
The correct answer is: All options
 
Singleton - Inner static helper class is the type that combines:
Choose an option:
a. Eager Initialization with Lazy Initialization
b. Static block initialization with Thrad Safe Singleton
c. None of the variants
d. Threa safe Singleton with Eager Initialization
The correct answer is: Eager Initialization with Lazy Initialization
 
What is the key phrase for using the Singleton design pattern?
Choose an option:
a. adding new functionalities
b. family of objects
c) single court
d. construction of complex objects with many attributes
The correct answer is: single court
 
What is the name Factory Method?
Choose an option:
a. All of the above
b. Use enum just like Simple Factory
c. It does not abstract the level of creation
d. It is also called Virtual Constructor
The correct answer is: It is also called Virtual Constructor
 
What does the name Singleton mean?
Choose an option:
a. The key phrase for using this design pattern is "multiple instances"
b. The fact that we can have only one object of the type of the respective class
c. Users or callers are those who deal with the fact that only one object can be created
d. All variants
The correct answer is: The fact that we can have only one object of the type of that class
 
Which of the other types is the Static block initialization type similar to?
Choose an option:
Singleton Collection
b) Eager initialization
c) Enum singleton
d) Lazy initialization
The correct answer is: Eager initialization
 
What is the Builder Name?
Choose an option:
a. The name comes from the fact that it helps to build objects (build)
b. Simple objects are constructed
c. Helps create abstract objects
d. All variants
The correct answer is: The name comes from the fact that it helps to build objects (build)
 
Builder is used for:
Choose an option:
a. building objects with few attributes
b. None of the above
c. the construction of objects whose construction takes a long time
d. construction of complex objects with many attributes
The correct answer is: building complex objects with many attributes
 
When is Prototype used?
Choose an option:
a. When creating an object does not take much time or does not consume much resources
many
b. When creating an object takes a long time or consumes a lot of resources
c. It is applied whenever we use copy-paste
d. We never use Prototype
The correct answer is: When creating an object takes a long time or consumes a lot
many resources
 
What are the disadvantages of the Simple Factory design pattern?
Choose an option:
a. It is not correlated with Singleton in each class
b. When we add a new type of product we have to change in several places
including the factory
c. It is difficult to implement when there are several attributes for the classes used
d. All variants
The correct answer is: When we add a new type of product we have to change in May
many places including the factory
 
What are the two variants / implementation versions of the Builder?
Choose an option:
a. There is only one implementation version / version for Builder
b) Both variants
c. Creating the complex object in the Builder class constructor and modifying the attributes
as required
d. The creation of the complex object is done in the build () method based on the settings made
The correct answer is: Both options
 
The implementation of the Design Pattern Builder is done by:
Choose an option:
a. creating the complex object in the build () method based on the settings made
b. All variants
c. creating the complex object in the Builder class constructor and modifying the attributes
as required
d. No variant is correct
e. using an nested class (inner class)
The correct answer is: All options
 
Which of the statements regarding the implementation of the Singleton design pattern is correct?
Choose an option:
a. Contains a static instance
b. The class constructor must be private
c. All variants
d. The creation of objects is done through a static function
The correct answer is: All options
 
What is recommended to do if we need to serialize and deserialize a singleton instance?
Choose an option:
a. There is no problem when we serialize and deserialize a singleton instance
b. Override the readResolve () method, and within the method call the method that
returns the court
c. Let's use Enum Singleton
d. Let's use Thread Safe Singleton
The correct answer is: Let's overwrite the readResolve () method, and within the method let's call
the method that returns the instance
 
What is the design pattern that is not presented in the GoF book?
Choose an option:
a) Prototype
b.Builder
c. Singleton
d. Simple Factory
The correct answer is: Simple Factory
 
Prototype is useful when:
Choose an option:
a. Creating objects takes a long time
b. It is desired to create objects with many properties
c. None of the variants
d. It is desired to use different classes together
The correct answer is: Creating objects takes a long time
 
Under what name can the Factory Method design pattern be found?
Choose an option:
a. Decorator
b) Virtual Builder
c) Simple Factory
d. Hollywood Principle
The correct answer is: Virtual Constructor
 
What characterizes Enum singleton?
Choose an option:
a. Enum values are accessible locally
b. It involves the use of an enumeration for the unique creation of the instance
c. All variants
d) Allows Lazy initialization
The correct answer is: It involves using an enumeration to create the unique instance
 
Prototype:
Choose an option:
It is a creational design pattern
b. It is a structural design pattern
c. It is a behavioral design pattern
d. None of the above
The correct answer is: It is a creational design pattern
 
Which of the following is true if we are referring to a Singleton class?
Choose an option:
a. We announce the programmer not to create more instances with that class
b. The Singleton class allows the creation of multiple instances
c. The creation of several instances will be restricted from within the class
d. The Singleton class constructor will be public
The correct answer is: From within the class, the creation of multiple instances will be restricted
 
Which of the following is not a Singleton type?
Choose an option:
a. Static block initialization
b) Conformity Assessment
c Thread Safe Singleton
d) Lazy Initialization
The correct answer is: Conformity Assessment
 
What is the component part that deals with the fact that only one object of the class can be created
Singleton?
Choose an option:
a. No correct answer
b. The user
c. The caller
d) Class
The correct answer is: Class
 
In what types of design patterns is the Singleton design pattern included?
Choose an option:
a. None of the variants
b) Creational
c. Structural
d) Behavioral
The correct answer is: Creationale
 
Factory Method is also called:
Choose an option:
Virtual Builder
b) Single Factory
c. Singleton
d. None of the above
The correct answer is: Virtual Constructor
 
Singleton:
Choose an option:
a. None of the above
b. It is a behavioral design pattern
c. It is a structural design pattern
d. It is a creational design pattern
The correct answer is: It is a creational design pattern
 
Simple Factory:
Choose an option:
It is a creational design pattern
b. None of the above
c. It is a structural design pattern
d. It is a behavioral design pattern
The correct answer is: It is a creational design pattern
 
Regarding the differences between Singleton and static classes, which of the following variants is
correct?
Choose an option:
a. Unlike Singleton, a static class can be transmitted as a parameter
b. Singleton does not respect the principles of OOP
c. Singleton can implement an interface or extend another class
d. All variants are correct
The correct answer is: Singleton can implement an interface or extend another class
 
Which of the following is a feature for Simple Factory?
Choose an option:
a. All variants are correct;
b. It offers the possibility of creating concrete objects from a family of objects, without knowing it
exactly the concrete type of the object;
c. The phrase by which it is recognized is: family of objects or objects from the same
family;
d. Simple factory is a design pattern that is not presented in the GoF book, but it is
used in practice;
The correct answer is: All variants are correct;
 
Which of the following statements is true?
Choose an option:
a. Simple Factory is a design pattern presented in the GoF book
b. Simple Factory is not used in practice
c. All variants
d. Simple Factory is used in practice because it is very easy to implement
The correct answer is: Simple Factory is used in practice because it is very easy to use
Implement
 
What characterizes the Prototype design pattern?
Choose an option:
a. Introduces a new level of abstraction
b. Through it an object considered a prototype is created
c. Also known as the Singleton Registry
d. Used to create concrete objects
The correct answer is: Through it an object considered a prototype is created
 
How do we know we need to use Simple Factory?
Choose an option:
a. when we want to build objects faster
b. when we do not want to use enum
c. when we want to add a new method to the class
d. when we want to build objects from the same family
The correct answer is: when we want to build objects from the same family
 
What characterizes Inner static helper class?
Choose an option:
a. None of the variants
b. The nested Helper class will be loaded only when the instance creation function is called
c. Contains a nested class in the Singleton class
d. All variants
The correct answer is: All options
 
Static block initialization:
Choose an option:
a. Useful in case the constructor throws exceptions
b. Ensure thread security
c. None of the variants
d. Initializes the instance only when used
The correct answer is: Useful if the constructor throws exceptions
 
What is the key phrase for the Singleton pattern design?
Choose an option:
a. single instance
b. the use of an enum
c. family of objects
d. objects with many attributes, some of which are optional
The correct answer is: single court
 
In what context is Singleton used?
Choose an option:
a. Opening a single instance of an application
b. Accessing mobile device resources (SharedPreferences in Android)
c. All variants
d. Unique connection to the database
The correct answer is: All options
 
Which of the following statements about Factory Method is true?
Choose an option:
a. Abstracts are used for calls, not concrete objects
b. All variants are correct
c. It can also be found under the name of Virtual Constructor
d. Does not use switch or if-else structures
The correct answer is: All options are correct
 
What characterizes a creational design pattern?
Choose an option:
a. Separate the creation of objects from their concrete use
b. None of the variants
c. Helps initialize and configure classes and objects
d. All variants
The correct answer is: All options
 
What does the createInstance () method do?
Choose an option:
a. activates the optional and mandatory attributes of the created object
b. receives the desired object type and returns the concrete object type according to the parameter
received
c. clones the desired object without using resources for processing
d. creates two or more types of objects
The correct answer is: receive the desired object type and return the concrete object type accordingly
parameter received
 
What does Lazy initialization entail?
Choose an option:
a. none of the variants
b. creates the instance at the time of use
c. creates the instance through a Helper class
d. instantiate the court from the beginning
The correct answer is: create the instance at the time of use
 
Which of the following are Singleton types?
Choose an option:
a. All variants
b) Eager initialization
c) Lazy initialization
d) Thread safe
The correct answer is: All options
 
What does Singleton entail?
Choose an option:
a. You cannot create multiple class objects at once
b. the existence of a single instance of the object
c. separating objects from different classes
d. cloning objects
The correct answer is: the existence of a single instance of the object
 
Builder is useful when:
Choose an option:
a. It is desired to build a single court
b. Creating objects consumes a lot of resources
c. It is desired to build objects with many properties that are not mandatory
d. None of the above
The correct answer is: You want to build objects with many non-mandatory properties
 
Which of the following statements about Factory Method is false?
Choose an option:
a. Use switch or if-else structures
b. Use abstractions for the call, not concrete classes
c. It can also be found under the name of Virtual Constructor
d. Does not use switch or if-else structures
The correct answer is: Use switch or if-else structures
 
What characterizes Singleton compared to a static class?
Choose an option:
a. All variants
b. A Singleton class cannot implement an interface or extend another class
c. A Singleton object can be sent as a parameter to a function, as opposed to a class
static that cannot be transmitted as a parameter
d. Does not comply with the principles of object-oriented programming (OOP)
The correct answer is: A Singleton object can be sent as a parameter to a function, as opposed to
of a static class that cannot be transmitted as a parameter
 
Prototype participants:
Choose an option:
a. An interface + Concrete class + Prototype
b) An interface + Specific class
c) An interface + Prototype
d. None of the variants
The correct answer is: An interface + Concrete class
 
What is the phrase by which the Simple Factory design pattern is recognized?
Choose an option:
a. None of the variants
b) Single instance
c. Family of objects
d. Similar objects
The correct answer is: Family of objects
 
 
What is the name Prototype?
Choose an option:
a. The prototype is to be cloned for the next instances in that class
b. Through this design pattern, an object considered a prototype is created
c. Helps to create clones for objects whose construction takes a long time or
consumes a lot of resources
d. All variants
The correct answer is: All options
 
Which of the following are types of the Singleton design pattern?
Choose an option:
Thread Safe Singleton;
b. All variants
c) Eager initialization;
d) Lazy initilization;
The correct answer is: All options
 
What characterizes Static block initialization?
Choose an option:
a. Initializes the instance only when used
b. Provides the possibility to capture possible exceptions generated by the initialization of the court
static
c. All variants
d. None of the variants
The correct answer is: Provides the ability to capture possible exceptions generated by
initialization of the static court
 
What kind of design pattern is Simple factory?
Choose an option:
a. Structural
b. None of the above
c) Behavioral
d. Creational
The correct answer is: Creational
 
What type of design pattern is Builder?
Choose an option:
Behavioral
b. None of the variants
c. Creational
d) Structural
The correct answer is: Creational
 
Which type of Singleton is the most recommended?
Choose an option:
a. Static block initialization
b.Singleton - Lazy Initialization
c Thread safe Singleton
d) Eager Initialization
The correct answer is: Thread safe Singleton
 
What does a class that uses the Eager Initialization variant entail?
Choose an option:
a. All options are correct
b. It presupposes the initialization of the court from the moment of declaring in class
c. The class constructor is private
d. There will be a method inside the class that will always return the instance created at the time
declaration
The correct answer is: All options are correct
 
What is the Prototype design pattern based on?
Choose an option:
a. Creating concrete objects
b. Creating clones for objects
c. Creating a single instance of a class
d. Abstracting objects
The correct answer is: Create clones for objects
 
What kind of design pattern is Singleton?
Choose an option:
a. Creational
b) Behavioral
c) Structural
d. None of the variants
The correct answer is: Creational
 
Prototype interface:
Choose an option:
a. Announce the copy method
b. Implement the cloning method
c. Implement the copy method
d. None of the variants
The correct answer is: Announce the copy method
 
 
 
What principles in SOLID follow the Factory design pattern through the createInstance () method?
Choose an option:
Dependency Inversion, Open-Closed
b) Single responsibility
c) Liskov Substitution
d) Liskov Substitution, Dependency Inversion
The correct answer is: Liskov Substitution, Dependency Inversion
 
Lazy initialization involves:
Choose an option:
a. None of the above
b. Initialize the instance even if it is not used
c. Initialize the instance only when used
d. Ensuring the security of threads
The correct answer is: Initialize the instance only when used
 
What does the third option of implementing the Builder mean?
Choose an option:
a. Using an Inner Class
b. Using another interface
c. There is no third implementation option for Builder
d. Using an abstract class
The correct answer is: Using an Inner Class
 
What type of design pattern is Prototype?
Choose an option:
a. Structural
b) Behavioral
c. None of the variants
d. Creational
The correct answer is: Creational
 
Who are the participants in a Builder?
Choose an option:
InterfaceBuilder, ConcreteBuilder, AbstractProdus
b.Builder, AbstractProduct
c AbstractBuilder, ConcreteBuilder, Product
d. Builder, Product
The correct answer is: AbstractBuilder, ConcreteBuilder, Product
 
For what type of objects is it recommended to use the Prototype design pattern?
Choose an option:
a. objects whose construction consumes a lot of resources
b. objects whose construction takes a long time
c. Both variants are correct
The correct answer is: Both options are correct
 
Prorotype is used when:
Choose an option:
a. Creating objects takes a long time
b. The created objects resemble each other
c. All variants
d) We use clones ()
The correct answer is: All options
 
Who are the participants in the Prototype?
Choose an option:
a. The abstract class that announces the copy method, the abstract class that implements
copying or cloning method
b. The interface that announces the copy method, the abstract class that implements the
copying or cloning
c. The interface that announces the copy method, the interface that implements the copy method
or cloning
d. The interface that announces the copying method, the specific class that implements the copying method
copying or cloning
The correct answer is: The interface that announces the copying method, the specific class that
implements the copy or clone method
 
The problem of serialization within Singleton:
Choose an option:
a. None of the above
b. Assumes the impossibility of writing Singleton objects to the file
c. Cannot be resolved
d. Solve by implementing the readResolve () method
The correct answer is: Solve by implementing the readResolve () method
 
What is the phrase that indicates the use of the Factory design pattern?
Choose an option:
a. a single instance
b. objects from the same family
c. adding new functionalities
d. the use of certain classes from different frameworks, which do not have a common interface
The correct answer is: objects from the same family
 
Simple Factory involves:
Choose an option:
a. building objects with many attributes, some of which are optional
b. creation of concrete objects, without knowing the concrete type of the object
c. introducing a new level of abstraction
d. creating two or more types of objects, for each there is a method
The correct answer is: creating concrete objects, without knowing the concrete type of the object
 
What type of design pattern is Factory Method?
Choose an option:
a. Structural
b. Creational
c) Behavioral
d. None of the above
The correct answer is: Creational
 
What characterizes Eager initialization?
Choose an option:
a. It is efficient
b. It involves the initialization of the court even if it is not used
c. None of the variants
d. If the Singleton class is not used, the instance is not created
The correct answer is: It involves initializing the instance even if it is not used
 
What is the correlation between Composite and Decorator?
Choose an option:
a. Composite Nodes can be viewed as Decorated Leaf Nodes
b. The connections between classes
c. The construction of objects is managed by a class
d. Both hide, in a way, the existing class
The correct answer is: Composite Nodes can be viewed as Decorated Leaf Nodes
 
What are the two types of Adapter?
Choose an option:
a. Object Adapter and Interface Adapter
b. Instance Adapter and Interface Adapter
c. Object Adapter and Class Adapter
d. Instance Adapter and Object Adapter
The correct answer is: Object Adapter and Class Adapter
 
Composite participants
Choose an option:
a. An Interface / Abstract Class + Composite + Leaf
b. None of the above
c) An interface + Concrete class + Composite + Leaf
d) An interface / Concrete class + Composite
The correct answer is: An interface / Abstract Class + Composite + Leaf
 
Proxy participants:
Choose an option:
a. An interface + Abstract class Entity + Abstract class Proxy
b) An interface + Proxy concrete class
c. An interface + Concrete class Entity + Concrete class Proxy
d. None of the variants
The correct answer is: An interface + Entity concrete class + Proxy concrete class
 
Which of the following statements about Adapter is true?
Choose an option:
a. All options are correct
b. Solve the problem of using certain classes from different frameworks that do not have an interface
common
c. The adapter does not add functionality
d. Existing classes will not change
The correct answer is: All options are correct
 
What kind of design pattern is Facade?
Choose an option:
a. Structural
b. None of the above
c. Creational
d) Behavioral
The correct answer is: Structural
 
What is the similarity between Facade and Adapter?
Choose an option:
a. Both have a single instance
b. Both implement Proxy
c. I do the same thing
d. Both are wrappers
The correct answer is: Both are wrappers
 
What is Façade used for?
Choose an option:
a. To remove from the framework functionalities
b. To adapt a class to another class
c. For available open-source frameworks
d. This design pattern does not exist
The correct answer is: For available open-source frameworks
 
The Clean Code principle violated in certain Composite implementations is:
Choose an option:
a. None of the variants
b. DRY
c) KISS
d YAGNI
The correct answer is: YAGNI
 
How to implement the Proxy design pattern?
Choose an option:
a. The Proxy class has an attribute of type Entity, this being the managed object to which it gives access
in a controlled way
b. The Proxy class implements the Entity Interface interface so that it can be used as a
interface type object
c. All variants
d. The court-specific method will be used only if the conditions are met
The correct answer is: All options
 
When is the Flyweight design pattern used?
Choose an option:
a. When we have to construct many instances of a class, objects that have a part
common
b. When you wanted to change the functionality of an object at runtime
c. When it is necessary to create a hierarchical structure by composing objects
d. When he wanted to add new functionalities to the existing classes
The correct answer is: When we have to construct many instances of a class,
objects that have a common part
 
Which of the following statements about Flyweight is true?
Choose an option:
a. Its implementation is highly memory consuming
b. One of the classes (FlyweightFactoy) contains a HashMap for retaining objects
Related
c. The objects created are identical
d. All statements are true
The correct answer is: One of the classes (FlyweightFactoy) contains a HashMap for retention
similar objects
 
Who are the participants in Decorator?
Choose an option:
a. ConcreteProduct, ConcreteDecorator
b. AbstractProduct, ConcreteProduct, AbstractDecorator, ConcreteDecorator
c. AbstractProduct, ConcreteProduct, AbstractDecorator
d. AbstractProduct, ConcreteProduct, ConcreteDecorator
The correct answer is: AbstractProduct, ConcreteProduct, AbstractDecorator, ConcreteDecorator
 
What does the implementation of a Decorator entail?
Choose an option:
a. All variants
b. Within the abstract class, the interface that defines the family of objects and
an instance of that interface is created
c. Within the concrete decorator class, the new methods in the decorator are not implemented
abstract
d. For the method in the interface, an implementation is provided, but no new functions are added
ABSTRACT
The correct answer is: Within the abstract class, the interface that defines the family is implemented
of objects and an instance of that interface type is created
 
Facade is useful when:
Choose an option:
a. It is desired to add functionalities
b. It is desired to simplify a process
c. You want to create objects with many optional properties
d. None of the above
The correct answer is: We want to simplify a process
 
In what situations is the Adapter used?
Choose an option:
a. Both variants
b. Whenever it is necessary to work together in several frameworks
c) No variant
d. Whenever you do not want to change the existing code
The correct answer is: Both options
 
What is the similarity between Proxy and Adapter?
Choose an option:
a. The connections between classes
b. Both hide, in a way, the existing class
c. The two are completely different
d. Object construction is managed by a class
The correct answer is: Both hide, in a way, the existing class
 
When is the Composite design pattern used?
Choose an option:
a. When you wanted to add new features to existing classes
b. When you wanted to change the functionality of an object at runtime
c. When it is necessary to use classes from two different frameworks
d. When it is necessary to create a hierarchical structure by composing objects
The correct answer is: When it is necessary to create a hierarchical structure by composing
of objects
 
What is the Facade design pattern used for?
Choose an option:
a. Facilitating work with very complex frameworks
b. Creating a single instance in a class
c. Brings a new level of abstraction
d. Makes it possible to work with classes from two different frameworks
The correct answer is: Make it easier to work with very complex frameworks
 
How to implement for an object adapter?
Choose an option:
a. All variants
b. The Adapter class contains an instance of the existing class
c. The Adapter class implements the interface to which it must adapt
d. By implementing the interface, it is ensured the implementation of a set of methods, which will do
calls / calls of the methods specific to the existing class through the court
The correct answer is: All options
 
What type of design pattern is Flyweight?
Choose an option:
a. Creational
b. None of the variants
c) Behavioral
d) Structural
The correct answer is: Structural
5/28/2020 QUIZ DP Structural
 
What is the similarity between Flyweight and Factory?
Choose an option:
a. Composite nodes can be seen as decorated leaf nodes
b. Leaf nodes can represent the same instance
c. The construction of objects is managed by a class
d. The connections between classes
The correct answer is: The construction of objects is managed by a class
 
Composite is useful when:
Choose an option:
a. It is desired to build a single court
b. S wants to create objects from the same class family
c. It is desired to build objects with many properties that are not mandatory
d. It is desired to create a hierarchical or tree structure
The correct answer is: You want to create a hierarchical or tree structure
 
Which of the following statements is not true?
Choose an option:
a. Composite classes contain a list of Abstract Component elements.
b. The NodFrunza classes do not implement the methods of adding and deleting a node
c. Composite is used to create application menus
d. Nodes can be added and deleted in the list of Abstract Component objects
The correct answer is: NodFrunza classes do not implement the methods of adding and deleting
a node
 
What is the name Adapter?
Choose an option:
a. All variants
b. Solve the problem of using certain classes from different frameworks that do not have an interface
common
c. The use of existing classes will be masked by means of the created adapter
d. Existing classes will not change, but new classes will be added to achieve a
Adapter between them (Wrapper classes)
The correct answer is: All options
Who are the participants in Composite?
Choose an option:
Abstract component, Composite, NodRadacina
b) Concrete component, Composite, NodRadacina
c. Concrete component, Composite, NodFrunza
d. Abstract component, Composite, NodFrunza
The correct answer is: Abstract Component, Composite, LeafNode
 
In what situations can Composite be used?
Choose an option:
a. Application menus
b. For the representation of any tree
c. Restaurant menus
d. All variants
The correct answer is: All options
 
 
Adapter:
Choose an option:
It is a creational design pattern
b. It is a behavioral design pattern
c. It is a structural design pattern
d. None of the variants
The correct answer is: It is a structural design pattern
 
 
In what situations is Decorator used?
Choose an option:
a. None of the variants
b. For the improvement of existing classes with extension or inheritance
c. To improve existing classes by modifying the existing code
d. To add new functionalities to existing classes
The correct answer is: To add new features to existing classes
 
Who are the participants in the Facade?
Choose an option:
a. The class that hides the complexity of the framework
b. Classes outside the framework used and the class that hides the complexity of the framework
c. The classes within the framework used and the class that hides the complexity of the framework
d. Classes within the framework used
The correct answer is: The classes within the framework used and the class that hides
the complexity of the framework
 
In what context is Flyweight used?
Choose an option:
a. It is superior to all other design patterns and must therefore be used in any situation
b. In games when many models differ significantly from each other
c. In games when many models are similar, but differ in color or position
d. We never use Flyweight
The correct answer is: In games when many models look alike, but differ in color
or by position
 
What is the difference between Proxy and Decorator?
Choose an option:
a. Proxy allows access to certain functionalities, and Decorator adds new functionalities
b. The two are identical
c. No variant is correct
d. Proxy changes the whole class, and Decorator changes the behavior
The correct answer is: Proxy allows access to certain functionalities, and Decorator adds new ones
features
 
What type of design pattern is Adapter?
Choose an option:
Behavioral
b) Structural
c. None of the variants
d. Creational
The correct answer is: Structural
 
Adapter is useful when:
Choose an option:
a. We want to simplify a process
b. It is desired to use certain classes from different frameworks
c. None of the variants
d. It is desired to add a functionality
The correct answer is: You want to use certain classes from different frameworks
 
Flyweight is useful when:
Choose an option:
a. It is desired to build a hierarchical structure
b. It is desired to build a single court
c. We want to build many objects of a class, objects that have a common part
d. None of the variants
The correct answer is: You want to build a lot of objects of a class, objects that have
the common part
 
When to use Proxy?
Choose an option:
a. Each time you want to make permissions for all objects
b. Whenever it is desired to obtain permissions for certain objects or
for access to certain functionalities of objects
c. Each time you want to make permissions for access to all objects
d. We do not use Proxy, because it is not efficient
The correct answer is: Every time you want to make permissions for certain
objects or for access to certain functionalities of objects
 
Who are the participants in Flyweight?
Choose an option:
Flyweight, ConcreteFlyweight, UnsharedConcreteFlyweight, FlyweightFactory
b) Flyweight, FlyweightFactory
c) ConcreteFlyweight, SharedConcreteFlyweight, FlyweightFactory
d.AbstractFlyweight, ConcreteFlyweight, UnsharedAbstractFlyweight, FlyweightFactory
The correct answer is: Flyweight, ConcreteFlyweight, UnsharedConcreteFlyweight,
FlyweightFactory
 
What type of design pattern is Proxy?
Choose an option:
Behavioral
b. None of the above
c. Creational
d) Structural
The correct answer is: Structural
 
How to implement for a class adapter?
Choose an option:
a. By implementing the interface, it is ensured the implementation of a set of methods, which will do
calls / calls of existing class-specific methods through the parent (super)
b. The Adapter class inherits the existing class
c. The Adapter class implements the interface to which it must adapt
d. All variants
The correct answer is: All options
 
What is the name Composite?
Choose an option:
a. All variants
b. It is a data structure (tree)
c. There is no design pattern with this name
d. It is used when it is necessary to create a hierarchical structure or a structure
tree by composing objects
The correct answer is: It is used when it is necessary to create a hierarchical structure or a
tree structure by composing objects
 
What is the difference between Decorator and Adapter?
Choose an option:
a. Decorator also adds new features
b) The adapter defines the build () method
c. The adapter also adds new features
d. There is no difference between the two
The correct answer is: Decorator also adds new features
 
Who are the participants in an Adapter?
Choose an option:
a. Existing class, adapter
b. Existing class, class used, adapter
c. Existing class, added class, adapter
The correct answer is: Existing class, class used, adapter
 
What is the advantage of using the Flyweight design pattern?
Choose an option:
a. None of the variants
b. Memory consumption is reduced
c. Hierarchical structures can be created
d. Objects can be modified at runtime
The correct answer is: It reduces memory consumption
 
What is the name Facade?
Choose an option:
a. To use the frameworks, you can use this facade without having to
knowledge of all classes, methods and attributes within the framework
b. Facilitates working with very complex frameworks
c. Creates a facade for very complex frameworks
d. All variants
The correct answer is: All options
 
What kind of design pattern is Decorator?
Choose an option:
Behavioral
b. None of the variants
c. Creational
d) Structural
The correct answer is: Structural
 
Proxy is useful when:
Choose an option:
a. Creating objects consumes a lot of resources
b. None of the above
c. It is desired to build objects with many properties that are not mandatory
d. It is desired to preserve the functionality of a class that will be achieved only under certain conditions
The correct answer is: We want to keep the functionality of a class that will be done only in
certain conditions
 
How is the Object Adapter implemented?
Choose an option:
a. The Adapter class inherits the existing class and implements the interface to which it must
make the adjustment
b. No correct answer
c. The Adapter class contains instances of the two existing classes
d. The Adapter class contains an instance of the existing class and implements the interface to which
he has to make the adjustment
The correct answer is: The Adapter class contains an instance of the existing class and implements
the interface to which you have to adapt
 
Flyweight:
Choose an option:
a. It is a behavioral design pattern
b. It is a structural design pattern
c. None of the above
d. It is a creational design pattern
The correct answer is: It is a structural design pattern
 
What type of design pattern is Composite?
Choose an option:
a. Creational
b) Behavioral
c. None of the variants
d) Structural
The correct answer is: Structural
 
How is the Object Adapter implemented?
Choose an option:
a. The Adapter class inherits the existing class and implements the interface to which it must
make the adjustment
b. The Adapter class contains instances of the two existing classes
c. No correct answer
d. The Adapter class contains an instance of the existing class and implements the interface to which
he has to make the adjustment
The correct answer is: The Adapter class contains an instance of the existing class and implements
the interface to which you have to adapt
 
Decorator is useful when:
Choose an option:
a. None of the above
b. It is desired to construct objects that have many optional properties
c. It is desired to add functionalities
d. Building objects takes a long time
The correct answer is: You want to add functionality
 
Which of the following statements is true?
Choose an option:
a. All variants are true
b. Facade class hides complexity through its calls
c. Facade is used for available open-source frameworks
d. The Facade class includes methods that use the methods in the framework classes
The correct answer is: All options are true
 
What is the name Command?
Choose an option:
a. All variants
b. It is used to implement lose coupling
c. The client is not disconnected from the one who executes the action
d. It does not hide the application of commands, knowing concretely what that command entails
The correct answer is: It is used to implement lose coupling
 
What kind of design pattern is Observer?
Choose an option:
a. Structural
b. None of the variants
c. Creational
d) Behavioral
The correct answer is: Behavioral
 
Command participants:
Choose an option:
a. None of the variants
b. An interface that defines the command in a general sense + Concrete classes that define the commands
in particular + Invoker + Receiver
c. An interface that defines the command in a general sense + Concrete classes that define the commands
in particular + Receiver
d. An interface that defines the command in a general sense + Concrete classes that define the commands
in particular + Invoker
The correct answer is: An interface that defines the command in a general sense + Concrete classes what
define the commands in particular + Invoker + Receiver
 
What is the difference between Strategy and States?
Choose an option:
a. Strategy changes the whole class, and States changes behavior
b. In Strategy the strategy is given as a parameter, and in States the transition from one state to another is
make controlled
c. Strategy allows access to certain features, and States adds new features
d. The two are identical
The correct answer is: In Strategy the strategy is given as a parameter, and in States the transition from a
state to state is controlled
 
How to implement the Memento design pattern?
Choose an option:
a. The Reminder class is used by both Originator and Type objects
CareTaker
b. None of the above
c. The Reminder class can be included in the CareTaker class
d. The Reminder class can be an external one, dealing with the attributes for which it is needed
made the intermediate image
The correct answer is: The Reminder class can be an external one, dealing with the attributes for which
the intermediate image must be made
 
What kind of design pattern is Memento?
Choose an option:
a. Creational
b) Behavioral
c. None of the variants
d) Structural
The correct answer is: Behavioral
 
What does the Originator participant of the Memento design pattern represent?
Choose an option:
a. None of the variants
b. The class that manages the Memento objects
c. The class that has objects for which intermediate states will be saved
d. The class that manages the internal state of objects
The correct answer is: The class that has objects for which intermediate states will be saved
 
What is the name Template Method?
Choose an option:
a. There is no method to implement the algorithm and call all the others
methods
b. All variants
c. All steps are performed by the same method
d. It is used when an algorithm is known and follows certain precise steps
The correct answer is: It is used when an algorithm is known and follows certain steps
accurate
 
Observer participants:
Choose an option:
a. Interfaces for observer and observable + Concrete classes for observer and observable
b. None of the variants
c. An interface for the observer + A concrete class for the observable
d. An interface for the observable + A concrete class for the observer
The correct answer is: Interfaces for observer and observable + Concrete classes for observer and
observable
 
 
What does the ObservableConcret class represent in the Observer design pattern?
Choose an option:
a. The abstract class or interface that defines at the abstract level the objects to be notified
b. The class or interface that defines the abstract level of the objects that manage the list
observers
c. The classes that define the observers at a concrete level
d. The concrete class that manages the list of observers
The correct answer is: The concrete class that manages the list of observers
 
Which of the following is the context in which Observer is used?
Choose an option:
Model View Controller
b. DNS Resolver
c. None of the variants
d. Databases
The correct answer is: Model View Controller
 
Command is useful when:
Choose an option:
a. None of the variants
b. It is desired to solve a problem when it is not known exactly who can solve it,
but there is a list of possibilities
c. It is desired to implement an algorithm that strictly follows certain steps
d. It is desired to disconnect the client from the one who executes an action
The correct answer is: You want to disconnect the client from the one performing an action
 
What is the name Observer?
Choose an option:
a. It is used when certain elements (objects) must be announced by the change
the condition of other objects
b. Defines a ratio of n: 1, in which several subjects notify a single observer
c. None of the variants
d. Defines a 1: 1 ratio, in which a subject notifies a single observer
The correct answer is: It is used when certain elements (objects) need to be announced
by changing the state of other objects
 
 
What type of design pattern is Command?
Choose an option:
Behavioral
b) Structural
c. Creational
d. None of the variants
The correct answer is: Behavioral
 
What is the name Memento?
Choose an option:
a. It is used for backup
b. Allows saving and returning to saved states whenever desired
c. It is used when you want to save certain states for objects in a class
d. All variants
The correct answer is: All options
 
Who are the participants in the Command?
Choose an option:
Command, Concrete Commands, Receiver, Invoker
b) Command, Abstract Commands, Receiver, Invoker
c) Command, Receiver, Invoker
d) Concrete commands, Receiver, Invoker
The correct answer is: Command, Concrete Commands, Receiver, Invoker
 
Observer is useful when:
Choose an option:
a. It is desired to announce certain objects in connection with the change of state of other objects
b. It is desired to build a single court
c. None of the variants
d. It is desired to build a hierarchical structure
The correct answer is: You want to announce certain objects about the change of state
other objects
 
What type of design pattern is Strategy?
Choose an option:
Behavioral
b. None of the variants
c. Creational
d) Structural
The correct answer is: Behavioral
 
What type of design pattern is the Template Method?
Choose an option:
Behavioral
b. None of the variants
c. Creational
d) Structural
The correct answer is: Behavioral
 
Participants from the States:
Choose an option:
a. None of the variants
b. An interface + Concrete classes that challenge the states of the object + Concrete class that defines
the object
c. An interface + Concrete classes that define objects in different states
d. An interface + Abstract classes
The correct answer is: An interface + Concrete classes that defy the states of the object + Concrete class
what defines the object
 
Reminder is useful when:
Choose an option:
a. It is desired to implement an algorithm that strictly follows certain steps
b. It is desired to solve a problem when it is not known exactly who can solve it,
but there is a list of possibilities
c. It is desired to save certain states for the objects of a class
d. None of the variants
The correct answer is: You want to save certain states for objects in a class
 
How is the Chain of Responsibility design pattern implemented?
Choose an option:
a. None of the variants
b. The management of the next handler is done in another concrete class
c. The last handler in the chain must be implemented so as to use the next handler,
generalized
d. If a concrete handler cannot solve the problem, turn to the next one
handler
The correct answer is: If a concrete handler cannot solve the problem, turn to
the next handler
 
What does the ObservatorConcret class represent in the Observer design pattern?
Choose an option:
a. The class or interface that defines the abstract level of the objects that manage the list
observers
b. The classes that define the observers at a concrete level
c. The concrete class that manages the list of observers
d. The abstract class or interface that abstractly defines the objects to be notified
The correct answer is: The classes that define observers at a concrete level
 
Who are the participants in the Reminder?
Choose an option:
Memento, AbstractMemento, Originator, CareTaker
b) Memento, Originator
c.Memento, CareTaker
d. Memento, Originator, CareTaker
The correct answer is: Reminder, Originator, CareTaker
 
Which of the following statements is true?
Choose an option:
a. The observer defines a 1: 1 ratio
b. Observer defines a ratio of 1: n
c. All variants are correct
d. Observer allows the instantiation of a single object in a class
The correct answer is: Observer defines a 1: n ratio
 
 
In what situations can Command be used?
Choose an option:
a. Macros
b. Wherever you want to return to a previous state through commands
c. Working with files
d. All variants
The correct answer is: All options
 
Which of the following statements about Strategy is true?
Choose an option:
a. It is used in the use of validators for certain controls
b. Within each concrete class the processing method is implemented
c. All variants are true
d. Within the class that manages the Strategy court, a mechanism of
change of processing method
The correct answer is: All options are true
 
In what situation is Chain of Responsibility used?
Choose an option:
a) Data mining
b) Model View Controller
c AI
d. DNS Resolver
The correct answer is: DNS Resolver
When is the State pattern used?
Choose an option:
a. When it is necessary to create a hierarchical structure by composing objects
b. When it is necessary to use classes from two different frameworks
c. When you wanted to change the functionality of an object at runtime
d. When an object changes its behavior based on its state
The correct answer is: When an object changes its behavior based on the state in which it is
find out
 
What is the ConcreteState class?
Choose an option:
a. The class that defines the object that will go through the created states
b. The concrete states in which an object can be
c. Abstraction of the states in which an object can be
d. The interface that defines at an abstract level the states in which an object can be
The correct answer is: The concrete states in which an object can be
 
What is the Handler participant in the Chain of Responsibility represented by?
Choose an option:
a. None of the variants
b. Concrete classes whose objects will form the chain
c. The abstract class that defines the interface of the objects that will handle the processing request and
the solution to the problem
d. Class that deals with order management
The correct answer is: The abstract class that defines the interface of the objects that will handle the request
processing and problem solving
 
What is the name State?
Choose an option:
a. All variants
b. It is very similar to Observer
c. It is used when an object changes its behavior based on its state
d. None of the variants
The correct answer is: It is used when an object changes its behavior based on the state
in which it is located
 
How to implement the Template Method design pattern?
Choose an option:
a. It is not recommended to implement this design pattern
b. In the abstract class, the template method is declared abstract
c. Within the concrete classes, the methods used in the template method are implemented, but also
other methods
d. In the abstract class, the template method is declared final, so that it cannot be
override
The correct answer is: In the abstract class, the template method is declared final, so as not to
can be overwritten
 
What does the Receiver participant represent in the Command design pattern?
Choose an option:
a. The object responsible for the execution of the actions
b. Concrete classes for each order
c. The interface that defines commands or actions at the abstract level
d. Class that deals with order management
The correct answer is: The object responsible for the execution of the actions
 
When is the Command design pattern used?
Choose an option:
a. When you wanted to change the functionality of an object at runtime
b. When it is necessary to create a hierarchical structure by composing objects
c. When loose coupling implementation is required
d. When he wanted to add new functionalities to the existing classes
The correct answer is: When loose coupling implementation is required
 
What kind of design pattern is State?
Choose an option:
a. None of the variants
b. Creational
c) Structural
d) Behavioral
The correct answer is: Behavioral
 
What characterizes behavioral design patterns?
Choose an option:
a. All variants
b. Provides solutions for better interaction between objects and classes
c. Controls the complex relationships between classes
d. They allow the distribution of responsibilities by classes and describe the interaction between classes and
objects
The correct answer is: All options
 
What does the Invoker participant represent in the Command design pattern?
Choose an option:
a. Concrete classes for each order
b. The object responsible for the execution of the actions
c. The interface that defines commands or actions at the abstract level
d. Class that deals with order management
The correct answer is: The class that handles order management
 
What type of design pattern is Chain of Responsibility?
Choose an option:
a. Creational
b. None of the variants
c) Behavioral
d) Structural
The correct answer is: Behavioral
 
Strategy participants:
Choose an option:
a. An interface + Concrete classes that contain an interface type reference
b. An interface + Concrete classes that contain a reference of the interface type + Concrete class that
implements the interface
c. An interface + Concrete classes that implement the interface + Concrete class that contains a
interface type reference
d. None of the variants
The correct answer is: An interface + Concrete classes that implement the interface + Concrete class
which contains an interface type reference
 
What is Strategy?
Choose an option:
a. Defines the strategy adopted at run-time
b. It is used when we have a single algorithm to solve a problem
c. All behaviors are given by the same class
d. The choice of implementation is made at compilation
The correct answer is: Define the strategy adopted at run-time
 
Chain of Responsibility is useful when:
Choose an option:
a. It is desired to implement an algorithm that strictly follows certain steps
b. It is desired to solve a problem when it is not known exactly who can solve it,
but there is a list of possibilities
c. We want to build many objects of a class, objects that have a common part
d. None of the variants
The correct answer is: You want to solve a problem when you don't know exactly who it is
can solve, but there is a list of possibilities
 
What is the CareTaker participant in the Memento design pattern represented by?
Choose an option:
a. None of the variants
b. The class that has objects for which intermediate states will be saved
c. The class that manages the Memento objects
d. The class that manages the internal state of objects
The correct answer is: The class that handles Reminder objects
 
Which of the following statements about Command is true?
Choose an option:
a. The invoker can save the invoked commands
b. All variations are true
c. Command is used to implement lose coupling
d. The invoker can be used to invoke commands
The correct answer is: All varieties are true
 
What is the name Chain of Responsibility?
Choose an option:
a. It is used when the person who needs to solve a problem does not know exactly who
can solve the problem
b. It is used when the person who needs to solve a problem has a list of
possible objects that can solve the problem
c. All variants
d. These possible objects are arranged in a chain, then the one that has the problem to solve
calls for the first za in the chain
The correct answer is: All options
 
When is the Strategy design pattern used?
Choose an option:
a. When you wanted to change the functionality of an object at runtime
b. When he wanted to add new functionalities to the existing classes
c. When it is necessary to use classes from two different frameworks
d. When we have several algorithms for solving a problem, and the choice
implementation is done at runtime
The correct answer is: When we have several algorithms for solving a problem, and
the choice of implementation is made at runtime
 
 
What is the similarity between Command and Adapter?
Choose an option:
a. The construction of objects is managed by a class
b. There are no similarities between the two
c. Both can return to previous states
d. Both use existing features
The correct answer is: Both use existing features
 
States is useful when:
Choose an option:
a. None of the variants
b. It is desired to solve a problem when it is not known exactly who can solve it,
but there is a list of possibilities
c. It is desired to implement the way in which an object changes its behavior based
state in which it is
d. It is desired to implement an algorithm that strictly follows certain steps
The correct answer is: You want to implement the way an object changes
behavior based on the state they are in
 
When is the Observer deign pattern used?
Choose an option:
a. When it is necessary for a subject to notify several observers
b. When it is necessary to use classes from two different frameworks
c. When he wanted to add new functionalities to the existing classes
d. When it is necessary to create a hierarchical structure by composing objects
The correct answer is: When a subject needs to notify several observers
 
In what situations is the Template Method used?
Choose an option:
Backtracking
b. All variants
c. When the processing mode follows a finite number of steps
d. When solving a problem follows a known number of steps
The correct answer is: All options
 
Strategy is useful when:
Choose an option:
a. None of the above
b. It is desired to construct many objects of a class, objects that have a common part
c. It is desired to build a hierarchical structure
d. It is desired to choose the implementation to solve a problem for which there is more
multi algorithms
The correct answer is: You want to choose the implementation to solve a problem for
which there are several algorithms
 
Template is useful when:
Choose an option:
a. It is desired to solve a problem when it is not known exactly who can solve it,
but there is a list of possibilities
b. It is desired to disconnect the client from the one who executes an action
c. None of the variants
d. It is desired to implement an algorithm that strictly follows certain steps
The correct answer is: We want to implement an algorithm that follows strictly certain
steps
When is the Chain of Responsibility design pattern used?
Choose an option:
a. When an algorithm is known and follows certain precise steps
b. When it is necessary to create a hierarchical structure by composing objects
c. When he wanted to add new functionalities to the existing classes
d. When there is a list of possible objects that can solve the problem
The correct answer is: When there is a list of possible objects that can solve the problem
 
What can the Memento design pattern be used for?
Choose an option:
Model View Controller
b. Avoid using the switch or if-else structure
c Backtracking
d. Making backups
The correct answer is: Backing up
 
Who are the participants in the Template Method?
Choose an option:
a. Template, ConcreteTemplate
b. Template, AbstractTemplate
c. Template, ConcreteTemplate, ConcreteClass
d) ConcreteTemplate, ConcreteClass
The correct answer is: Template, ConcreteTemplate
 
OTHER GRIDS
Builder can be correlated with: The correct answer is: Singleton
When can AbstractFactory be implemented? The correct answer is: When creating two or more
types of objects each with a method
What is the role of their creative design pattern? The correct answer is: Helps initialize and
configure classes and objects
Which design pattern offers the possibility to create concrete objects from a family of
objects? The correct answer is: Factory
The participants of the Protype pattem design are The correct answer is: Prototype interface,
ConcretePrototype
What is the type of Singleton-Eager initialization? The correct answer is: initialize the court even
if it is not used
What is the role of the Abstract Factory design pattern? The correct answer is: Introduce a new
level of abstraction
Which of the following are implementation types for Singleton? The correct answer is: Eager
initialization, Lazy initialization, Thread Safe Singleton
Which of the following are creative design patterns? The correct answer is: Singleton, Prototype,
Factory
How is Abstract Factory implemented? The correct answer is: An object is created and for each
object there is a method.
For what purpose do we use the creational prototype design pattem? The correct answer is: to
create clones for objects that take a long time to build or consume a lot of resources
Factory is useful when: The correct answer is: There is a family of objects in an application
What is the correlation between Factory and Composite The correct answer is: Container nodes
are created through the factory
Which version of Singleton's implementation involves initializing the instance at runtime,
without encountering problems when using multithreading? The correct answer is: Thread Safe
Singleton
What kind of design pattern helps to create concrete objects? The correct answer is: Builder
Which statement about Abstract Factory is true? The correct answer is: Abstract Factory
introduces a new level of abstraction
Which of the following statements is true about Builder? The correct answer is: It involves
creating complex objects by specifying certain desired properties from the existing set
When to use Builder? The correct answer is: To build complex objects with many attributes
How can the Factory design pattern be correlated with the Singleton design pattern? The correct
answer is: the factory can be unique
Which of the following are design patterns - creational? Correct answer: Singleton, Builder,
Factory
 
Prototype is useful when: Choose an option:
a. Whenever we use clones ^
b. When the created objects do not look alike at all
c. Only if there is no donation
d. Never use Prototype
The correct answer is: Whenever we use cl one ()
 
Who are the participants in the Design Pattern Factory? Choose an option:
a. concrete classes, the factory that will create concrete objects
b. abstract interface / class, concrete classes
c. the abstract interface / class, the concrete classes, the factory that will create the concrete
objects ^
d abstract interface / class, the factory that will create concrete objects
The correct answer is: the interface / abstract class, the concrete classes, the factory that will
create the concrete objects
 

Who are the participants in the Prototype design pattern? Choose an option:


Prototype, ConcretePrototype
b.Singleton, Prototype, Abstractprototype
c Prototype, AbstractBuilder, AbstractProtoype
d) Prototype, Abstractprototype, ConcretePrototype
The correct answer is. Prototype, ConcretePrototype
 
How are creative design patterns defined? Choose an option:
a. controls the complex relationships between classes
b. helps create families of objects
c. helps to initialize and configure classes and objects
d. helps to compose and configure classes and objects
The correct answer is to help initialize and configure classes and objects
 

 
Who are the participants in the Prototype design pattern? Choose an option:
a Prototype, Abstract Prototype, Concrete Prototype
b Prototype Factory, Prototype
c Prototype, Virtual Prototype, Concrete Prototype
d Prototype, Concrete Prototype The correct answer is: Prototype, Concrete Prototype
 
Which of the following is a Singleton type? Choose an option:
a List of Singleton
b Thread Safe Singletoy
c) Singular Initialization
d Unic Initialization
The correct answer is: Thread Safe Singleton
 
Which of the following design patterns can be used when creating new objects by copying an
existing object? Choose an option:
a.Factory Method
b) Abstract Factory
c. Builder
d Prototype
The correct answer is: Prototype
 
An insurance application offers, in addition to taking out compulsory insurance, the possibility of
taking out health insurance, travel insurance and private pension insurance if the user so
wishes. What design pattern is found in this situation? Choose an option:
a Prototype
b) Factor
c. Singleton
d. Builder
The correct answer is: Builder
 
Which of the following is a usage example for Singleton? Choose an option:
a. Accessing mobile device resources
b Single database connection
c. DocumentBuilderFactory from Android
d All variants of suy
The correct answer is: All of the above
 
Which design pattern ensures the creation of a single object of a certain class?
Choose an option:
a Proxy
b. Singleton
c) Prototype
d Builder
The correct answer is. Singleton
 
Which of the following is considered the most correct type of Singleton? Choose an option:
a Lazy initialization
b Eager initialization
c) Inner static helper class
Thread Safe Singleto
The correct answer is: Thread Safe Singleton
 
Factory is used: Choose an option:
a to help create complex objects with many attributes
b to create objects from a class family ^
c. to create a single instance for a class and has the private constructor
d when creating an object consumes a lot of resources A prototype is created and used for
donation
The correct answer is: to create objects from a class family
 
Which of the following statements is true about Abstract Factory? Choose an option
a. Each factory will create a single object type
b. Simplifies the interface of a class family
c. It has as participant the concrete factory and the concrete classes
d. Introduces a new level of abstraction from the Factory Method
The correct answer is: Introduce a new level of abstraction from the Factory Method
 
What is the Singleton-Thread safe Singleton type? Choose an option
a. initialization of the court even if it is not used
b. assumes that the method will not be called by another thread until the method already called
on an executive thread is completed
c contains a class nested in the Singleton class
d. the most implemented Singleton variant
The correct answer is: assumes that the method will not be called by another thread until the
method already called on a thread is completed
 
What is the similarity between Prototype and Composite? Choose an option:
a Items on the same level cannot be donated
b Items on the same level can be donated
c. There is no donation
d No items can be donated
The correct answer is: Items on the same level can be donated
 
Who are the participants in the design of the Singleton scheme? Choose an option:
at Concrete Singleton
b Abstract Singleton
c. Singleton
d Singleton Factory
The correct answer is: Singleton
 
Which of the following statements about Eager Initialization is correct? Choose an option:
a. The court is never initialized
b. None of the above
c. It involves the initialing of the court even if it is not used
d. The initialization of the court is performed only if it is used
The correct answer is: It involves the initialization of the court even if it is not used
 
What is the difference between Factory Method and Simple Factory? Choose an option:
a. There are no differences between the two
b. None of the above
c. in Factory Method enum is no longer used, but abstracts the level of creation
d. in the Factory Method enum is used, no new level of abstraction is introduced
The correct answer is: in Factory Method enum is no longer used, but abstracts the level of
creation
 
Which of the following statements is true about Factory? Choose an option:
a. It is a creative design pattern
b. The client has the possibility to create concrete objects from a family of objects, without
knowing exactly the concrete type of the object
c. All the above variants
d. Objects are created using a common interface
The correct answer is: All of the above
 
What is the correlation between Factory and Singleton? Choose an option:
a. The items are donated
b. The factory can be unique
c. There is no correlation
d. The connections between classes
The correct answer is: The factory can be unique
 

Which of the following creative design patterns help create complex objects with many
attributes? Choose an option:
a. Singleton
b) Prototype
c. Factory
d Builder
The correct answer is: Builder
 
Which of the following statements is true about Singleton? Choose an option:
Singleton adheres to the principles of object-oriented programming
b. A Singleton object cannot be sent as a parameter to a function
c. Singleton is used to implement an abstract class
d. It does not involve the extension of a classic
The correct answer is: Singleton adheres to the principles of object-oriented programming
 
Who are the participants in the design of the Prototype pattern? Choose an option
a. Interface and method of copying and donating
b. Concrete class and interface
c. Donation interface and classes
d. Concrete classes
The cored answer is: Interface and method of copying and cloning
 
Factory is recognized by the phrase: Choose an option:
a. Creating concrete objects
b. Creating clones for objects
c. A single court
d. Objects from the same family
The correct answer is: Objects from the same family
 
What does Thread safe Singleton entail? Choose an option:
a Ensures that the method will not be called by another thread until the method already called on
one thread is completed /
b. The method can be called from another thread even if the method already called on one thread
is not completed
c. None of the above
d All of the above
The correct answer is: Ensures that the method will not be called by another thread until the
method already called on a thread is completed
 
Represents the use of the Singleton pattem design: Choose an option:
a. When created objects resemble each other and creating an object takes a long time or
consumes a lot of resources
b. Opening a single instance of an application /
c. Creating GUI views
d Existence of a family of objects in an application
The correct answer is: Open a single instance of an application
 
It's Singleton type: Choose an option:
Template Method ®
b. Thread Safe Singletoi /
c Virtual Builder
d) Chain of Responsibility
The correct answer is: Thread Safe Singleton
 
How many participants are in the Prototype design pattern? Choose an option:
a.4
b.8
c.3
d.5
 
What is the relationship between Prototype and Decorator Choose an option:
a Items on the same level can be donated
b A number of objects can be stored
c. The construction of an object is centralized
d Clone objects and then modify
The correct answer is: Clone the objects and then modify them
 
Which of the following statements is true about the Factory Method design pattern? Choose an
option:
a Has the same participant as Simple Factory
b. Switch or if-else structures are used to choose which objects will be created
c. It does not use enum, but abstracts the level of creation
d Concrete objects are used for the call
The correct answer is: Do not use enum, but abstract the level of creation
 
GRILLE BOJA 2021
 
What naming convention does the Arithmetic mean name? Choose an option:
Apps Hungarian Notation
lowerCamelCasy
Hungarian Notation System
UpperCamelCase
 
What naming convention is used to name classes and interfaces: Choose an option:
Hungarian Notation System
none of the options
lowerCamelCase
UpperCamelCase
 
 
When is the DRY principle applicable? Choose an option:
None of the options is correct;
Whenever we give Copy / Paste a piece of code /
Whenever we write methods that are not necessary yet;
Whenever we want a method to do everything;
 
What does the DRY principle entail? Choose an option:
Applicable whenever we want a method to do everything
Applicable whenever we give Copy / Paste to a piece of code or when two methods do the
same lucryr
Applicable whenever we write methods that are not needed yet (may never be needed )
None of the above
 
Which of the following are clean code rules in methods? Choose an option:
will always try to get out of service as soon as possible
Any method is recommended to have at most three levels of nested structures ;
All variants are correct;
The variables will be declared as close as possible to their use ;
 
 
Which of the following is a Clean Code rule in the comments? Choose an option:
Avoiding introductory comment blocks /
It is not recommended to use comments for TODO comments;
Comments are not indicated for libraries that will be reused by other programmers ;
Commenting unused code ;
 
What does Bad Code mean? Choose an option:
Don't be misled
Independent of other code sequences
It breaks when we change it
Easy to read and understand
 
Which of the following are the principles of CleanCode? Choose an option:
DRY;
SOLID;
YAGNI;
All options are correct ^ /
 
 
Which of the statements is true? Choose an option:
Objects should not be forced to implement unnecessary methods
A class must have only one responsibility
All variants
Classes must be open for extensions, but closed for changes
 
 
Which of the following principles is derived from KISS ? Choose an option:
SOLID
DRfc
None of the options is correct
YAGNI  
 
 
The Open-Close principle presupposes . Choose an option:
Classes must be open for extensions and closed for modification /
Failure to repeat pieces of code
Classes must be closed for extensions and open for changes
A class must be responsible for one aspect
 
 
Which of the following are the rules for writing source code? Choose an option:
The closing bracket of an instruction body is the only one on the line;
All options are correct /
Instruction blocks are also marked by identification ;
Code blocks start with {and end with};
 
 
What does the principle of Single Responsibility entail? Choose an option:
Multiple customizable interfaces are always preferable to a single general interface ;
Classes must be open for extensions, but still closed for changes;
A class must always have only one responsibility and only one /
Objects can be replaced at any time by instances of derived classes without this
affecting functionality;
 
 
Among the benefits of complying with the KISS principle are: Choose an option:
easy solving of complex problems
all variants are corrective
the written code is more flexible
making products easy to maintain
 
Which of the following statements about YAGNI is true? Choose an option:
It is derived from KISS  
It involves writing methods that are not necessary
Use interfaces
It is known as "Design by Contract"
 
What is the principle by which it is not recommended to write 2 methods that do the same
thing? Choose an option:
DR Y
YAGNI
KISS
None of the above
 
What does Clean Code entail? Choose an option:
The code should be easy to change
All variants
The code should be easy to read
The code must be easy to understand
 
Objects can be replaced at any time by instances of derived classes without affecting
functionality. What is the principle? Choose an option:
Liskov substitution (LSP)
Investment dependency
Single Responsibility (SRP)
Open-Closed (OCP)
 
Which of the following is not a good practice in writing source code? Choose an option:
Instruction blocks are marked and the indentation
The parameters are separated by commas and spaces
Lines are separated by any number of methods goal ^
The closing brace of an instruction body is the only one on the line, except when we have if-else
or try-catch
 
What does Clean Code mean? Choose an option:
All variant ^
The code must be easy to understand
The code should be easy to change
The code should be easy to read
 
 
What does Code Review mean? Choose an option:
Working in pairs of programmers for tasks complex
Testing Automatic to Code on the basis of cases of use
Review any piece of code written by another programmer
Rewrite the code in a way that better adapts to the new specifications
 
What is the principle of OCP (Open-Closed) based on? Choose an option:
All the above options
A class must always have only one responsibility and only one
None of the above
A class must be open for extensions and closed for modification
 
What is the Interface Segregation principle ?
Choose an option:
Class 0 must be open for extensions and closed for changes
The class must always have only one responsibility and only one
Objects can be replaced at any time by instances of derived classes without affecting
the functionality
Multiple customizable interfaces are always preferable to a single general interface '
 
When the same piece of code is found in two methods, the principle was violated: Choose an
option:
YAGNI
DR Y
CMO
KISS
 
The principle also known as Design by Contract is: Choose an option:
Interface segregation
Investment   dependency
Single responsibility
Liskov substitution
 
What is the violation of the YAGNI principle? Choose an option:
In copying pieces of code and integrating them into multiple areas of an application
In writing multi -purpose methods
None of the above
In writing methods that are not necessary ^
 
 
The SOLID-specific Open-Closed principle assumes Choose an option:
several specialized interfaces are preferable at the expense of a single general interface
classes can be easily extended ^
classes can be changed easily
 
 
Which of the following is not a feature of CleanCode? Choose an option:
The code must be easy to read;
The code must be easy to change;
The code must be easy to understand;
The code must be closely related to other codz sequences
 
 
Which of the following principles is derived from the KISS principle? Choose an option:
DRY
SOLID
YAG NI
None of the above
 
What is the One screen rule? Choose an option:
The variables will be declared as close as possible to their use
Avoiding very long methods (over 20 lines of codX
will always try to get out of service as soon as possible (by return or exception)
Avoiding methods with more than 2 parameters
 
Which of the following is not a simple Clean Code rule for methods?
Choose an option:
Delegation through pointers / interfetex
Single responsibility
Avoiding interfaces;
Keep It Simple and Stupid;
 
Interface Segregation Principle refers to:
Choose an option:
Classes must be open for extensions
Multiple customizable interfaces are always preferable to a single general interface
Objects can be replaced at any time by instances of derived classes without affecting
the functionality
A class has only one responsibility
 
 
What does System Hungarian Notation entail? Choose an option:
None of the mentioned options *
Enter the names of the variables in the form of a question
The module from which the variables come in their name is introduced
Enter the type of variables in their name
 
 
What is the principle of SRP (Single Responsibility Principle) based on? Choose an option:
All the above options
A class must always have only one responsibility and only one
A class must be open for extensions and closed for changes
None of the above
 
 
The DRY principle is violated when:
Choose an option:
We write methods that are not necessary
Two methods are written that do the same work
A class has only one responsibility
Objects are replaced with instances of derived classes
 
 
What is the Single Responsibility Principle? Choose an option:
A class can only be called once
A class must be written by only one person
A class can only have one court
A class must always have only one responsibility and only one ^
 
 
What does the open-closed principle refer to? Choose an option:
Open for changes, closed for extensions
Open for extensions, closed for changes
None of the above
Open for modifying and adding interfaces, closed for extensions
 
 
The naming convention in which the date type of the variable is mentioned is:
Choose an option:
It does n't exist
Upper camei case
Lower camei case
Hungarian Notation
 
 
What Clean Code rules apply within conditional structures? Choose an option:
Direct instantiation of Boolean variables
Avoid comparisons with true and false
All variants
Use of the ternary operator whenever possible
 
 
What does the Open-dosed (OCP) principle entail? Choose an option:
It is also known as Design By Contract
Any change in specifications leads to the uselessness of the class and the rewriting of the
entire code
Classes must be open for extensions, but still closed for modification ^ * '
A class must always have only one responsibility and only one
 
 
An example of a class named after the UpperCamelCase naming convention is: Choose an
option:
passport person
passportPerson
passportLegal person
PassportPersonany
 
 
L of SOLID represents:
Choose an option:
Liskov inversion
Liskov responsibility
Liskov substitution
Liskov segregation
 
 
 
The rules of Clean Code in the comments are:
Choose an option:
The well-written code is self-explanatory
Use comments to apologize
All variants
No variant
 
 
Which of the statements is correct? Choose an option:
functions should not have more than 3 arguments ^
functions should do more things
comments are written to prove a point of view
the class name should be a verb
 
 
Which of the following variables respects naming conventions? Choose an option:
float query Performed;
boolean temperatureCamera = true;
boolean is Present = true
int insertvarsta;
 
 
What is the violation of the KISS principle?
Choose an option:
In writing methods that are not necessary
In copying pieces of code and integrating them into multiple areas of an application
In writing multi -purpose methods
None of the above
 
 
What clean code rules are used to write comments? Choose an option:
Using comments for libraries that will be reused by other programmers (doc comments) or for
TODO comments
Commenting unused code
Using comments to make a method readable
Using introductory comment blocks
 
 
What does the Liskov Substitution principle entail? Choose an option:
Classes must be open for extensions, but still closed for changes;
Multiple customizable interfaces are always preferable to a single general interface ;
Objects should not be forced to implement methods that are not useful;
Objects can be replaced at any time with instances of derived classes without affecting
the functionality /
 
 
When is the KISS principle applicable? Choose an option:
Whenever we write methods that are not necessary yet;
Whenever we want a method to do everything /
Whenever we give Copy / Paste to a piece of code;
Every time we write two methods that do the same thing;
 
 
What is one way to break the KISS (Keep It Simple and Stupid) principle? Choose an option:
Writing methods are not necessary
One method performs multiple tasks /
Copy / paste some pieces of code
Several methods are written that perform the same task
 
 
 
 
KISS (Keep it simple and stupid) is violated when you choose an option:
one method has too much functionality /
several functions do the same thing
we repeat the code
 
 
What is Automatic Testing (Unit Testing)? Choose an option:
The procedure that requires that any piece of written code be reviewed by another programmer;
The technique by which programmers work in pairs for complex tasks to avoid code review;
Rewriting the code in a way that better adapts to the new specifications;
Automatic code testing based on use cases /
 
 
Which of the following is not a naming convention? Choose an option:
Hungarian Notation System ;
UpperCamelCase;
Apps Hungarian Notatiorx
CapitalizationCamelCase;
 
 
 
When is the use of comments indicated? Choose an option:
ToDo comment ^
For pieces of unused code
At the end of a method
At the beginning of a method
 
 
What does Bad Code mean? Choose an option:
The code breaks when modified;
Hard to read and understand code ;
The code has dependencies in many external modules ;
All options are correct /
 
 
Comments Choose an option:
They are indicated only if they are of type TOD ^
They should be used to explain what functions do
There must be many in the code
They are used for apologies
 
 
What does the word Open refer to in the Open-Closed principle? Choose an option:
Open for substitution
No option is correct
Open for extension
Open for modification
 
 
Test Case is:
Choose an option:
O a. No correct answer
O b. A test run tool
c. A class that defines the set of objects (fixture) to run multiple tests ^
O d. A collection of test cases
 
In what forms is WhiteBox Testing also known? Choose an option:
© a. All variant ^
b.Clear Box Testing
c) Structural Testing
d) Open Box Testing
 
What are the advantages of unit tests? Choose an option:
© a. All variant ^
b) test suite can be defined
c. respect the write once, use many times principle
d. can be written ad-hoc as needed
 
 
Which of the following are types of testing? Choose an option:
BlackBox Testing;
b) WhiteBox Testing;
c) Integration Testing;
© d. All variants ^
 
 
 
Which of the following statements about jUnit is false? Choose an option:
It is a framework that allows the realization and running of tests for different methods within
the developed projects .
© b. XUnit is an adaptation to jUni ^
c. JUnit works according to two design patterns: Composite and Command.
d. jUnit is the most used framework for unit testing of code written in JAVA.
 
 
According to which Design Patterns does JUnit work? Choose an option:
Interpreter & amp; Iterator
b) Composite & amp; Interpreter
c. Bridge & amp; The Builder
© d Composite & amp; Command
 
 
 
Fixture represents: Choose an option:
A method / step for defining the set of objects used prior to testing A
b. A tool for displaying results
O c. A class that defines the set of objects
@ d. A set of objects used in the text ^
 
 
What is Teardown? Choose an option:
O a. A set of objects used in the test;
A tool for running tests (test suites) and displaying results;
A method / step of defining the set of objects used (fixture), before testing;
A method / stage of destruction of objects (fixture) after completion of tests
 
 
How has the annotation @Before changed from JUnit4 to JUnit5 - Jupiter? Choose an option:
O a. @BeforeEverything
© b. @BeforeEac h
c. @BeforeAII
O d. It hasn't changed
 
 
What is a Test Runner? Choose an option:
® a. Test running tool /
b. The class that defines the set of objects to run multiple tests
c. A method of destroying objects after running tests O
d. Set of objects used in the test
 
 
 
Open Box testing is also known as: Choose an option:
O a. Recovery Testing O a
b BlackBox Testing
© c. WhiteBox Testing O
d. No answer
 
 
Which of the following is an annotation for the structure of a JUnit5-Jupiter test? Choose an
option:
A @BeforeClass              
b. @AfterClass;              
c @AfterEach; ????
d. @After;
 
 
 
WhiteBox testing is also known as: Choose an option:
a. Structural testing O
b) Open Box Testing O
c) Glass Box Testing
d. All answers are correct ^
 
 
Which of the following is an advantage of BlackBox testing? Choose an option:
The tests are performed from the user 's point of view ^ /
The tests will have a small number of entries
The tests may be redundant with other tests performed by the developer
The tester does not have the application specifications
 
 
Which of the following is an annotation used in jUnit4 for automatic skeleton methods?
Choose an option:
a. @ Before /
b. @SetUpBefore.
c. @AfterClass.
d. setllpBeforeClass ().
 
 
BlackBox testing is also called:
Choose an option:
Glass Box Testing
Behavioral testing ^
Open Box Testing
Structural testing
 
 
During BlackBox testing, the tester knows: Choose an option:
Internal architecture of the tested application
Advanced programming techniques
Application input and output data ^
Number of bugs in the application code
 
 
What is the equivalent of annotating @Before from JUnit4 to JUnit5-Jupiter? Choose an option:
a. @BeforeClass;
b. @BeforeEac h              
c. @BeforeAII;
d. None of the variants is correct;
 
 
 
Which of the following are features of JUnit? Choose an option:
a. It is a framework that allows the realization and running of tests for different methods within
the developed projects ;
b. All variants are correct ^
c. JUnit works according to two design patterns: Composite and Command;
d. It is the most used framework for unit testing of code written in JAVA;
 
 
What method is the @BeforeClass annotation used for? Choose an option:
The tearDown ( ) method ;
The b method tearDownAfterClass (); A
c) setUp () method;
® d. SetUpBeforeClassț method ^
 
 
Which statement is correct about unit tests? Choose an option:
® a. Based on them test collections can be defined ^
b. Does not influence the number of bugs in the delivered or integrated code
c. Hard to write
d. They can be run only once
 
 
What is the annotation used in JUnit4 for the tearDownAfterClassO automatic skeleton method?
Choose an option:
a. @BeforeClass
b. @Before
c. @ AfterClas ^
d. @After
 
 
Which of the following are reasons to use unit tests? Choose an option:
a. Reduce the time lost for debugging and finding bugs;
© b. All variants are correct ^
c. The tests are easy to write;
d. Tests can be run automatically whenever needed;
 
 
What is the advantage of WhiteBox testing? Choose an option:
a. It is performed from the user's perspective
b. It does not require knowledge of the input and output data of the application
c. It can be performed at a stage prior to the commissioning of the application /
d. Does not require in-depth programming knowledge
 
 
 
What is Test Case? Choose an option:
A class that defines the set of objects (fixture) to run multiple tests /
A tool for running tests (test suites) and displaying results;
A collection of test cases;
d. A set of objects used in the test;
 
 
What is BlackBox Testing? Choose an option:
Testers do not know the internal architecture of the tested application
© b. All variant ^
c. The tester knows only the input data and the output data of the application d. It is also called
behavioral testing
 
 
What is the concept of Setup? Choose an option:
A class that defines the set of objects (Fixture) to run multiple tests
A method / step of defining the set of objects used (Fixture) before testing
A method / stage of destroying objects (Fixture) after completion of tests d. A set of objects used
in the test
 
 
What is fixture? Choose an option:
A a. Test running tool
b. collection of test cases
c. the class that defines the set of objects to run multiple tests
® d. Set of objects used in the text ^
 
What is Teardown? Choose an option:
O a. It is a test running tool.
It is a method of destroying objects after testing
It is a method of creating new objects after completing the tests.
It is a class that defines a set of objects to run multiple tests.
 
 
Which of the following information about BlackBox Testing is true? Choose an option:
© a. The tests are performed from the user 's point of view ^ /
b. It is also known as Transparent Box Testing
c. The interface does not have to wait for the test to be performed
d. The tests will have a large number of entries
 
 
What is fixture? Choose an option:
The method of defining the set of objects used before testing
A method of destroying objects after running tests
c. Collection of test cases
® d. Set of objects used in the text t
 
 
 
Which of the following annotations for the structure of a test is not present in JUnit 4? Choose an
option:
a. Before
b AfterClass
c) AfterEac h
d BeforeClass
 
 
What is testing? Choose an option:
a. None of the variants
b. It is used to signal the presence of defects
c. Guarantees the absence of defects
d. The process of modifying errors and defects
 
 
Regarding the BlackBox Testing, the following option is correct . Choose an option:
a) No variant
b. All variants ^
c. It is a method used to test the software application by people who do not know the internal
architecture of the tested application
d. The tester knows only the input data and the output data of the application
 
 

BlackBox testing Choose an option:


© a. All variant ^
b. It is used in the conditions in which the tester knows only the input and output data of the
application
c. It is used so that people who do not know the internal architecture of the application can test it
d. It is also called behavioral testing
 
 
Which of the following is a disadvantage of WhiteBox testing? Choose an option:
a. Testing may be started at a stage prior to commissioning;
b. Testing is more in-depth, with the possibility of covering most possibilities;
c. Highly qualified resources are needed, with an in-depth knowledge of programming
and implementation ^
d. The tests may be redundant with other tests performed by the developer;
 
 
Teardown Choose an option:
a. None of the variants
It is a method of destruction of objects used after testelo r
It is a method of defining objects used before testing
d. It is an object used in the test
 
 
If we want to test the equality of two objects, what kind of assertion do we use? Choose an
option:
assertTrue              
b. assertSame
c. assertEqual s
fail
 
JUnit: Choose an option:
© a. All answers are correct
b. Represents an adaptation from xUnit
c. It is a framework that allows the realization and running of tests for different methods within
the developed projects
d. It is the most used framework for unit testing of code written in JAVA
 
 
What is JUnit? Choose an option:
a) No variant
b. Represents an adaptation from JsUnit
c. All variants
d. It is a framework that allows performing and running tests for different methods from
within the developed projects ^
 

Which of the following is an advantage of BlackBox testing? Choose an option:


The tester does not need to know programming, the language used for development or the code
structure of the application /
Testing is more in-depth, with the possibility of covering most possibilities;
c. The tests will have a small number of entries;
d. Testing may be started at a stage prior to commissioning;
 
What is Test Case? Choose an option:
a. Set of objects used in the test b. Collection of test cases
c. The class that defines the set of objects to run multiple tests ^
d. The method of defining the set of objects used before testing
 
 
What does Unit Testing entail? Choose an option:
a. It is performed in a well-defined context in the test specifications              
b . All variants    ????
c. None of the variants
d. A way to test the code by programmers from the software development stage
 
 
Which of the following methods is the @After annotation used for? Choose an option:
a. tearDownAfterClass method);
b) setl method) pBeforeClass ();
c. setUpț method );
d tearDown () method
 
 
Junit Choose an option:
It is a testing framework
None of the options
c. It is a case test
d. It is a test suite
 
 
 
 
 
 
 
 
 
 
 
GRILL CODE
????? If you want to test your own Fibonacci function (based on the algorithm fib (n) = fib (n-1)
+ fib (n-2)) using the following function, what test strategy do you use?

 
a) Inverse relationship     
b) Conformance     
c) Cross-check     
d) Error condition    
 
Implement the Product class that contains the quantity attribute. The attribute accepts values
between 5 and 100 (including these 2 values). To allow customers to change the product
quantity, implement the setQuantity (int value) method. The method should validate the input
value. If you are implementing the following test, what values should you use for "X" if the test
is a BOUNDARY type? Choose one or more options.   testSetQuantity ()

a) 6     
b) 5     
c) 100     
d) 4    
e) 99     
f) 101      
 
 
Implement the Product class that contains the quantity attribute. The attribute accepts values
between 5 and 100 (including these 2 values). To allow customers to change the product
quantity, implement the setQuantity (int value) method. The method should validate the input
value. If you are implementing the following test, what values should you use for "X" if the test
is a RIGHT test? Choose one or more options. testSetQuantity () 

a) 4     
b) 101     
c) 5    ????     
d) 6    
e) 100    ???     
f) 99      
 
If we test the isFibonacciNumber () method with the value 8 and obtain the TRUE result, we
perform a ____________ type test (choose the correct option) perfectSquare

a) Error condition     
b) Performance     
c) Cross check     
d) R ight    ????    
 
 
To perform an Error conditions test for the isFibonacciNumber () method, we must use the
value testSetQuantity ()
a) 4    ????     
b) 0   ???     
c) 3     
d) 2    
e) 1     
 
For a RIGHT test, if we call the next method with the value 4 (where 4 represents an index), do
we expect to receive the value? getFibonacciNumber

a) 3   ????   if we start from 0     


b) 5 ??? if we start from 1     
c) 1     
d) 2    
e) 4     
 
 
  
To perform an ORDERING test for the next method do we have to call it with the following
values? getFibonacciNumber
a) 2 3 4     
b) 1 1 2 ???     
c) 1 1 4     
d) 1 1 3    
 
Implement the Product class that contains the quantity attribute. The attribute accepts values
between 5 and 100 (including these 2 values). To allow customers to change the product
quantity, implement the setQuantity (int value) method. The method should validate the input
value. If you are implementing a unit test, what values should you use as the input for
setQuantity () for a RANGE test? Choose one or more options
a) 5     
b) 100     
c) 6     
d) 4    
e) 99     
 
If we perform a test for the getFibonaciiNumber () method with the value 2, we perform a test of
type ______ 

a) Right   ???     
b) Cross check     
c) Error condition     
d) P erformance    
 
Given the next implementation. What Clean Code principles (choose one or more) have been
used here?   perfectSquare

Choose one or more options:


a. KISS
b. DRY
c) Single Responsibility
d) Open-Closed
e. WET
f. Liskov
g One Screen function
 
 
 
 
 
 
 
 
 
 
Which lines contain "Magic Numbers"? (Multiple choice)

Choose one or more options:


a .there are no "magic numbers" in the given source code
b 33- not sure what is 1
c 32- not sure what: 1, 5, 6, 7, 10 is for.
d 35- loop counter 5    ??
e. 37- sum * i
 
 
 
ENGLISH GRILL TEST
What annotations from the following do you use within your JUnit Test class in JUnit 4? Choose
an option:
a. @TestClass, @TestMethod
b. @Before, @After, @Test
c. @TestTest, @TestThis
d. @BeforeTest, @AfterTest
 

What is test-driven development (TDD)?


Choose an option:
TDD does not require unit tests to be written
b) First the code is implemented and then tests are written.
c) Software testers do the development in TDD
d) The Tests are normally written before the Code
Which of the following patterns are Structural (choose one or more right answers)?
Choose one or more options:
a. Proxy
b) Adapter
c. Factory
d) State
e. Decorator
f. Builder
Mr. Singleton
h. Facade
 
To implement a universal compression / decompression system, that will support different
formats, which design pattern can be used?
Choose an option:
a.Adapter
b. Decorator
c) Facade
d. Singleton
e. Strategy   ??
 
If you want to implement a solution that generates expensive objects (creation time and used
memory), which pattern offers the optimal solution so that the repetitive creation processes are
minimized?
Choose an option:
a. Builder
b) Factory
c) Prototype
d. Flyweight ??? 
e. Singleton
 
To add new functionalities to an object without changing the implementation / definition of the
class, which design pattern will you use?
Choose an option:
a. Facade
b.Builder
c. Decorator
d) Adapter
e. Prototype
 

If you want to create a solution that allows you to use a single instance for a class so that the
resource / event is managed centrally, the most appropriate GoF pattern is?
Choose an option:
a. Singleton
b) State
c) Memento
d) Proxy
e. Prototype
 
 
A smart-home system, with different sensors installed in the house, requires the implementation
of a mobile solution, for different platforms, that will receive messages from available sensors
and trigger different notifications on the client GUI. What is the right design pattern for this
functionality:
Choose an option:
a. Facade ??? 
b. Singleton
c. States
d) Observer   ???
e. Adapter
f. Strategy
 
??????????? What are some of the benefits of unit testing?
Choose one or more options:
Can improve the design of code, especially if using Test Driven Development (TDD)
b) Makes it easier to change / refactor code.
c) Reduces the level of bugs in production code.
d) Simplifies integration testing
e. Unit tests are a form of documentation.
What's the correct difference between an Adapter pattern and a Decorator?

Choose an option:
The Adapter is Structural, and Decorator is Creational
b) There are no differences between the two concepts, Decorator being an alias for the Adapter
c) Adapter is used to modify the functionality of an existing class and Decorator adds new
properties
d) The Adapter does not add new functionality, but Decorator extends the functionality of the
object
An image viewer application that supports various formats (jpeg, gif, bmp, etc.) is required. The
application can be extended to generate other formats in the future. What is the right pattern
design that will help you manage future development efficiently:
Factory
 

A pattern design represents


Choose an option:
a) A universal solution to most problems in OOP
b) A data structure used in OOP
c) An algorithm used in OOP
d) A solution to a common problem in OOP
e) A scheme for a particular type of class
 
Select one or more options that represent the differences between Prototype and Flyweight
Choose one or more options:
a . Prototype is used to optimize object creation
b. through Prototype, the creation of objects is done by cloning, and the Flyweight, objects
is reused 
c) Prototype type is Creational and Flyweight is Structural
d) Prototype is about optimizing the speed of creating objects and Flyweight is about optimizing
the memory necessary to store objects
e) Prototype is Structural and Flyweight is Creational
f) Flyweight helps the client to clone initial objects and Prototype handles the creation of those
objects

 
The following scenario is considered.
You develop an online solution for a company that offers for rent to its customers different
vehicles categories: cars, motorcycles and vans.
Fleet structure data is stored uniquely at solution level and can be queried by clients.
Clients can check the details for each vehicle. The component that delivers this description
presents for each selected vehicle details depending on the state in which it may be: defective,
available or rented.
What design patterns (one or more) are suitable to be used to implement the presented scenario.
 
Choose one or more options:
a. Composite
b) Strategy
c. Builder
d. Factory
e Flyweight
f. State
g. Singleton
 
If you want to create a solution that allows you to use a single instance for a class so that the
resource / event is managed centrally, the most appropriate GoF pattern is?
Choose an option:
a. State
b) Proxy
c) Prototype
d) Memento
e. Singleton

 
The following scenario is considered. A company produces shirts and sell them
online. Following a customer survey, the company decided to add additional items such as the
customer’s monogram, color, size, branding, etc. What design pattern should be implemented to
allow customers to customize their shirts design before ordering them?
 
Choose an option:
a. Builder
b) Strategy
c) Facade
d . Decorator ????  
e. Adapter

 
If you want to implement a solution where all clients that use Class A will have access to the
same type A instance, what GoF pattern will you use?
Choose an option:
There is no need for pattern because the solution is implemented by marking Class A as final
b) Memento is implemented for Class A
c) Flyweight is implemented for Class A
d. Singleton is implemented for Class A
e) There is no need for pattern because the solution is implemented by defining class A as
abstract

 
For the security of a cloud application, it is wanted that when a user logs on, on the server side is
generated one instance of the component, so that it has only one active session. What is the right
pattern design?
Choose an option:
a. Singleton
b) Facade
c. Factory
d) Observer
e. Adapter
f. Proxy

 
What pattern allows you to extend / change the object functionality at run-time?
Choose an option:
a.Adapter
b) Strategy
c. Decorator
d) State
e. Facade
f Composite
 
 
An image viewer application that supports various formats (jpeg, gif, bmp, etc.) is required. The
application can be extended to generate other formats in the future. What is the right pattern
design that will help you manage future development efficiently:
Choose an option:
a. Singleton
b) Facade
c) Adapter
d. Factory
e) Observer

 
???? A web hosting company offers different plans for server rental (standard, professional and
premium). Different hosting services (cloud, SSL, 24/7 support, backup, databases, etc.) can be
added to each plan after the contract has been signed and the service started. What is the design
pattern for implementing an IT solution for order management:
Choose an option:
a.Adapter
b) Factory
c) Facade
d. Singleton
e. Decorator

 
Which of the following concepts is NOT a mandatory component used in defining a design
pattern?
Choose an option:
a) Pattern name
b) The solution provided by the pattern described by diagrams or pseudo-code
c) Implementing the pattern in Java
d) The advantages and disadvantages of the pattern
e) The problem for which the pattern offers a solution

????
What GoF pattern must be implemented if you want to implement a solution that allows the
client to choose at run-time the algorithm / function needed to process a data set. The solution
must allow the modification of the function library but not of the class that manages the data
Choose an option:
a. Decorator
b) Facade
c) Strategy
d) Adapter
e. State
f. Wrapper

 
Which of the following patterns are Structural (choose one or more right answers)?
Choose one or more options:
a.Adapter
b) Proxy
c. Builder
d) State
e. Decorator
f. Singleton
g Facade
h. Factory
 
 
What is a DISADVANTAGE for the Singleton pattern?
Choose an option:
In some situations, a bottleneck for communication or access to resources
b) Centralized management of a resource through a single instance
c Does not allow duplication of instances
d) Strict control of instancing a class - only once   ?
e) Allows the creation of a single object
 
The following scenario is considered. A printing company makes wedding invitations. The
company owns a set of a number of templates used to make subsequent personalized
invitations. What design pattern is recommended to use to optimize the consumption of resources
on memory storage of used objects?
Choose an option:
a. Builder
b) Prototype
c) Strategy
d) Flyweight
e Composite
f. Singleton
g Abstract factory

 
The following scenario is considered: ACME Inc. develops a software solution for a restaurant
so that the waiter can take orders directly on the mobile phone.
The orders are taken from the client and they are created on the spot, being automatically
assigned to the specialized chef on that dish, the ingredients used and other special requirements
of the client.
These details are provided by the application, without the need for the intervention of the waiter
who only selects the required dish. The orders are sent to the chefs at the end of the order for the
respective table, and will be executed according to the degree of load of each chef. What pattern
offers a solution to this problem?
 
Choose an option:
a. State
b) Composite
c) Command
d) Memento
e) Chain of Responsibility

 
If you want to implement a solution where complex objects are built by a mechanism
independent of the actual object making process, so that the client does not know the internal
details of the object, the most suitable GoF pattern is
Choose an option:
a. Builder
b) Factory
c. Decorator
d. Singleton
e. Adapter
 
Your domain contains 3 classes: Enemy, BigEnemy, SmallEnemy. They have the same public
methods. If you create just a SmallEnemy AND NO OTHER TYPE OF ENEMY, how will you
name a variable which stores a reference to a new instance?
Choose an option:
a. smlEmy
b. e
c.smallEnemy
d) enemy
 
 
???? What means "technical debt" in software development
Choose an option:
The level of technical knowledge that software developers lack
b) The future cost of fixing bugs created now
c) The value that exceeds the project budget
d) The difference between different technologies used in the development phase
e) The value that the client should pay for new features, which are added before release

TEST GRIDS
 
The following class hierarchy applies the principle:

a) Design bt contract (liskov)     


b) Kiss     
c) Segregation interface     
d) Single responsibility    
 
Which of the following design patterns implements the Hollywood principle - dont't call us, we'll
call you?
a) Template     
b) Observer     
c) Investment dependence     
 
 
EXAMINATION GRIDS
If the following function is considered, indicate with what values a unitary existence test can be
implemented for which an exception is expected?
E) ArrayList <Integer> input = null 

If the following function is considered, indicate with what values a unit test of type Cardinality =
0 can be implemented ?
a) arrayList <Integer> input = new ArrayList <> ()                                                                                                         
 
 

Given the function for calculating the price of a ticket and the following restrictions:
 Zone takes values in set {1,2,3}
                                                                                                          
 The basic price is positive but less than
                                                                                                          
1000
Indicate which of the method parameters can be used for an Order type test?

e) none of the parameters


 
 
 
 
 
 

Given the function for calculating the price of a ticket and the following restrictions:
                                                                                                           Zone takes values in set {1,2,3}
                                                                                                           The basic price is positive but less than
1000
Indicate which of the following unit tests are considered Boundary for the area?

?????
calculPretBilet (3,700, true)
calculPretBilet ( 2 , 5 00, true)
calculPretBilet ( 0 , 700, true)
calculPretBilet ( 1 , 5 00, false )
calculPretBilet ( 2 , 1 00, false )
calculPretBilet ( 4 , 7 00, false)
Given the function for calculating the price of a ticket, indicate the minimum number of unit
tests (with different combinations of values) that must be implemented to ensure a 100% code
coverage? ?????????

 
Barrier

 
Email email group

Bitmap children

 
 
 
 
 
Glovo / food panda food

Means of passenger transport NFC

 
 
 
 
 
 
Students' school situations remain the coordinating teacher

Given the following diagram that represents a solution that implements a Design Patter, indicate
which one it is?   Facade http://gloriahuston.org/dp/

 
Given the following diagram that represents a solution that implements a Design Patter, indicate
which one it is?  Command http://gloriahuston.org/dp/

 
 
 
 
 
 
 
 
 
 
 
 
 
Given the next class date, select statements (one or more) that describe it correctly
Database Connection
b) ???? i) ????                               

You might also like