Object Oriented programing Flashcards
What is the main principle of object-oriented programming?
Encapsulation, inheritance, polymorphism, and abstraction.
True or False: In object-oriented programming, a class is a blueprint for creating objects.
True.
Fill in the blank: The process of creating a new class from an existing class is called __________.
inheritance.
What is encapsulation in object-oriented programming?
The bundling of data and methods that operate on the data within one unit, restricting access to some of the object’s components.
Which of the following is NOT a feature of object-oriented programming? A) Inheritance B) Polymorphism C) Compilation D) Encapsulation
C) Compilation.
What is polymorphism?
The ability of different classes to be treated as instances of the same class through a common interface.
True or False: Abstraction is the concept of hiding the complex reality while exposing only the necessary parts.
True.
What keyword is often used to define a class in many object-oriented programming languages?
class.
Fill in the blank: An object is an instance of a __________.
class.
What is an interface in object-oriented programming?
A contract that defines a set of methods that a class must implement.
What does the ‘this’ keyword refer to in object-oriented programming?
The current instance of the class.
True or False: Constructors are special methods that are called when an object is instantiated.
True.
What is method overloading?
Defining multiple methods in the same class with the same name but different parameters.
Which of the following is an example of inheritance? A) A car is a type of vehicle. B) A car has wheels. C) A car can drive.
A) A car is a type of vehicle.
Fill in the blank: Inheritance allows a class to inherit properties and methods from a __________ class.
parent or superclass.
What is the purpose of a destructor in object-oriented programming?
To clean up resources held by an object before it is destroyed.
True or False: In object-oriented programming, a subclass can override methods of its superclass.
True.
What is a class variable?
A variable that is shared among all instances of a class.
What does the term ‘data hiding’ refer to in object-oriented programming?
Restricting access to certain details of an object to protect its integrity.
What is structured programming?
Structured programming is a programming paradigm that emphasizes the use of control structures such as sequences, selections, and iterations to improve the clarity and efficiency of code.
True or False: Structured programming encourages the use of goto statements.
False
Which of the following is NOT a control structure used in structured programming: a) Sequence, b) Goto, c) Selection, d) Iteration?
b) Goto
Fill in the blank: In structured programming, programs are typically divided into _____ and functions.
modules
What are the three main control structures in structured programming?
Sequence, Selection, Iteration