Chapter 58 - Use of object - oriented techniques Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is procedural language?

A

» Uses a series of step-by-step instructions on how to solve the problem
» Breaks down into a number of smaller modules - consists of functions or procedures

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

Where is the data held in procedural programming?

A

» Held in seperate primitive variables such as integer or char, or in data structures such as array, list or string

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

How is everything viewed as in object-oriented programming?

A

» As a collection of objects

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

What are the attributes?

A

» The features of the object
» Variables contained within and associated to an object

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

What are methods?

A

» The behaviour of the object
» Actions that can be pefromed by an object

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

What is the class?

A

» A blueprint or template for an object/multiple
» Defines the attributes and behaviours of objects in that class

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

How are attributes declared as?

A

» Declared as private

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

How are methods declared as?

A

» Public

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

What is the principle of information hiding?

A

» Where a class cannot directly access the attributes of another class, when they are declared private

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

What is a constructor?

A

» A special type of method to construct/build objects in a class

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

What instantiation?

A

» Process of creating new instances of a class

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

What are objects and instance?

A

» Synonymous

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

What is a reference variable?

A

» The object, where memory locations stores the data

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

What is the purpose of a variable reference diagram?

A

» Shows in graphical form the object referenced by the variables

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

What is an object?

A

» An instance of a new class

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

What are instances?

A

» Objects that belong to a class

17
Q

What is the principle of encapsulation?

A

» When an obejct ecapsulates both its states - the values of its instance variables
» So it doesnt affect any other objects

18
Q

How can you initialise a class and a constructor?

A

» class example1:
def__init__(,s,):
self.s = s

19
Q

How can you use a getter?

A

» def get_name():
return name

20
Q

How can you use a set name?

A

» def set_name(self):
self.name = name

21
Q

What does init stand for?

A

» Initalise

22
Q

What are getters?

A

» To make use of information - we need methods that give us access to data

23
Q

What does a get method do?

A

» Allows the attribute to be accessed/returned

24
Q

What does a set method allow?

A

» The attribute to be changed with parameters

25
Q

What is inheritance?

A

» Where a class, inherits the attributes and moethods of a ‘parent’ class, as well as having their own

26
Q

What happens when you create a subclass?

A

» You inherit all the attribute and methods of the superclass

27
Q

What are the 3 benefits of using inheritance in your program?

A

» Avoid repeating code
» Organise classes and objects into a hierarchy
» Share methods and attributes between difference classes

28
Q

What is the parent class?

A

» Also known as the Super class
» Is the class being inherited form, also called base class

29
Q

What is the child class?

A

» Is the class that inherits from another class, also called derived class