Final 2 Flashcards

1
Q

Trivia: What reference did the professor make in the powerpoint for the lecture on loops?

A

Cars - I’m not the one
“Goin’ round and round…”

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

Most general type of loop

A

While

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

What is a sentinel?

A

An event or value read in that stops a loop from executing when it occurs

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

What does “robust” mean in terms of a program?

A

That it does not easily crash

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

What function returns the number of elements in a list given as its argument?

A

len()
Syntax len([1,2,3])
returns 3

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

Is len a method?

A

No, it’s a function which takes an argument. A method with regards to this class uses dot notation to be called.

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

Trivia: 1993 Movie that uses the concept of a loop.

A

Groundhog Day

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

Trivia: What TV show was used as a reference for and/or statements?

A

Get Smart

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

Trivia: What TV show was referenced for short circuit evaluation?

A

Wings (“Did Roy Biggens really Steal $250,000?”)

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

What does short circuit evaluation do?

A

Terminates an evaluation of the condition when the overall answer is already known or obvious (or/and operators come into play here)

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

Trivia: What movie was used to illustrate the concept of what would happen if no short circuit evaluation was used?

A

Wrongfully Accused (“Bus Scene”)
The people back off the road and fall down a hill.

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

True/False boolean values are sometimes referred to as what?

A

flags

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

Trivia: What song was used as a reference when trying to “see” invisible characters such as tab? (Special/Escape characters)

A

DC Talk - “Mind’s Eye”

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

What would print(“\n\n\n”) output?

A

\n\n\n

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

What does print(r”c\n\na”) output? Why?

A

c\n\na because the r modifier in front of the string denotes that it is “raw”, so it should be read literally and ignore any special/escape characters.

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