Object Oriented Programming Quiz

Object Oriented Programming Quiz

4th Grade

40 Qs

quiz-placeholder

Similar activities

Latihan Soal Informatika Kelas IV

Latihan Soal Informatika Kelas IV

4th Grade

38 Qs

Ôn tập Chương 1-2_part2

Ôn tập Chương 1-2_part2

1st - 5th Grade

40 Qs

Informatika Ujian sekolah kelas 6 bab1-3 kompilasi alethea

Informatika Ujian sekolah kelas 6 bab1-3 kompilasi alethea

1st - 5th Grade

45 Qs

Object Oriented Programming Quiz

Object Oriented Programming Quiz

Assessment

Quiz

Information Technology (IT)

4th Grade

Medium

Created by

Cecilio Salonoy

Used 2+ times

FREE Resource

40 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is encapsulation in object-oriented programming?

Writing code in a procedural style

Allowing free access to all class properties

Restricting direct access to some of an object's components

Making code longer and more complex

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which access modifier is commonly used to implement encapsulation?

public

protected

global

private

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In PHP, which keyword restricts property access to within the class only?

public

private

external

abstract

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of getter methods in encapsulation?

To delete object properties

To provide controlled read access to private properties

To directly change class variables

To generate random values

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the role of a setter method in a class?

Sets cookies

Assigns permissions to users

Assigns a value to a private property using a public method

Reads data from the database

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a benefit of encapsulation?

Slower performance

No need for class constructors

Better control over data and security

Increased global variables

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Given the following class, which method is used to access the $name property?

$person->name;

$person->setName();

$person->getName();

$person->__get();

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?