Object Oriented Programming Flashcards

1
Q

What is OOP?

A

In the object-oriented paradigm, the problem is divided into smaller parts called objects, and systems are built around objects. Objects are representations of things that exist in the real world that we wish to model in a computer system. Objects do not share data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is Procedural programming?

A

In the procedural paradigm, the problem is divided into smaller parts called procedures (or functions), and systems are built by combining procedures. .

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Define instantiation:

A

The process of making an instance of an object based on the blue print.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Define class:

A

The blue print or the definition of an object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is encapsulation?

A

Encapsulation binds together the attributes (data) and the methods (functions and procedures) that manipulate the data. It does this so that the data is protected.

Encapsulation is a form of data hiding. The inner details and workings of the class do not need to be understood by anyone other than the class designer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does it mean if a class is self contained and why is it important?

A

Each class should have no awareness of how it will be used, or of any other parts of a system that it may be part of.

  • class can be used in other applications
    -You can change the internal workings of any class, as long as the public interface isn’t changed.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do objects interact?

A

by passing messages - means that they call each other’s public methods.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is inheritance?

A

Inheritance is an OOP technique where child classes are derived from a parent class and inherit all of the attributes and methods from the parent.

uses normal empty arrow.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is polymorphism?

A

The ability of a method to exhibit different behaviours based on the object it was invoked on.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

An example of polymorphism

A

Overriding

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Why favour composition over inheritance?

A

can cause unintended consequences if base class is changed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Difference between aggregation and composition:

A

Aggregation defines a one-way relationship that specifies a ‘has-a’ relationship between two classes while composition that specifies an ‘is-part-of’ relationship between two classes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Symbol for aggregation:

A

empty diamond

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Symbol for composition:

A

Filled in diamond

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Define composition:

A

Composition specifies that an instance of the second object cannot exist separately from its ‘owner’.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Declarative Vs Imperative languages:

A

Declarative describe what the program should do while imperative state how the problem should be solved.

17
Q

Functional Programming

A

This paradigm has no mutable data structures, rather it makes use of structures like mathematical expressions, where the same input will always result in the same output.
Data structures are immutable so ideal for processing big data.

18
Q

+ public
- private
# protected

A