The oops moment/3
Quiz
•
Engineering
•
University
•
Hard
Mekha S R
FREE Resource
Enhance your content in a minute
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the primary reason to use defensive copying when returning a list from a class?
To save memory
To prevent external modification of the internal state
To confuse other developers
To automatically sort the list
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
If you return a list directly from a class and another part of your code modifies it, what OOP principle is being violated?
Encapsulation
Polymorphism
Abstraction
Inheritance
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which collection is better if you’re doing frequent insertions and deletions in the middle of the list?
ArrayList
LinkedList
HashMap
Vector
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
A class allows you to borrow books. You now want to borrow multiple books at once. What should you add?
A loop in the main method
A new method like borrowMultipleBooks()
Delete all books
Make the list static
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What helps prevent an object from reaching an invalid state?
Logging everything
Skipping validations
Enforcing business rules
Using only primitive data types
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Why use getters/setters instead of public variables?
They're shorter to write
They confuse the user
They allow control over how variables are accessed/modified
They are required by Java
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does it mean for an object to be immutable?
It can’t be accessed by other classes
It can’t be changed after it's created
It’s slower to execute
It throws exceptions when used
Create a free account and access millions of resources
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
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
10 questions
Quiz-2: Sequential Logic Circuits
Quiz
•
University
14 questions
Python Syntax Quiz
Quiz
•
University
15 questions
Orthographic Projection
Quiz
•
University
15 questions
Quiz T2_Malaysia Practices on Sustainability
Quiz
•
University
10 questions
Solid Waste Management Insights
Quiz
•
University
10 questions
CNS Lab Viva Questions_B2 Batch
Quiz
•
University
11 questions
1.1 - OnShape Overview
Quiz
•
10th Grade - University
5 questions
ECE315_Feedback1
Quiz
•
University
Popular Resources on Wayground
10 questions
Ice Breaker Trivia: Food from Around the World
Quiz
•
3rd - 12th Grade
20 questions
MINERS Core Values Quiz
Quiz
•
8th Grade
10 questions
Boomer ⚡ Zoomer - Holiday Movies
Quiz
•
KG - University
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
Adding Integers
Quiz
•
6th Grade
20 questions
Multiplying and Dividing Integers
Quiz
•
7th Grade
10 questions
How to Email your Teacher
Quiz
•
Professional Development
15 questions
Order of Operations
Quiz
•
5th Grade
Discover more resources for Engineering
10 questions
Boomer ⚡ Zoomer - Holiday Movies
Quiz
•
KG - University
7 questions
Central Idea of Informational Text
Interactive video
•
4th Grade - University
20 questions
Physical or Chemical Change/Phases
Quiz
•
8th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
39 questions
Unit 7 Key Terms
Quiz
•
11th Grade - University
7 questions
Transition Words and Phrases
Interactive video
•
4th Grade - University
18 questions
Plotting Points on the Coordinate Plane
Quiz
•
KG - University
5 questions
Declaration of Independence
Interactive video
•
4th Grade - University
