Chapter 2 Flashcards

(17 cards)

1
Q

What is a Function (Procedure)?

A

A block of code you can run when needed

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

What does it mean to Call a function?

A

Use the function by writing its name

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

Define Parameter in the context of functions.

A

A name inside the function that holds input

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

What is an Argument?

A

The actual value you give when calling the function

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

What is Abstraction?

A

Hiding details to make code simpler

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

What is Modularity?

A

Breaking big problems into small parts

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

Define Algorithm.

A

Steps to solve a problem

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

What is an If Statement?

A

Runs code if a condition is true

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

What is Procedural Abstraction?

A

Using a function to hide code details

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

What does Return do in a function?

A

Sends a value back from a function

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

What is a Statement in programming?

A

A line of code that does something

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

Define Library.

A

A group of functions someone else made

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

What is an API (Application Programming Interface)?

A

Lets your code use tools from a library

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

Why use libraries?

A

They save time and give you ready-to-use code

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

Why is documentation important?

A

It tells you how to use the code

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

What does random.randint(a, b) do?

A

Picks a random number from a to b (including both)

17
Q

Why use random?

A

For games, choices, or testing