Functions, classes, methods Flashcards

1
Q

How do you get a function to run within source code?

A

You “call” it.

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

How are functions represented in pseudocode?

A

functionName()

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

What is the difference between a function declaration and a function
definition?

A

Function declaration = only names a function and its arguments
(def greet(name):
print(“Hello, “ + name + “!”)

greet(“Alice”))
(“Alice” is the argument passed to the greet function)

Function definition = the function as a whole

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

How is a class different to an object?

A

A class is a blueprint for an object, similar to architectural plans for a house. An object, on the other hand, is an instance of a class with specific state, like a house built from those plans.

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

What is the relationship between a method and an event?

A

An event is a specific method that gets “triggered” when an object’s state changes, It is designed to react to changes within an object.

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

How are methods represented in pseudocode?

A

objectName.methodName()

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