AP Java Beginning Unit Quiz – Python vs. Java

Fred Zimmerman

1. Java is _________ typed, Python is ____________ typed. In Python you never have to _________ variables, whereas in Java it is mandatory to do so.

2. With container objects, Python containers can hold objects of any type including numers and _________ (collections)

3. When you retrieve an object from a container, it remembers its type, so no ______ is required (Java requires _______ when retrieving an individual element from its containter).

4. Java is a verbose language vs. Python being _______ language.

5. Java is _____ forgiving then Python.

6. To run a program, Java must first be _______. Python on the other hand is _________.

7. Java exceptions (errors) must be caught or thrown by every method in which they might appear, these are called _______ exceptions. Python _________ propogates exceptions upward in the method call chain without having to have the exceptions in each method.

8. With the concept of method overloading Java can have _________ constructors; Python has ____________ constructor.

9. Python has one control character __________ that Java does not.

10. Java has _____ top level public [classes] per file; Python allows _______ classes per file.

KEY: (http://www.ferg.org/projects/python_java_side-by-side.html)

1. statically (Java), dynamically (Python). Declare
2. lists, arrays
3. casting, casting
4. concise
5. less
6. Compiled, interpreted.
7. checked, automatically
8. multiple, single

9. indentation

10. one, multiple