front 1 How does a computer’s main memory differ from its auxiliary memory? | back 1 Main memory holds the current program and much of the data that the program is manipulating. The information stored in main memory typically is volatile, that is, it disappears when you shut down your computer.
|
front 2 After you use a text editor to write a program, will it be in main memory or auxiliary memory? | back 2 After you have closed the text editor it will be in auxiliary memory. |
front 3 When a computer executes a program, will it be in main memory or auxiliary memory? | back 3 The program will be in main memory. |
front 4 How does machine language differ from Java? | back 4 Machine language is the languange a computer can directly understand. Java is a programming language that is relatively easy for people understand and use. In order for a computer to run a Java program, it must first be translated into machine language. |
front 5 How does bytecode differ from machine language? | back 5 When you compile a java class it is translated into bytecode. Bytecode is a machine language for a hypothetical computer know as a virtual machine. When you run a java program, the Java Virtual Machine (JVM) translates the bytecode into machine code. |
front 6 What would the following statements, when used in a Java program, display on the screen?
| back 6 My age is
|
front 7 Write a statement or statements that can be used in a Java program to display the following on the screen:
| back 7 System.out.println("3");
|
front 8 Write statements that can be used in a Java program to read your age, as entered at the keyboard, and display it on the screen. | back 8 java.util.Scanner keyboard = new java.util.Scanner(System.in);
|
front 9 Given a person's year of birth, the Birthday Wizard can compute the year in which the person's nth birthday will occur or has occurred. Write statements that can be used in a Java program to perform this computation for the Birthday Wizard. | back 9 java.util.Scanner keyboard = new java.util.Scanner(System.in);
|
front 10 Write statements that can be used in a Java program to read two integers and display the number of integers that lie between them, including the integers themselves. For example, four integers are between 3 and 6: 3, 4, 5, and 6. | back 10 java.util.Scanner keyboard = new java.util.Scanner(System.in);
|
front 11 A single bit can represent two values: 0 and 1. Two bits can represent four values: 00, 01, 10, and 11. Three bits can represent eight values: 000, 001, 010, 011, 100, 101, 110, and 111. How many values can be represented by
| back 11 (a)256
|
front 12 Find the documentation for the Java Class Library on the Oracle Web site. (At this writing, the link to this documentation is http://docs.oracle.com/javase/7/docs/api/.) Then find the description for the class Scanner. How many methods are described in the section entitled "Method Summary"? | back 12 55 |
front 13 Self-Test Question 27 asked you to think of some attributes for a song object. What attributes would you want for an object that represents a play list containing many songs? | back 13 Genre, Song Count, Total Time, List of Performers |
front 14 What behaviors might a song have? What behaviors might a play list have? Contrast the difference in behavior between the two kinds of objects. | back 14 Song: Play, Pause, Stop
|
front 15 What attributes and behaviors would an object representing a credit card account have? | back 15 Attributes: Card Type, Card Number, Card Holder's Name (First and Last), Card Holder's Address (Street, City, State and Zip), Expiration Date (Month and Year), Credit Limit, Balance
|
front 16 Suppose that you have a number x that is greater than 1. Write an algorithm that computes the largest integer k such that 2^k is less than or equal to x. | back 16 x is greather than 1
|
front 17 Write an algorithm that finds the maximum value in a list of values. | back 17 maxValue = -1
|
front 18 Write statements that can be used in a Java applet to draw the five interlocking rings that are the symbol of the Olympics. (Don't worry about the color.) | back 18 public void paint(Graphics g)
|
front 19 Find the documentation for the class Graphics in the Java Class Library. (See Exercise 12.) Learn how to use the method drawRect. Then write statements that can be used in a Java applet to draw a square containing a circle. The circle's diameter and the square's side should be equal in size. | back 19 public void paint(Graphics g)
|
front 20 Write statements that can be used in a Java applet to draw the outline of a crescent moon. | back 20 public void paint(Graphics g)
|