Objects & Classes Flashcards
What is the main focus of procedural programming?
List of instructions to tell the computer what to do in a top down fashion
Procedural programming relies on procedures, routines, and sub-routines.
What is the fundamental difference between an object and a class?
An object is a program component that knows how to perform certain actions, while a class is a definition of objects of the same kind.
What are the basic units of Object-Oriented Programming (OOP)?
Objects
Objects encapsulate both state (properties) and behavior (methods).
Fill in the blank: In OOP, methods are part of an _______.
[object]
What does a class encapsulate in OOP?
Static attributes (data) and dynamic behaviours (operations that operate on the data)
What are the benefits of Object-Oriented Programming?
- Ease in software design
- Ease in software maintenance
- Reusable software
What is an instance in OOP?
A realization of a particular item of a class.
What keyword is used to define a class in Java?
class
What is a class library?
A collection of classes that can be used to create objects.
True or False: Procedural languages are well-suited for creating reusable software components.
False
What do you call the method that sets up an object in Java?
Constructor
What are the primitive types in Java?
- short
- int
- long
- char
- byte
- double
- float
- boolean
What is the role of methods in an object?
They describe the behaviours of an object.
What does the dot operator do in Java?
It is used to call (invoke) methods of an object.
Fill in the blank: A class is a _______ that defines the properties and behaviors common to a set of objects.
[blueprint]
What is the significance of encapsulation in classes?
It combines data structures and algorithms of a software entity inside the same box.
What are the three main components of a UML class diagram?
- Class name
- Variables
- Methods
What does the access control modifier determine in a class definition?
The visibility of the class and its members.
True or False: Objects in programming are similar to real-world objects.
True
What are reference types in Java?
Types that hold a reference to an object rather than an actual value.
What is the purpose of a library management system in OOP?
To model real-world entities (books, users, checkouts) as objects with attributes and behaviors.
What is the significance of methods like checkOut() and returnBook() in a Book class?
They define the behaviors associated with the Book object.
Fill in the blank: A class can create multiple _______ of itself.
[instances]
What is an example of a real-world entity modeled in OOP?
Books, Users, Checkouts in a library management system