OOP Q7

OOP Q7

University

20 Qs

quiz-placeholder

Similar activities

Round 1 ( RHA Learner Contest )

Round 1 ( RHA Learner Contest )

University

20 Qs

1.1.1 The structure and function of the processor

1.1.1 The structure and function of the processor

11th Grade - University

15 Qs

Python MCQ

Python MCQ

University

20 Qs

Network topologies

Network topologies

8th Grade - University

20 Qs

CIS2303 Week 4_5 Ch_3

CIS2303 Week 4_5 Ch_3

University

18 Qs

Software Engineering Quiz 1

Software Engineering Quiz 1

University

20 Qs

Arduino Loop

Arduino Loop

2nd Grade - University

20 Qs

Python List

Python List

4th Grade - University

15 Qs

OOP Q7

OOP Q7

Assessment

Quiz

Computers

University

Practice Problem

Easy

Created by

Darwin Vargas

Used 9+ times

FREE Resource

AI

Enhance your content in a minute

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

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which keyword is used to achieve encapsulation in Java?

A) private

B) protected

C) public

D) All of the above

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Consider the following class. What is the purpose of the setSpeed method?

A) To set the speed field to any value

B) To restrict setting the speed field to non-negative values

C) To get the value of the speed field

D) To print the speed field

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What will be the result of attempting to compile and run the following code?

A) null

B) John

C) Compilation error

D) Runtime error

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is encapsulation in Java?

A) A process of combining methods and data members in a single unit

B) A process of hiding the implementation details and exposing only the functionality

C) A process of inheriting methods from a superclass

D) A process of overriding methods in a subclass

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does it mean for a class to be tightly encapsulated?

A) All its fields are private, and it provides public getter and setter methods for them

B) All its fields and methods are public

C) It does not have any constructors

D) It cannot be inherited

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the main advantage of encapsulation?

A) It allows direct access to the data

B) It makes the class methods private

C) It enhances code maintenance and flexibility

D) It prevents class inheritance

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following statements is true about encapsulation?

A) It requires all methods to be private

B) It requires all classes to be public

C) It allows a class to control how its data is accessed and modified

D) It prevents the use of inheritance

Access all questions and much more by creating a free account

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

Already have an account?

Discover more resources for Computers