Search Header Logo

Program_3

Authored by Ms C

Engineering

Professional Development

Used 2+ times

Program_3
AI

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

1. What is the purpose of the raiseSalary() method in the Employee class?

a) To set a new salary directly

b) To increase the salary by a given percentage

c) To print the salary details

d) To decrease the salary

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the access modifier for the instance variables id, name, and salary?

a) public

b) private

c) protected

d) default

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which keyword is used to create an object of the Employee class?

a) this

b) new

c) super

d) create

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which concept of OOP is shown by using private variables and public getter methods?

a) Inheritance

b) Encapsulation

c) Polymorphism

d) Abstraction

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the this keyword refer to inside the constructor?

a) The parent class

b) The current object of the class

c) The static variable

d) The superclass

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which method automatically executes when an object is printed?

a) print()

b) display()

c) toString()

d) show()

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which part of the program demonstrates data hiding?

a) Private variables with public getters

b) Printing salary

c) Using toString()

d) Using new keyword

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?