final exam Flashcards

(38 cards)

1
Q

What naming convention do you use for variables and functions?

A

snake_case

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

What naming convention do you use for classes?

A

CamelCase / PascalCase

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

What naming convention do you use for constants?

A

UPPERCASE with underscores

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

What’s the maximum line length

A

79 characters

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

How many spaces do you use for indentation

A

4 spaces

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

How many lines do you use between functions

A

2 blank lines

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

What are ints?

A

Whole numbers

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

What are floats?

A

Decimal numbers

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

What are strings?

A

Text

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

What are bools?

A

true/false values

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

What are lists?

A

A group of data types, mutable (changeable) and ordered in brackets []

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

What are classes?

A

Templates for objects

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

What are objects?

A

Instances of classes

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

What is inheritance in classes?

A

When classes inherit properties from other classes

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

What are conditionals?

A

If, else, elif statements

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

What’s the difference between a for and while loop?

A

A for loop runs a certain number of times; A while loop runs while a condition is true

17
Q

What are the powers of two?

A

1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024

18
Q

How do you go from binary to number?

A

Add up the power of 2s for each position with a one (start with 1 and go from the right).

19
Q

How do you go from number to binary?

A

Write out powers of 2 (start with the largest one that’s smaller than the number), placing a 1 or 0 based on if the number is bigger/thesame or smaller. Subtract it if it’s bigger/the same.

20
Q

What is the role of the CPU

21
Q

What is the role of RAM

A

Temporary storage

22
Q

What is the role of ROM

A

Permanent storage

23
Q

What is the role of GPU

A

Graphics processing

24
Q

How do you initialize pygame?

A

import pygame
pygame.init()

25
What is Red, Green, Blue, White, and Black is RGB?
R: (255, 0, 0) G: (0, 255, 0) BE: (0, 0, 255) W: (255, 255, 255) BK: (0, 0, 0)
26
How do you make a pygame window/screen?
pygame.display.set_mode()
27
How do you draw in pygame?
pygame.draw.rect, line, circle, ellipse, polygon, arc
28
How do you update the display in pygame?
pygame.display.update()
29
How do you access the time for FPS in pygame?
pygame.time.Clock()
30
What is the format for functions?
def function_name(parameters) # function body return value
31
How do you access things in a list?
list[index]
32
How do you get the first element in a list?
list[0]
33
How do you make an empty list?
list_name = [] or list_name = list()
34
How do you get the length of a list or string?
len(list), len(string)
35
How do you make a string all lowercase or uppercase?
string.lower(), string.upper()
36
How do you handle Exception Errors?
try: #code that might raise an exception except: #handle exception
37
What happens when you multiply a string by a number?
It repeats it. Ex) "text" * 2 = "texttext"
38
What happens when you add a string by another string?
It combines it Ex) "text" + "text 2" = "texttext 2"