Definitions
Strings and lists
Decisions
Loops
Potpourri
100

A loop in which the condition is always tested at the top of the loop.

What is a pre-test loop?

100

s[2] if s = "computer science"

What is "m"?

100

The output of the following code:

x = 5              
y = 6              
if x*y >= 0:    
    print("yes")    
else:                
    print("no")   

What is "yes"?

100

A for loop is an indefinite loop.

What is false?

100

Compiler or interpreter: Tends to produce code that runs faster.

What is a compiler?

200

A value that can be assigned and re-assigned over and over again.

What is a variable?

200

my_string[-2:] if my_string = "Saint Mary's".

What is "'s"?

200

The output of the following code:

n = -7                          
if abs(n) <= 4:              
    if n > 0:                    
        print(2*n+1)          
    else:                          
        print(2*n)              
else:                              
    print(n, "out of range")

What is "-7 out of range"?

200

The output of:

for i in range(5):    
    print(i, end=" ") 

What is "0 1 2 3 4 "?

200

Binary number 10 in decimal notation.

What is 2?

300

A combination of literals, variables, calls to functions, and operators that produce a value.

What is an expression?

300

"".join(["a", "b", "c"])

What is "abc"?

300

The output of the following code:

n1, n2, n3 = 1, 2, 3
if n2 > n3:              
    print("one")        
elif n3 >= n1:          
    print("two")        
else:                       
    print("three")      

What is "two"?

300

The output of the following code:

for i in range(12, 3, -3):
    print(i//3)                

What is the following?

4
3
2

300

"Create a design" is the third step in the software development process.

What is true?

1. Analyze the problem
2. Determine specifications
3. Create a design
4. Implement the design (program)
5. Test/debug the program
6. Maintain the program

400

An operation that creates an object.

What is a constructor?

400

chars[4 + (pos + 1) % 4] if pos = 3 and chars = "ABCDabcd".

What is "a"?

400

The output of the following code:
x = 5        
if x >= 0:  
    print(1)  
elif x < 20: 
    print(2)  
else:          
    print(3)  

What is "1"?

400

The output of the following code:

again = True           
number = 0            
while again:            
    print(number//2) 
    number += 2      
    if number == 8: 
        again = False 

What is the following?

0
1
2
3

400

The methods index, pop, and split are all list methods.

What is false? (The split method is a string method.)

500

A loop that allows the user to repeat the loop on demand.

What is an interactive loop?

500

word.append("!") if word = "hi".

What is an (attribute) error? (The append method is a list method, not a string method.)

500

a, b = 7, 15
if a != 1:    
    b = 4    
    a = 30  
else:          
    a = 5    
    b = 10  
b = b//a      
print(a, b)   

What is "30 0"?

500

The output of the following code:

i = 2                    
while i > 0:          
    print(i, end=" ")
    i -= 1               

What is "2 1 "?

500

Hexadecimal number 0x4A in binary notation.

What is 1001010?

M
e
n
u