OOP techniques Flashcards

1
Q

standard Collection methods

A

.addItem(data) (adds to collection)
.resetNext (start at beg)
.hasNext (true/false)
.getNext (retrieves next data item)
.isEmpty (checks if collection empty)

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

OOP

A

use programming objects that have data (properties) and behavior (methods) using abstraction

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

inheritance

A

one object aquires properties of another (keyword: extends and implements)
“IS-A”

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

abstraction

A

hiding unwanted information (only necessary shown)
don’t need to understand how it works, just how to use it

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

encapsulation

A

making fields in a class private and providing access via public methods (get/setters)
- cannot be accessed outside class (data hiding) or changed

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

dependency

A

“USES-A” Relationship

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

aggregation

A

creating an instance of an object in a different class, “HAS-A”

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

polymorphism

A

subclasses of super class define own unique behaviors and yet share some same functionality as parent class –> overriding & overloading

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

method overriding

A

same method, different class (subclass) –> overriding & overloading

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

method overloading

A

different method, same class *diff parameters)

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

features of Unicode (internationalization)

A
  • display of international fonts and texts
  • language/local needs e.g. date/time formatting
  • keyboard layouts (or complex char/symbols)
  • variety of written languages
  • global software deployment

+ASCII takes up less bytes per character, has more variety

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

problems with OOP

A
  • increased complexity (more lines of code, and slower)
  • unsuited to particular problems e.g. functional-programming style
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

advantages of polymorphism

A
  • different actions but same name
  • subclasses unqiue but inherit parent actions
  • inherit without rewriting code and can alter the needed ones (reusability)
  • extnesibility – other subclasses could be added later
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

advantages of modularity

A
  • easier debugging and testing
  • speedier completion
  • code blocks reusable
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

features of OOP

A

APIE
Abstraction, Polymorphism, Inheritance, and Encapsulation

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

static modifier

A

variable will be the same for all instances of an object

17
Q

operator

A

(set of) character(s) that represent an action e.g. boolean/arithmetic/assignment/relational operators

18
Q

fundamental computer operations

A

ADD, COMPARE, RETRIEVE, STORE

19
Q

need for higher level languages

A
  • more time efficient
  • less room for error
  • errors more easily found
20
Q

need for translation from higher level language

A

compiler: translator, only once (no recompilation)
interpreter: translates every time run, reads line by line
java combines both

21
Q

selection sort

A

find the smallest element in the array and swap it into the first position, then find the second smallest and swap it into the second position, and continue with the next and next smallest until sorted (double loop)

22
Q

bubble sort

A

simplest sorting algorithm
continuously compares adjacent elements and swaps them if the second is smaller than the first (double loop)

23
Q

selection sort algorithm

A
  • loop i from 0 to n-2
  • loop j from i + 1 to n-1
  • compare two vals and reassign min if needed
    swap AFTER first loop
24
Q

bubble sort algorithm

A
  • loop i from 0 to n-2
  • loop j from 0 to n - i - 1
    *both start from same bc comparing adj
  • swap adjacent vals if need INSIDE inner loop