
SDA Lab Quiz 3 A & B
Authored by Muhammad Abdullah Nasim
Computers
University
Used 2+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the primary purpose of the Singleton pattern?
To ensure a class has only one instance and provide a global point of access to it
To inherit behavior from multiple classes
To instantiate multiple objects of the same type
To allow runtime object creation with different types
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Singleton s1 = Singleton.getInstance();
Singleton s2 = Singleton.getInstance();
System.out.println(s1 == s2);
true
false
Runtime Error
Compilation Error
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the Factory Method pattern mainly used for?
To enforce inheritance
To allow the creation of objects without specifying their concrete classes
To create a single global object
To serialize objects
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following best explains the advantage of Factory Method over direct object instantiation?
Reduces memory consumption
Increases tight coupling
Avoids constructors
Provides flexibility in object creation
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code?
(Factory Method)
Woof
Meow
Runtime Error
None of these
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the main goal of the Composite design pattern?
To simplify condition checking
To treat individual and composite objects uniformly
To avoid using inheritance
To optimize recursion
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Folder
└── File
Which pattern does this represent?
Singleton
Builder
Composite
Factory Method
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?