Consider the following dictionary:
dict = { 'aardvark' : 'anthony', 'buffalo' : 'boris', 'zebra' : 'zelda' }
What would be the out of the following:
dict['aardvark']
'anthony'
What is the out of the following?
>>>a[100, 30, 20]
>>>a
100, 30, 20
True or false, we need to import a method before we can parse XML files in Python.
True, we need to import ElementTree:
from xml.etree.ElementTree import *
What is wrong with the following function?
def addOne(number): print number + 1
Everything is one line / there is no block indentation.
What would be the output of the following?

False
Can len() be used with tuples? If so, why would you use it?
Yes, it would tell you the number of items in a tuple.
True or False:
each key in a dictionary must be unique
True
What is the output of the following?
>>>a[100, 30, 20]
>>>a[2]
20
Explain what a DTD file is and what is is used for.
A DTD (document type definition) file is a text file that specifies elements and attributes used in an XML document.
Which is correct?
if (x==2):
print "yes"
if (x=2):
print "yes"
The first,
if (x==2):
print "yes"
What is wrong with the following command entered at the console?

The context of the variable 'a' is only valid inside the function.
Consider the following tuple:
t = (0, 1, 2, 3, 4)
what would be the result of the follwoing?
t + (5, 6)
(0, 1, 2, 3, 4, 5, 6)
True or False:
Each key must be of a mutable type.
False, each key in a dictionary must be an immutable type.
Describe the code needed to set a list variable a that would store the values 100 and 20
>>> a[100, 20]
What is the following an example of?

A DTD file.
Write on the board the correct syntax to write "My Web Page" in the title of an HTML page. You only need to write the title tag, the rest of the HTML document can be assumed.
<title>My Web Page</title>
True or False:
A string is an immutable ordered collection of characters.
True - variable names can change, but the string itself is immutable (unchangeable).
Consider the following tuple.
t = (0, 1, 2, 3, 4)
what would be the output of the following?
t[-3]
2
the [-3] represents an index counting backwards from the end of the tuple.
Given the following dictionary, could you change the value corresponding to first key, 5? If so, how would you do this?
d = { 5:50, 9:90 }
Yes!
d[5] = 55
What is the output of the following?
>>>a['green', 'eggs', 'ham']
>>>a[0] * 3
greengreengreen
Review the following DTD file. How could you write this file if you chose to not use attributes in your XML?

Write on the board the correct HTML syntax to insert an image (flower1.jpg) into your page. You only need to write the image tag, the rest of the HTML document can be assumed.
<image src="flower1.jpg">
What would the following function do?

This would increase the volume of an audio file passed to it.
What is the difference between a tuple and a list?
The main difference between lists and a tuples is the fact that lists are mutable whereas tuples are immutable.
Consider the following dictionary:
dict = { 'aardvark' : 'anthony', 'buffalo' : 'boris', 'zebra' : 'zelda' }
What would be the output of:
dict.keys()
['aardvark', 'buffalo', 'zebra']

a[2] = a[2] + 23
Carefully examine the following XML and DTD file. Is this XML file valid? Why or why not?

No! It should look like the following representing the attributes properly:

Write on the board the syntax for declaring that a document is written in HTML (hint: the type of document).
<!DOCTYPE html>
Consider the following function. What would mystery(3) print?

3
2
1
What would the result be for the following set of statements?

TypeError: 'tuple' object does not support item assignment
Because t is a tuple which cannot be changed.