
Questions
1) Suppose I have an array of 100 ints in Perl and/or Python. It will take more space than storing the
100 ints would in C++ or Java. Why?
2) In Java, an integer is defined to be exactly four bytes. In C++, there is no such length definition.
What advantage does C++ gain by not defining the length of an int?
3) The federal government has debt. How much is your share? In other words, what is total federal
debt per person in the U.S.?
4) Some languages require the programmer to name the type of a variable. For example, in C++ and
Java, every variable is either an int or a float or a boolean or so on. Other languages make no such
requirement. Why might you want the language to require this of you?
5) Write me a regular expression that matches non-negative whole numbers as written in American as
shown below.
Good Good Bad Bad
1 123 0.1 0,12
1,234 0123 1a234 1234,5678
1,234,567,890 1234576 1234,567 123,4567
6) Suppose I have an associative array (dictionary) in Perl. It has 'n' elements. How long will it take to
look up an element given the key value? (Circle just one)
O(1) O(n) O(n * log(n)) O(n**2)
7) What does the code below mean in Lisp?
(fred)
a) The literal string "fred". b) The variable 'fred'
c) Call the function 'fred'. d) Run the program 'fred'.