Chapter 2 and 3 Flashcards

1
Q

What function do you use to read a string?

A

input(“Enter a string”)

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

Result of eval(“1 + 3 * 2”)

A

7

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

____ is the code in natural language mixed with some program code.

A

Pseudocode

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

An identifier cannot be a keyword.

A

True

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

What is an identifier?

A

Identifier are names that identify elements such as variable and functions in a program (number1, number2, number3, average, input, eval)

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

An identifier can contain digits, but cannot start with a digit.

A

True

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

Which of the following is a valid identifier?

A

mile1 (Is not import because it is a keyword, which are reserved words)

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

If you enter 1 2 3 in separate lines, when you run this program, what will be displayed?
average = (number1 + number2 + number3) / 3

A

2.0 (Because / is floating point, // is integer)

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

What is the result of 45 / 4?

A

11.25

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

Value 1 means remainder of 1 when using %

A

Value 1 means remainder of 1 when using %

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

2 ** 3 evaluates to ___.

A

8 (An integer, not float point)

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

When x *= y + 1, formula is?

A

x = x (y + 1)

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

To add number to sum, you write:

A

sum += number (?)

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

min(3, 5, 1, 7, 4)

A

1 min is minimum

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

s is “Welcome.” What is s.upper()?

A

WELCOME

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