wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Object Oriented Programming Quiz

Total questions: 56

Worksheet time: 56mins

Name
Class
Date
1.

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?

a)

Procedural

b)

Functional

c)

Object-Oriented

d)

Structural

2.

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?

a)

Arrays

b)

Objects

c)

Files

d)

Tables

3.

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?

a)

Encapsulation

b)

Inheritance

c)

Polymorphism

d)

Abstraction

4.

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?

a)

Control Flow

b)

Data Fields

c)

Data Structures

d)

Functions

5.

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?

a)

Programming around procedures

b)

Programming around functions and logic

c)

Programming around data or objects

d)

Programming around databases

6.

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?

a)

Inheritance

b)

Abstraction

c)

Polymorphism

d)

Encapsulation

7.

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?

a)

Polymorphism

b)

Inheritance

c)

Message Passing

d)

Encapsulation

8.

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:

a)

Function Chaining

b)

Method Binding

c)

Polymorphism

d)

Encapsulation

9.

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?

a)

Control Flow

b)

Data Fields

c)

Data Structures

d)

Functions

10.

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?

a)

Programming around procedures

b)

Programming around functions and logic

c)

Programming around data or objects

d)

Programming around databases

11.

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?

a)

C# does not support OOP

b)

You cannot define classes in C#

c)

C# fully supports all OOP principles

d)

Fields and methods cannot coexist in a class

12.

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?

a)

To hide internal code complexity

b)

To duplicate code

c)

To reduce memory

d)

To improve security only

13.

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?

a)

Properties

b)

Interfaces

c)

Access Modifiers

d)

Delegates

14.

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?

a)

Overriding

b)

Overloading

c)

Inheritance

d)

Abstraction

15.

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?

a)

implements

b)

base

c)

extends

d)

:

16.

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?

a)

Overloading

b)

Overriding

c)

Abstraction

d)

Encapsulation

17.

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:

a)

Overloading

b)

Downcasting

c)

Upcasting

d)

Encapsulation

18.

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?

a)

static

b)

override

c)

base

d)

this

19.

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?

a)

Polymorphism

b)

Encapsulation

c)

Abstraction

d)

Inheritance

20.

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?

a)

   Only within the Employee class

b)

  In the Manager class that inherits from Employee

c)

In any unrelated class within the program

d)

In the compiler by default 

21.

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?

a)

It increases the overall speed of the program.

b)

It causes unnecessary code duplication between objects.

c)

It allows objects to communicate and collaborate effectively.

d)

It reduces the memory usage of the application.

22.

You are tasked to create a Windows Form Application in C#. Which is the first step you should do in Visual Studio?

a)

Add a Button to the Form

b)

Open Visual Studio and select Create a new project

c)

Drag and drop a Label into the Form

d)

Configure the InitializeComponent() method

23.

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?

a)

Place the form in the solution explorer

b)

Handle the Button’s Click event

c)

Name the TextBox correctly

d)

Add the form to GitHub

24.

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?

a)

Use Parse() before adding the name

b)

Check if the ListBox already contains the name

c)

Call the InitializeComponent() method again

d)

Disable the TextBox after the first entry

25.

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?

a)

Correctness of code

b)

Documentation and style

c)

Efficiency of code

d)

Adherence to standards

26.

You created a calculator app with Windows Forms. However, it fails when dividing by zero .According to the rubric, this is an error under:

a)

Breakdown (Modular Design)

b)

Efficiency of code

c)

Correctness of code

d)

Documentation and style

27.

While adding controls to your form, you mistakenly drag three TextBoxes instead of one. What can you do to fix this?

a)

Restart Visual Studio

b)

Delete the unnecessary TextBoxes in the Designer

c)

Edit the InitializeComponent() method manually

d)

Save the project as a new template

28.

Your form is working, but your instructor says, “You didn’t follow the required project naming convention.” .This issue relates to:

a)

Adherence to standards

b)

Breakdown (Modular Design)

c)

Documentation and style

d)

Correctness of code

29.

   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?

a)

Inside InitializeComponent()

b)

In the Button’s Click event handler

c)

In the Program.cs file

d)

In the Designer file

30.

You want to create another form (Form3) that can be navigated from Form1. Which action should you perform?

a)

Use Form3.Show(); inside a Button event in Form1

b)

Add Form3 controls inside Form1

c)

Modify InitializeComponent() directly

d)

Save Form3 as a ListBox

31.

  A student claims that Windows Forms automatically generates the code for controls inside a method. Which method is this?

a)

Main()

b)

Form_Load()

c)

InitializeComponent()

d)

Dispose()

32.

    A teammate places all business logic code inside the Form Designer file. What will this affect the most?

a)

Adherence to standards

b)

Correctness of code

c)

Breakdown (Modular Design)

d)

Documentation and style

33.

   Your Windows Form project passes all tests but runs very slowly because of inefficient algorithms. Which rubric area is weak?

a)

Efficiency of code

b)

Adherence to standards

c)

Documentation and style

d)

Breakdown (Modular Design)

34.

    You are asked to create a form with multiple buttons that perform different tasks. How should you organize your code?

a)

Write all button logic in a single method

b)

Use separate event handlers for each button

c)

Place all button logic in InitializeComponent()

d)

Avoid using event handlers

35.

    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?

a)

Convert.ToChar()

b)

Parse()

c)

TryCatch()

d)

ToString()

36.

   A student runs their Windows Form app, but the form window does not appear. Which common error might have occurred?

a)

Forgot to call Application.Run(new Form1()); in Program.cs

b)

Forgot to add a ListBox

c)

Did not handle the Button event

d)

Incorrect label text

37.

    You want to ensure your calculator form follows OOP principles. Which approach is best?

a)

Keep UI and logic in separate classes

b)

Write all code in the Form_Load event

c)

Place all code in the Designer file

d)

Use only one class for everything

38.

   Your group submitted a project that compiles but has major violations of the given instructions. Which rubric area will be most affected?

a)

Adherence to standards

b)

Correctness of code

c)

Documentation and style

d)

Efficiency of code

39.

  You added a Button on your form. In Properties, you see a “lightning bolt” icon. What does it represent?

a)

Themes

b)

Events

c)

References

d)

Styles

40.

In your project, you named your controls like button1, textbox2. Your instructor suggests renaming them to meaningful identifiers. Which rubric is being improved?

a)

Correctness of code

b)

Documentation and style

c)

Efficiency of code

d)

Breakdown (Modular Design)

41.

  A calculator form requires navigation to other forms. What C# code should be used to open Form3 from Form1?

a)

Form3.Show();

b)

Form3.Hide();

c)

Form3.Run();

d)

Form3.Start();

42.

  When adding names into a ListBox, the program should ignore blank inputs. How can you validate this?

a)

if(txtName.Text != "")

b)

if(lstNames.Items.Count == 0)

c)

if(Form1.Visible == true)

d)

if(button1.Enabled == true)

43.

    A student edits InitializeComponent() manually and accidentally deletes some lines. What is the best way to fix it?

a)

Re-add controls using the Designer

b)

Write all controls manually

c)

Delete Program.cs

d)

Restart the computer

44.

   Your Windows Form project is functional, but your methods are extremely long and difficult to maintain. Which rubric criterion suffers?

a)

Breakdown (Modular Design)

b)

Correctness of code

c)

Efficiency of code

d)

Adherence to standard

45.

  A student created a calculator form but forgot to comment the functions. Which rubric criterion will lose points?

a)

Correctness of code

b)

Documentation and style

c)

Efficiency of code

d)

Breakdown (Modular Design)

46.

  In your Windows Form app, you want the Enter key to act like clicking a Button. Which property can you use in the form?

a)

AcceptButton

b)

AutoClick

c)

DefaultKey

d)

ActionButton

47.

You want to run your app in Visual Studio for testing. Which option should you click?

a)

Save All

b)

Run (Debug) or F5

c)

Rebuild Solution

d)

Add Reference

48.

A teammate created all event handlers but forgot to connect them to the controls. What will happen?

a)

The program crashes

b)

The form loads but events never trigger

c)

The program won’t compile

d)

The events will run automatically

49.

  You want to clear all items from a ListBox. Which method should you use?

a)

lstNames.Clear();

b)

lstNames.Items.Clear();

c)

lstNames.Text = "";

d)

lstNames.Dispose();

50.

   Your instructor asks you to upload your project to GitHub. What is the benefit of this?

a)

It allows collaboration and version control

b)

It speeds up the code execution

c)

It automatically fixes bugs

d)

It compiles the project faster

51.

You have two forms in your project: Form1 and Form2. To close Form1 when opening Form2, which command is best?

a)

Form2.Show(); this.Close();

b)

Form2.Run(); Form1.Hide();

c)

Form2.Open();

d)

Form2.Dispose();

52.

  In a calculator project, the subtraction function gives incorrect results for negative numbers. Which rubric area is most affected?

a)

Correctness of code

b)

Documentation and style

c)

Efficiency of code

d)

Breakdown (Modular Design)

53.

In a calculator project, the subtraction function gives incorrect results for negative numbers. Which rubric area is most affected?

a)

Adherence to standards

b)

Efficiency of code

c)

Documentation and style

d)

User input handling

54.

Which of the following is a desktop-based application framework in .NET?

a)

Windows Forms

b)

ASP.NET

c)

Blazor

d)

Xamarin

55.

You want to run specific code when the form loads. Which event should you use?

a)

Form_Load

b)

Button_Click

c)

InitializeComponent()

d)

Dispose()

56.

Which property ensures the user cannot leave it empty?

a)

MaxLength

b)

PlaceholderText

c)

Validation

d)

RequiredField (manual validation)