Week 4 Chapter 5 Flashcards

1
Q

Why is the modulus operator useful?

A

Can be used to see if one number is divisible by another.

Can extract right most digit/s from a number

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

What is a Boolean expression?

A

True or false expression

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

What data type are booleans?

A

Belong to bool and are not strings

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

What is the == ?

A

Relational operator

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

What are the three logical operators?

A

And, or, not

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

What do conditional statements do?

A

Check condition then execute accordingly

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

What is the Boolean expression after an if called ?

A

Condition

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

A header followed by a statement is referred to as what?

A

Compound statements

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

What does the pass statement do?

A

Does nothing at that part

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

What is an example of alternative if execution?

A

If and else statements

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

The alternatives in an alternative execution are called what?

A

Branches

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

What is a way to express more than two branches in a computation?

A

Through a chained conditional with an elif statement

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

In a chained conditional, since elif is required is else required?

A

Optional but must appear at the end

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

In chained conditionals what order are branches checked in and what happens when one is true?

A

Top to bottom and if one is true then it stops right there

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

What are the cons of nested conditionals?

A

Difficult to read very quickly, good idea to avoid them

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

What are nested conditionals?

A

Conditionals nested in a branch

17
Q

Is it legal for a function to call itself?

A

Yes

18
Q

Is it legal for a function to call another function?

A

Yes

19
Q

A function that calls it self is ____and the process is called _____

A

Recursive recursion

20
Q

What is the modulus operator?

A

Modulus operator works on integers and yields the remainder when first operand is divided by the second.