The oops moment/3

The oops moment/3

University

10 Qs

quiz-placeholder

Similar activities

UCYPU QUIZ 1 ALD2062 &ECD2052 LAW & CONTRACT

UCYPU QUIZ 1 ALD2062 &ECD2052 LAW & CONTRACT

University

10 Qs

Understanding MOSFETs

Understanding MOSFETs

University

10 Qs

Didáctica en Construcciones Metálicas

Didáctica en Construcciones Metálicas

University

10 Qs

Recap of Sessions 22 & 23

Recap of Sessions 22 & 23

11th Grade - University

10 Qs

Artificial Intelligence

Artificial Intelligence

10th Grade - University

10 Qs

Effective Strategies for Research Papers

Effective Strategies for Research Papers

University

10 Qs

SESSIONAL EXAM(Programmin Lab)

SESSIONAL EXAM(Programmin Lab)

University

15 Qs

MPU&MCU Quiz 1

MPU&MCU Quiz 1

University

10 Qs

The oops moment/3

The oops moment/3

Assessment

Quiz

Engineering

University

Hard

Created by

Mekha S R

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

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

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?