IPL / Mr. Hansen |
Name:
_________________________ |
“Big Quiz” (50 pts.) in preparation for Final Exam
Rules |
|
|
|
|
Part I: Terminology and Definitions (20 points; 5 points
per numbered problem) |
|
|
1. |
Is the JVM (Java Virtual
Machine) hardware, software, or neither? ________________ Explain briefly
what the purpose of the JVM is. Use the term byte code in your response. |
|
|
2. |
What is meant by truncation?
_______________________________________________ double
crubbly = 7.58; What would be the result of
each of the following? Fill in the blanks provided. Warning: You should know that the Math.floor
method, which is the mathematical “floor” function, always returns a double. System.out.println( (int) bubbly); //
_____________ System.out.println(Math.floor(bubbly)); // ___________ if ( (int)crubbly==(int)Math.floor(crubbly)) { System.out.println("same"); } else { System.out.println("different"); |
|
|
3. |
In a _____________________
(starts with an “H”) object model, each class except for the root class has
exactly one parent object class. Objects constructed (allocated) using a
class definition are said to be _________________ (starts with an “I”) of
that class. A subclass created from a higher-level class will start with all
the features of the higher-order class, following an OOP paradigm known as
______________________ (starts with an “I”), except for any changed methods
or data that may be present in the subclass. Such changes are an example of
_________________________ (starts with a “P”), which may be defined as the
ability of different objects to respond in different ways to the same
messages or environment. |
|
|
4. |
What Java calls “methods”
and what Python calls “functions” are examples of functional abstraction, or
more specifically, the _____________________ (starts with an “E”) of code details
within structures that other programmers should not have to tinker with. It
is a general OOP strategy to isolate the ____________________ (starts with an
“I”) details of any object or method from the ____________________ (also
starts with an “I”) that users and other programmers can see. OOP stands for
_______________________________ . |
|
Part II. Longer response (points as marked) |
|
|
5. |
(a) Draw a state diagram to
illustrate two pointers, A and B, that refer to two different objects that
have been allocated from available RAM. |
6. |
Write a Java method called swapIntegers that takes as its argument an array of ints. The requirements for your method are as follows: |
7. |
Write a Python program that
contains a function called brangle. Requirements
for your program are as follows: 2. The rest of the program
should call brangle for a range of input values
from −4 to 22, inclusive, and print those results, one per line. |