
Object Oriented Programming Quiz
Quiz
•
Information Technology (IT)
•
4th Grade
•
Practice Problem
•
Medium
Cecilio Salonoy
Used 2+ times
FREE Resource
Enhance your content in a minute
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();
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
Discover more resources for Information Technology (IT)
15 questions
Equivalent Fractions
Quiz
•
4th Grade
10 questions
Groundhog Day Trivia Questions
Interactive video
•
3rd - 6th Grade
9 questions
Point of View
Quiz
•
3rd - 4th Grade
10 questions
Groundhog Behavior and Hibernation Facts
Interactive video
•
3rd - 5th Grade
10 questions
Understanding Poetry and Literary Devices
Interactive video
•
4th - 8th Grade
77 questions
Mixed Multiplication and Division Facts
Quiz
•
4th Grade
10 questions
Understanding Equivalent Fractions
Interactive video
•
3rd - 5th Grade
19 questions
Equivalent Fractions
Quiz
•
4th Grade
