google form Flashcards

(18 cards)

1
Q

What is the output of this code?
for i in range(1, 8, 2):
print(i, end=” “)

A

1 3 5 7

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

What will be the output of: for i in range(3): print(i)?

A

012

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

What data type is used to represent whole numbers in Python?

A

int

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

Which statement will exit a loop prematurely?

A

break

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

How many bits are in a byte?

A

8

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

Which RGB value is white?

A

255 255 255

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

What component of a computer stores the BIOS?

A

ROM

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

What is the primary function of RAM in a computer?

A

temporary data storage

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

How can you convert a string to an integer in Python?

A

int(“string”)

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

What storage component provides temporary memory that clears when the computer shuts down?

A

RAM

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

In PEP 8, what is the recommended maximum line length?

A

79 characters

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

In Pygame, which method must be called to update the display?

A

pygame.display.update()

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

Which loop would be most appropriate for iterating through a list?

A

for

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

What does ‘self’ refer to in a Python class?

A

A reference to the current instance of the class

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

Which of the following is a valid float in Python?

A

3.0

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

What is the output of print(“Hello”[1:4])

17
Q

What is the purpose of a ‘for’ loop in Python?

A

To perform a task a specific number of times

18
Q

Which of these follows PEP 8 naming conventions for variables?