
Quiz on Access Modifiers, Encapsulation, and Class Anatomy

Quiz
•
Computers
•
9th - 12th Grade
•
Easy
Lonale Brooks
Used 1+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the primary purpose of access modifiers?
To simplify the syntax of the language
To increase the size of the code
To control the visibility of classes, methods, and variables
To enhance the speed of the program
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which access modifier allows a method to be accessed from any other class?
Private
Protected
Public
Default
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the role of constructors in a class?
To execute the main method
To compile the code
To initialize instance variables
To destroy objects
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a non-void method?
public void accelerate(int increment)
public int getSpeed()
public void stop()
public void setSpeed(int speed)
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the scope of a static variable?
Class-wide scope
Limited to the method it is defined in
Limited to the package
Limited to the instance of the class
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is encapsulation in object-oriented programming?
A method to increase the speed of execution
A principle to hide the internal state and require all interaction to be performed through an object's methods
A way to write more code
A technique to reduce the size of the program
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a characteristic of void methods?
They do not perform any action
They return a value
They are used to initialize instance variables
They perform actions but do not return a value
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Python Revision Tour

Quiz
•
10th Grade
10 questions
CHAPTER 3. INTRODUCTION TO DBMS -1

Quiz
•
12th Grade
5 questions
AP Computer Science A Void

Quiz
•
8th - 12th Grade
10 questions
7 OCR GCSE Computer Science - System Software

Quiz
•
10th - 11th Grade
15 questions
Recursion in Java

Quiz
•
11th - 12th Grade
15 questions
Python Basics Quiz

Quiz
•
6th - 10th Grade
15 questions
AP CS - Unit 5 Review

Quiz
•
9th - 12th Grade
6 questions
AP CSA 5.4 / 5.5 (Getters / Setters)

Quiz
•
10th - 12th Grade
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
10 questions
Proper Keyboarding Techniques

Interactive video
•
6th - 10th Grade
14 questions
Inputs and Outputs: Computer Science Intro

Lesson
•
5th - 9th Grade
10 questions
Understanding Computers: Hardware, Software, and Operating Systems

Interactive video
•
7th - 12th Grade
29 questions
AP CSP Unit 2 Review (Code.org)

Quiz
•
10th - 12th Grade