Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Tyler Clontz Computer Science August 26, 2007 2.1 1. What is a portable program? A program that can be run on different types of computers without change 2. Describe two features of Java that make it a better language than C++. It is more portable and better suited for the internet 3. What is a thread? Describe how threads might be used in a program. It is a process that can be run concurrently with other processes. Transfer an image across a network while at the same time another thread interacts with the user 2.2 1. What does JVM stand for? Java Virtual Machine 2. What is byte code? Describe how the JVM uses byte code. A pseudomachine language that the Java compiler translates Java into. It translates byte code into machine language when it is first encountered to the next time the instruction is encountered it is executed much quicker in machine code. 3. What is an applet? Describe how applets are used. A small Java program already translated into byte code. They are used to run some kind of streaming video, whether it is a comical character or stock quotes. 2.4 1. Give a short definition of “program.” A sequence of instructions for a computer 2. What is the effect of the message println? It allows for the statements following to be displayed on the screen 3. Describe how to use the System.out object. You type this in order to display or print characters in a terminal window 4. Write a sequence of statements to display your name, address, and phone number in the terminal window. System.out.println(“Tyler Clontz”); System.out.println(“1979 Peppers Ferry Rd, Pulaski VA”); System.out.println(“(540) 980-3305”); 2.5 1. Name the three steps in writing and running a program. Edit Compile Execute 2. What are compile-time errors? Mistakes detected by the compiler 3. Find the compile-time errors in the following statements: a/ System.out.println(“Here is an error); Tyler Clontz Computer Science August 26, 2007 There are no quotation marks after the statement desired to be displayed on the screen and before the parentheses. b/ System.out.println(“Here is another error”; There is no parentheses after the second quotation mark 4. Why is readability a desirable characteristic of a program? Because programs usually have a long life and are maintained by people other than their original authors 2.6 1. What is a variable in a program and how is it used? It is a location in the RAM in which a number can be stored 2. Describe the role of the assignment (=) operator in program. It is the symbol that stores the number as the specific variable 3. What is a KeyboardReader object? It allows for the user to enter a number into the program while it is running. Ex: The program is designed to find the area of a square so it asks for the side length and the user types in 5 and the program uses this number to come up with the answer. 4. Explain the difference between a variable of type double and a variable of type KeyboardReader. Type double deals with numbers while type KeyboardReader deals with class 5. Describe the difference between print and println and give an appropriate example of the use of each. When you use print, the line of text that comes up when the program is running will have the cursor after it on the same line and println will have the cursor at the beginning of the next line. You would use print if you were trying to determine the answer of a mathematical problem before the program did. You would use println if you wanted the computer to do the work to solve a mathematical problem.