Object-Oriented Programming Flashcards

1
Q

What is a method?

A

a function which is a property of an object.

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

How can you tell the difference between a method definition and a method call?

A

method definition has function code block while method call has the method(arguments)

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

Describe method definition syntax (structure).

A

property name : function method

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

Describe method call syntax (structure).

A

object.method(arguments)

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

How is a method different from any other function?

A

look for a dot too see if its a method if not its a function

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

What is the defining characteristic of Object-Oriented Programming?

A

objects can contain both data (as properties) and behavior (as methods)

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

What are the four “principles” of Object-Oriented Programming?

A

Abstraction, Encapsulation, Inheritance, and Polymorphism

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

What is “abstraction”?

A

being able to work with (possibly) complex things in simple ways

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

What does API stand for?

A

Application Programming Interface (API)

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

What is the purpose of an API?

A

a way to interact with a system in a simplified, consistent fashion

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

What is this in JavaScript?

A

it is a keyword that references the object

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

What does it mean to say that this is an “implicit parameter”?

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

When is the value of this determined in a function; call time or definition time?

A

call time because it is a parameter and a parameter is only called

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

What kind of inheritance does the JavaScript programming language use?

A

prototype-based or prototypal

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

What is a prototype in JavaScript?

A

a source for other objects to inherit its data and behavior within

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

How is it possible to call methods on strings, arrays, and numbers even though those methods don’t actually exist on strings, arrays, and numbers?

A

its within the prototype object

17
Q

If an object does not have it’s own property or method by a given key, where does JavaScript look for it?

A

prototype

18
Q

What does the new operator do?

A
  1. creates new object
  2. assign _ _ proto _ _ under the prototype property
  3. binds as the this context
  4. if function doesn’t return anything
19
Q

What property of JavaScript functions can store shared behavior for instance created with new?

A

.prototype

20
Q

What does the instanceof operator do?

A