
Object Oriented Programming Quiz

Quiz
•
Information Technology (IT)
•
4th Grade
•
Medium
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
Similar Resources on Wayground
Popular Resources on Wayground
55 questions
CHS Student Handbook 25-26

Quiz
•
9th Grade
18 questions
Writing Launch Day 1

Lesson
•
3rd Grade
10 questions
Chaffey

Quiz
•
9th - 12th Grade
15 questions
PRIDE

Quiz
•
6th - 8th Grade
40 questions
Algebra Review Topics

Quiz
•
9th - 12th Grade
22 questions
6-8 Digital Citizenship Review

Quiz
•
6th - 8th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
Discover more resources for Information Technology (IT)
15 questions
Place Value

Quiz
•
4th Grade
20 questions
Place Value

Quiz
•
4th Grade
13 questions
4.NBT.A.2 Pre-Assessment

Quiz
•
4th Grade
10 questions
Making Predictions

Quiz
•
4th - 5th Grade
10 questions
PBIS Terrace View

Quiz
•
1st - 5th Grade
6 questions
Spiral Review 8/5

Quiz
•
4th Grade
18 questions
Rotation/Revolution Quiz

Quiz
•
4th Grade
15 questions
Capitalization Rules

Quiz
•
4th Grade