NEW
Font size
WorksheetsMidterm: Quiz 1 OOP
Total questions: 50
Worksheet time: 25mins
Jane is developing software and wants to organize her code into reusable units that group data and methods together. Which programming paradigm is she using?
Procedural
Functional
Object-Oriented
Structural
In a program, an object named `Car` has properties like `color` and `model`, and methods like `drive()` and `brake()`. What does this best demonstrate?
Arrays
Objects
Files
Tables
You are asked to define a method inside a class that calculates area. What OOP concept are you demonstrating?
Encapsulation
Inheritance
Polymorphism
Abstraction
A developer wants to build a software application that uses data structures such as arrays, trees, and records. What concept do these structures fall under?
Control Flow
Data Fields
Data Structures
Functions
Which of the following best defines Object-Oriented Programming (OOP)?
Programming around procedures
Programming around functions and logic
Programming around data or objects
Programming around databases
A student wrote code where a class Box contains private variables. Only methods inside the class can access them. What OOP feature is this?
Inheritance
Abstraction
Polymorphism
Encapsulation
You are designing a base class Animal, and subclasses like Dog and Cat inherit from it. What OOP concept is demonstrated?
Polymorphism
Inheritance
Message Passing
Encapsulation
What is the term for structuring programs into self-contained, reusable pieces of code?
Modular Programming
OOP
Scripting
Procedural Programming
A developer creates several methods with the same name but different parameters to handle different tasks. This is an example of:
Function Chaining
Method Binding
Polymorphism
Encapsulation
You are writing a method in C# to add two numbers. Where should this method be written?
Outside any class
Inside the compiler
Inside a class
Inside a file
A class Shape defines the method draw(). Each subclass overrides this method for its own behavior. This is an example of:
Abstraction
Overloading
Polymorphism
Encapsulation
Which feature of OOP hides complex code implementation details from the user?
Abstraction
Inheritance
Generic Classes
Arrays
A Box class has private attributes. Which method type allows controlled access to these private variables?
Overloaded operators
Setters and getters
Direct variable manipulation
Delegates
You want to write a class in C# that can store any data type using the same structure. What should you use?
Arrays
Abstract Classes
Generic Classes
Static Classes
In a project, different objects call methods from other objects and pass values. What OOP feature does this show?
Class Libraries
Abstraction
Message Passing
Inheritance
What do you call the built-in, language-specific groups of reusable classes available in C#?
Class Hierarchies
Class Definitions
Class Libraries
Generic Classes
A class Vehicle can be extended by Truck and Bike, allowing reuse of code. This represents:
Inheritance
Message Passing
Abstraction
Polymorphism
What OOP characteristic allows two functions with the same name to perform different tasks?
Inheritance
Polymorphism
Abstraction
Encapsulation
What term describes combining data fields and methods into a single unit?
Polymorphism
Class Libraries
Encapsulation
Message Passing
You define a class template without specifying the type of data it will store. This is a:
Class Library
Interface
Generic Class
Static Class
Which of the following best represents encapsulation?
Overloading the method print()
Sending data between objects
Protecting internal object details
Reusing code from a base class
Why is inheritance important in OOP?
It secures private data
It increases execution speed
It supports code reusability
It defines the object interface
If a developer writes multiple methods called draw() in the same class, each taking different parameters, what OOP concept is being applied?
Method Chaining
Encapsulation
Inheritance
Function Overloading
Which OOP feature enhances flexibility by allowing the same interface to act differently in different classes?
Message Passing
Abstraction
Polymorphism
Data Hiding
What characteristic of OOP helps reduce code duplication and improves scalability?
Polymorphism
Class Libraries
Inheritance
Message Passing
Which company developed the C# programming language?
Apple
Microsoft
IBM
You are writing C# code in Visual Studio. Which platform is this environment part of?
Unity
.NET
Python
Eclipse
What type of applications can be built using C#?
Only web-based applications
Mobile apps only
Almost all types of software
Game development only
If you're creating a dynamic website using ASP.NET, what language will you likely use for backend logic?
Python
Java
C#
Kotlin
Which C# feature lets you define a variable inside a class?
Data Fields
Methods
Interfaces
Delegates
What is a method in C#?
A command line argument
A class property
A block of code containing statements
A design template
Fields in C# are defined using:
File Headers
Command Line Options
Access Modifiers, Type, and Name
Function Prototypes
Which part of a C# program is responsible for executing specific tasks when invoked?
Constructor
Field
Method
Class
A field declared private int age; inside a class demonstrates what principle?
Overloading
Abstraction
Encapsulation
Class Library
To perform a series of actions when a method is called in C#, where is the logic written?
In fields
In the constructor
In the method body
In the main file
You're building an app where a User class should be able to reuse code from a Person class. Which concept should you use?
Composition
Inheritance
Aggregation
Reflection
If a robot class has a method move() that behaves differently in FlyingRobot and WalkingRobot, this is an example of:
Data Hiding
Encapsulation
Polymorphism
Inheritance
A game developer wants to use the same method attack() across different character classes. Which OOP principle allows this?
Inheritance
Message Passing
Polymorphism
Abstraction
You're writing a class for BankAccount that only allows access to balance through specific methods. What is this?
Method Chaining
Inheritance
Encapsulation
Generics
A developer creates a class that can accept different data types and behave the same way. What class type is this?
Abstract Class
Interface
Generic Class
Static Class
An object in a program sends a message to another object requesting data. This is an example of:
Delegation
Message Passing
Polymorphism
Inheritance
What keyword is commonly used in C# to define data fields as accessible only inside their class?
public
internal
protected
private
Which Visual Studio feature helps organize classes into reusable code components?
Code Lens
Class Library
Namespace Viewer
Solution Explorer
Which concept allows you to change the implementation of a method in a subclass?
Encapsulation
Polymorphism
Inheritance
Method Overriding
What is the benefit of using message passing in OOP?
Better speed
Code duplication
Object communication
Memory reduction
If an attribute is declared protected, where can it be accessed?
Only within the class
In child classes
In any class
In the compiler
A student created a class with a method that accepts different parameter types. What feature is being used?
Overriding
Overloading
Inheritance
Abstraction
What C# concept allows the developer to specify default access control for fields or methods?
Properties
Interfaces
Access Modifiers
Delegates
Why is abstraction used in OOP?
To hide internal code complexity
To duplicate code
To reduce memory
To improve security only
Which of the following statements is TRUE about C# and OOP?
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
