Python Turtle
Input Output Strings List
Encryption
While and Input Validation
Web and the Internet
100

In python what character precedes every indent (excepting level 0)?

: colon

100

What character in python is used to indicate that the line is a comment and not code to be evaluated and executed?

#

100

What does API stand for?

Application Programming Interface

100

What can happen when the condition on a while loop is always True?

infinite loop

100

Which tag is the root element of an HTML page?

<html>

200

How many lines of code are encapsulated by the second loop?

def drawHouses(num):
    for i in range(num):
        turtle.down()
        for i in range(4):
            turtle.forward(50)
            turtle.right(90)
        turtle.right(180)

2

200

Which import statement is required to make the following line of code work?

print(random.choice(texts))

import random

200

Which of the following statements does NOT evaluate to True or False?

a = b
a == b
a != b

a = b

200

Which loop in python is a condition controlled loop? (while, for, repeat, repeat until)

while

200

Which character is used to indicate an end tag?

/

300

What will be printed when this code is executed?

def mystery(num):
    for i in range(num):
        print("Hello World")
    print("done")
mystery(2)

Hello World
Hello World
done

300

In python, how do you create a variable called animal and set it equal to the string "dog".

animal = "dog"

300

What is the correct way to call the mystery function and print the return value?

def mystery(stuff):
  newstuff = ""
  for i in range(len(stuff)-1,-1,-1):
    newstuff += stuff[I]
  return newstuff

print(mystery("I love a good mystery"))

300

What will this code print?

x=0
while x < 5
  print(x)
  x = x+1
print ("done")

0
1
2
3
4
done

300

Who is making the Web standards?

The World Wide Web Consortium

400
Name a low level programming language

Binary

400

What line of code will get data from the user and put it in a variable called sound?

sound = input("Enter a sound: ")

400

What will the following code print?

def first():
  print("I am first")
  return
print(first())

I am first
None

400

Assume there are two valid conditions 'j' and 'k' and they are stored in the variable 'quest'. What would the while loop be?

while not (quest=="j" or quest=="k"):

400

What HTML tag does not have an end tag?

<br>

500

What does the following code draw:

    turtle.goto(0,-80)
    turtle.clear()
    turtle.pensize(10)
    turtle.color("yellow")
    turtle.goto(50,80)
  
    turtle.goto(-80,-20)
    turtle.goto(80,-20)
    turtle.goto(-50,80)
    turtle.goto(0,-80)

Star

500

What are two of the three rules for python identifiers (variable names, function names, etc)

1. Can't be python keywords

2. Can't contain spaces

3. Can't begin with a number

500

Decrypt this Caesar Cipher:

xeehqo oek wej vylu xkdthut feydji

Key: 10 to the right

Message: hooray you got five hundred points

500

What is still wrong with this debug it (the midterm template)?

def choice3():
  ans = input("The third choice: (up or down)  ")
  while not (ans == 'up' or ans == 'down'):
    ans = input("Invalid Input: Choose (up or down)? ")
    if ans == "up":
      print("up is a bad choice, game ended")
    else:
      print("down is the correct choice, game ended")

The indentation is not correct, so if you enter "up" or "down" the first time you won't see the answer.

def choice3():
  ans = input("The third choice: (up or down)  ")
  while not (ans == 'up' or ans == 'down'):
    ans = input("Invalid Input: Choose (up or down)? ")
  if ans == "up":
    print("up is a bad choice, game ended")
  else:
    print("down is the correct choice, game ended")

500

What is the difference between latency and bandwidth?

Latency measures how much time it takes to get from one place to another. Bandwidth measures capacity (how much traffic can use the route).

M
e
n
u