The oops moment/3

Quiz
•
Engineering
•
University
•
Hard
Mekha S R
FREE Resource
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
Similar Resources on Wayground
15 questions
Quiz Pengelolaan Waktu Proyek

Quiz
•
University
10 questions
Quiz SAP Modul 2

Quiz
•
University
15 questions
ISE1 Construction Quality Control

Quiz
•
University
10 questions
Sensor Selection, Mocro and Nano Sensors

Quiz
•
University
10 questions
Automation and Design

Quiz
•
University
10 questions
C++_1_variables_if_switch_easy_level

Quiz
•
University
15 questions
SQL and Database Concepts Quiz

Quiz
•
University
12 questions
LinkedLists

Quiz
•
University
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Engineering
21 questions
Spanish-Speaking Countries

Quiz
•
6th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
7 questions
Common and Proper Nouns

Interactive video
•
4th Grade - University
12 questions
Los numeros en español.

Lesson
•
6th Grade - University
7 questions
PC: Unit 1 Quiz Review

Quiz
•
11th Grade - University
7 questions
Supporting the Main Idea –Informational

Interactive video
•
4th Grade - University
12 questions
Hurricane or Tornado

Quiz
•
3rd Grade - University
7 questions
Enzymes (Updated)

Interactive video
•
11th Grade - University