CPSC 124, Spring 2013
Sample Answers to Quiz #1
Question 1. What is machine language?
Answer. Machine language is a programming language consisting of simple instructions that can be executed directly by the CPU. Machine language instructions are coded as binary numbers.
Question 2. What is a variable?
Answer. A variable is a name for a location in memory, where values can be stored. A variable can be used in a program to refer to a value.
Question 3. What is the purpose of the javac command?
Answer. The javac command is used to translate Java source code (in a .java file) into machine language for the Java Virtual Machine (in a .class file). Once that's done, the program can be executed by applying the java command to the .class file.
Question 4. Briefly explain the meaning and significance of fetch-and-execute cycle.
Answer. The fetch-and-execute cycle is the basic operation performed by the CPU (Central Processing Unit) in a computer. The CPU "fetches" an instruction from the main memory, and "executes" that instruction. Then it goes on to the next instruction, and it repeats this cycle over and over indefinitely. This is how a computer executes machine language programs: It fetches instructions from the program one at a time, and executes them. The PC (Program Counter) is used to keep track of the address of the next instruction to be fetched and executed.