1: Fundamentals of Programming Flashcards

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

Encapsulation

A

Ensuring that atributes can only be accessed using methods, that are contained in the class definition

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

Inheritance

A

Creating a subclass, which inherits the atributes and methods of the original class

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

Aggregation

A

It defines a one-way ‘has-a’ relationship between two classes, where each class can exist separately

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

Composition

A

It defines a one-way ‘is-part-of’ relationship between two classes, where the second object cannot exist separately

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

Polymorphism

A

Where a method exhibits different behaviours depending on the object on which the method is invoked

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

Overriding

A

When a subclass has a different implementation for a method to the base class

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

Class Diagrams (6)

A
  • Inheritance: Arrow
  • Composition: Black diamond line
  • Aggregation: White diamond line
  • Public specifier: +
  • Private specifier: -
  • Protected specifier: #
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Subroutines + (5)

A
  • Make programs shorter
  • Can be tested separately
  • Allow for decomposition of large programs
  • Make code reusable
  • Can be used in other programs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Local Variables + (5)

A
  • Memory allocated to local variables can be reused when subroutine not in use
  • Local variable only exists while the subroutine is executing
  • Using local variables makes subroutines self-contained
  • Prevents accidental changes
  • Easier debugging
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Variables vs Constants

A

The value assigned to a variable can changed whereas it cannot for a constant

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

Named Constants + (2)

A
  • Using constants instead of literals in code means that a change to a value only needs to be done once
  • It also makes code easier to understand
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Structured Programming + (5)

A
  • Easier to debug
  • Subroutines can be called many times
  • Subroutines can manipulate shared data
  • Subroutines can be used in other programs
  • Large programs can be worked on by multiple programmers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Object-Oriented Paradigm + (3)

A
  • Classes support code re-use
  • Classes are easy to update
  • Encapsulation provides data protection
How well did you know this?
1
Not at all
2
3
4
5
Perfectly