NEW
Font size
WorksheetsObject Oriented Programming Quiz
Total questions: 56
Worksheet time: 56mins
Jane is tasked to design a payroll system for her company. To make the system easier to maintain, she decides to create modules that combine both employee data (such as name, salary, and position) and functions (such as computeSalary and generatePayslip) within the same unit. By doing this, Jane ensures that her code is reusable and organized. Which programming paradigm is Jane applying?
Procedural
Functional
Object-Oriented
Structural
Ana is developing a simple ride-hailing application. In her code, she creates an object named Car that has properties such as color and model, and methods such as drive() and brake(). This setup allows Ana to represent a real-world vehicle inside her program. What programming concept does Ana’s implementation best demonstrate?
Arrays
Objects
Files
Tables
A university student is tasked to create a Shape class in Java. Inside the class, they write a method called calculateArea() that is responsible for computing the area of a shape. The method is placed within the class to ensure that the details of how the area is calculated are hidden from outside interference and can only be accessed through the class. Which Object-Oriented Programming (OOP) concept is being demonstrated in this scenario?
Encapsulation
Inheritance
Polymorphism
Abstraction
A student developer is designing a simple library management system. To organize book records efficiently, they decide to use arrays for storing book IDs, trees for arranging categories, and records for storing book details. Under which concept do these structures fall?
Control Flow
Data Fields
Data Structures
Functions
Maria is tasked to redesign her company’s payroll system. Instead of focusing only on step-by-step procedures or logic, her manager advised her to use a programming approach that models real-world entities such as “Employee,” “Department,” and “Salary” as reusable components. Which of the following best describes the programming paradigm her manager is referring to?
Programming around procedures
Programming around functions and logic
Programming around data or objects
Programming around databases
You are tasked to design a simple program for a school inventory system. You decide to create a Box class to store details like length, width, and height. To ensure that other parts of the program cannot directly change these values, you declare them as private variables and create setter and getter methods to control how they are accessed and modified. If you were to explain this design decision to your team, what Object-Oriented Programming (OOP) feature are you applying to promote data protection and controlled access?
Inheritance
Abstraction
Polymorphism
Encapsulation
You are tasked to develop a simple pet management system for a veterinary clinic. You decide to create a base class called Animal that contains common attributes (e.g., name, age) and methods (e.g., eat(), sleep()). Then, you design subclasses like Dog and Cat that automatically inherit these features and add their own unique behaviors. Which Object-Oriented Programming (OOP) concept are you applying to avoid rewriting the same code for every animal type?
Polymorphism
Inheritance
Message Passing
Encapsulation
A software company is developing a mobile banking app. The developer designs multiple methods named calculateFee, where one version accepts only the transaction amount, another accepts both amount and transaction type, and another includes amount, transaction type, and customer status. This design allows the same method name to handle different situations depending on the parameters provided. This scenario demonstrates the concept of:
Function Chaining
Method Binding
Polymorphism
Encapsulation
A software developer is creating an inventory management system for a retail store. To efficiently organize items, the developer decides to use arrays to store product IDs, trees to represent product categories, and records to keep detailed information such as price and stock quantity. Under which programming concept do these tools belong?
Control Flow
Data Fields
Data Structures
Functions
You were hired as a junior software developer in a company that develops a school management system. Your team leader asked you to choose a programming approach that allows you to model real-world entities such as Students, Teachers, and Courses into reusable structures. Which programming paradigm should you apply?
Programming around procedures
Programming around functions and logic
Programming around data or objects
Programming around databases
You are tasked to design a small inventory management system for a local store using C#. To make your code efficient and maintainable, you decide to apply Object-Oriented Programming (OOP) principles. Considering the features of C#, which of the following statements correctly reflects its OOP support and would help you build your system?
C# does not support OOP
You cannot define classes in C#
C# fully supports all OOP principles
Fields and methods cannot coexist in a class
Maria is developing a school management system. She wants to design a class where users can interact with simple methods (like enrollStudent() or generateReport()) without knowing the detailed internal code behind those methods. Which OOP principle should she apply to hide the complex implementation details while still allowing others to use the functionality?
To hide internal code complexity
To duplicate code
To reduce memory
To improve security only
You are designing a C# application for a university’s student information system. To maintain security and proper encapsulation, you need to decide how other classes will interact with the student’s personal data fields such as studentName, studentID, and GPA.If you are tasked to create a class that enforces proper restrictions on which parts of the code can access or modify these fields, which C# concept would you apply to define default access control for the fields or methods?
Properties
Interfaces
Access Modifiers
Delegates
You are tasked to design a simple calculator program in Java. In your design, you decided to create a Calculator class that has a compute() method. To make the program flexible, you implemented multiple versions of compute(): one that accepts two integers, another that accepts two doubles, and one that accepts three integers. What Object-Oriented Programming (OOP) feature are you applying in your created design?
Overriding
Overloading
Inheritance
Abstraction
You are developing a C# program for a university enrollment system. The system requires a IStudent interface that defines methods like Enroll() and PayTuition(). You create a class Freshman that needs to inherit from this interface. Which keyword in C# should you use to implement the interface in your class?
implements
base
extends
:
You are developing a mobile banking app. To prevent users from seeing the internal details of how transactions are processed, you design the system so they only interact with simple options like “Deposit,” “Withdraw,” and “Transfer.” Which Object-Oriented Programming (OOP) pillar are you applying to hide the complexity from the users?
Overloading
Overriding
Abstraction
Encapsulation
During a programming activity, your instructor asked you to create a calculator class. You wrote two methods named Add: one accepts two integers, and the other accepts two doubles. When you ran the program, both methods worked correctly depending on the data type passed. This concept, where multiple methods share the same name but differ in parameter type or number, is called:
Overloading
Downcasting
Upcasting
Encapsulation
You are developing a C# application for a payroll system. In your design, you created a Person class that contains the constructor for initializing common details such as name and address. Later, you created a Employee class that inherits from Person. When writing the Employee constructor, you need to reuse and call the constructor of the Person class to avoid code duplication. Which keyword should you use to access the parent class constructor?
static
override
base
this
A software company is developing a payroll system where different types of employees (e.g., regular, contractual, and part-time) need to calculate their salary using the same method name calculateSalary(), but each employee type has its own way of computing it. What Object-Oriented Programming concept is being applied here?
Polymorphism
Encapsulation
Abstraction
Inheritance
Ana is designing a payroll system in Java. She declared some attributes in the Employee class as protected so that other classes can reuse them. Later, her Manager class inherits from Employee. During testing, she needs to verify where those protected attributes can be accessed. Based on this situation, in which part of the program can Ana successfully access the protected attributes of the Employee class?
Only within the Employee class
In the Manager class that inherits from Employee
In any unrelated class within the program
In the compiler by default
A software company is developing a banking application where multiple objects such as Account, Transaction, and Notification need to interact without being tightly dependent on each other. The developers are considering the use of message passing in their object-oriented design. Which of the following best explains the benefit of using message passing in this situation?
It increases the overall speed of the program.
It causes unnecessary code duplication between objects.
It allows objects to communicate and collaborate effectively.
It reduces the memory usage of the application.
You are tasked to create a Windows Form Application in C#. Which is the first step you should do in Visual Studio?
Add a Button to the Form
Open Visual Studio and select Create a new project
Drag and drop a Label into the Form
Configure the InitializeComponent() method
A student created a form with a TextBox and a Button.When the Button is clicked, nothing happens. What did the student likely forget to do?
Place the form in the solution explorer
Handle the Button’s Click event
Name the TextBox correctly
Add the form to GitHub
You are designing a form that accepts names. You want to ensure the same name cannot be added twice into the ListBox. Which code logic should you implement in the Button Click event?
Use Parse() before adding the name
Check if the ListBox already contains the name
Call the InitializeComponent() method again
Disable the TextBox after the first entry
During development, your instructor checks your project. He notices your form works but has inconsistent naming conventions and lacks comments. Which rubric criterion will be affected the most?
Correctness of code
Documentation and style
Efficiency of code
Adherence to standards
You created a calculator app with Windows Forms. However, it fails when dividing by zero .According to the rubric, this is an error under:
Breakdown (Modular Design)
Efficiency of code
Correctness of code
Documentation and style
While adding controls to your form, you mistakenly drag three TextBoxes instead of one. What can you do to fix this?
Restart Visual Studio
Delete the unnecessary TextBoxes in the Designer
Edit the InitializeComponent() method manually
Save the project as a new template
Your form is working, but your instructor says, “You didn’t follow the required project naming convention.” .This issue relates to:
Adherence to standards
Breakdown (Modular Design)
Documentation and style
Correctness of code
A form application requires two conditions before adding a name: the field must not be empty, and the name must not already exist. Where should you put this validation?
Inside InitializeComponent()
In the Button’s Click event handler
In the Program.cs file
In the Designer file
You want to create another form (Form3) that can be navigated from Form1. Which action should you perform?
Use Form3.Show(); inside a Button event in Form1
Add Form3 controls inside Form1
Modify InitializeComponent() directly
Save Form3 as a ListBox
A student claims that Windows Forms automatically generates the code for controls inside a method. Which method is this?
Main()
Form_Load()
InitializeComponent()
Dispose()
A teammate places all business logic code inside the Form Designer file. What will this affect the most?
Adherence to standards
Correctness of code
Breakdown (Modular Design)
Documentation and style
Your Windows Form project passes all tests but runs very slowly because of inefficient algorithms. Which rubric area is weak?
Efficiency of code
Adherence to standards
Documentation and style
Breakdown (Modular Design)
You are asked to create a form with multiple buttons that perform different tasks. How should you organize your code?
Write all button logic in a single method
Use separate event handlers for each button
Place all button logic in InitializeComponent()
Avoid using event handlers
In your calculator project, you need to convert a user’s TextBox input into an integer before adding two numbers. Which method should you use?
Convert.ToChar()
Parse()
TryCatch()
ToString()
A student runs their Windows Form app, but the form window does not appear. Which common error might have occurred?
Forgot to call Application.Run(new Form1()); in Program.cs
Forgot to add a ListBox
Did not handle the Button event
Incorrect label text
You want to ensure your calculator form follows OOP principles. Which approach is best?
Keep UI and logic in separate classes
Write all code in the Form_Load event
Place all code in the Designer file
Use only one class for everything
Your group submitted a project that compiles but has major violations of the given instructions. Which rubric area will be most affected?
Adherence to standards
Correctness of code
Documentation and style
Efficiency of code
You added a Button on your form. In Properties, you see a “lightning bolt” icon. What does it represent?
Themes
Events
References
Styles
In your project, you named your controls like button1, textbox2. Your instructor suggests renaming them to meaningful identifiers. Which rubric is being improved?
Correctness of code
Documentation and style
Efficiency of code
Breakdown (Modular Design)
A calculator form requires navigation to other forms. What C# code should be used to open Form3 from Form1?
Form3.Show();
Form3.Hide();
Form3.Run();
Form3.Start();
When adding names into a ListBox, the program should ignore blank inputs. How can you validate this?
if(txtName.Text != "")
if(lstNames.Items.Count == 0)
if(Form1.Visible == true)
if(button1.Enabled == true)
A student edits InitializeComponent() manually and accidentally deletes some lines. What is the best way to fix it?
Re-add controls using the Designer
Write all controls manually
Delete Program.cs
Restart the computer
Your Windows Form project is functional, but your methods are extremely long and difficult to maintain. Which rubric criterion suffers?
Breakdown (Modular Design)
Correctness of code
Efficiency of code
Adherence to standard
A student created a calculator form but forgot to comment the functions. Which rubric criterion will lose points?
Correctness of code
Documentation and style
Efficiency of code
Breakdown (Modular Design)
In your Windows Form app, you want the Enter key to act like clicking a Button. Which property can you use in the form?
AcceptButton
AutoClick
DefaultKey
ActionButton
You want to run your app in Visual Studio for testing. Which option should you click?
Save All
Run (Debug) or F5
Rebuild Solution
Add Reference
A teammate created all event handlers but forgot to connect them to the controls. What will happen?
The program crashes
The form loads but events never trigger
The program won’t compile
The events will run automatically
You want to clear all items from a ListBox. Which method should you use?
lstNames.Clear();
lstNames.Items.Clear();
lstNames.Text = "";
lstNames.Dispose();
Your instructor asks you to upload your project to GitHub. What is the benefit of this?
It allows collaboration and version control
It speeds up the code execution
It automatically fixes bugs
It compiles the project faster
You have two forms in your project: Form1 and Form2. To close Form1 when opening Form2, which command is best?
Form2.Show(); this.Close();
Form2.Run(); Form1.Hide();
Form2.Open();
Form2.Dispose();
In a calculator project, the subtraction function gives incorrect results for negative numbers. Which rubric area is most affected?
Correctness of code
Documentation and style
Efficiency of code
Breakdown (Modular Design)
In a calculator project, the subtraction function gives incorrect results for negative numbers. Which rubric area is most affected?
Adherence to standards
Efficiency of code
Documentation and style
User input handling
Which of the following is a desktop-based application framework in .NET?
Windows Forms
ASP.NET
Blazor
Xamarin
You want to run specific code when the form loads. Which event should you use?
Form_Load
Button_Click
InitializeComponent()
Dispose()
Which property ensures the user cannot leave it empty?
MaxLength
PlaceholderText
Validation
RequiredField (manual validation)
