THINK FIRST·CODE LATER

← Java Programming
Chapter 1 · Week 1

Computers, Programs, and the Java Language

Answered 0/40 Correct 0
Sign in to save progress across devices
Q1

Which of the following is not a hardware component?

Q2

Which statement about main memory (RAM) is correct?

Q3

Which component of the CPU performs arithmetic and logical operations?

Q4

One byte consists of how many bits?

Q5

Which of the following is system software?

Q6

Which device is both an input and an output device?

Q7

What is the correct name for a program that translates an entire high-level program into object code before execution?

Q8

A ________ is a program that executes compiled Java code on a specific platform.

Q9

The keyword ________ is required in order to declare a class.

Q10

What file does the Java compiler produce from Payroll.java?

Q11

Bytecode is best described as:

Q12

Which command correctly runs a compiled class named Demo?

Q13

Java is often described as both compiled and interpreted because:

Q14

Which of the following best explains Java's portability?

Q15

What is the relationship between the JDK and the JRE?

Q16

A public class named StudentRecord must be saved in a file named:

Q17

Which of the following method signatures is a valid declaration of an entry point in a Java application?

Q18

What is the output of the following application?

public class Greeting {
    public static void main(String[] args) {
        System.out.print("Good ");
        System.out.print("morning");
        System.out.println("!");
        System.out.println("Class");
    }
}
Q19

Which of the following is a legal Java identifier?

Q20

Why can new not be used as a variable name?

Q21

Which pair of identifiers refers to two different things in Java?

Q22

Which symbol terminates a Java statement?

Q23

What is the purpose of a pair of braces { } in a Java program?

Q24

Which comment form is used to generate API documentation?

Q25

What happens to comments when a program is compiled?

Q26

The difference between System.out.print and System.out.println is that:

Q27

Missing a semicolon at the end of a statement produces:

Q28

Dividing an integer by zero at run time produces:

Q29

A program that computes the average of three numbers as (a + b + c) / 2 contains:

Q30

Which type of error can the compiler not detect?

Q31

Put the following steps of program development in the correct order: (i) run, (ii) edit source code, (iii) compile, (iv) test and debug.

Q32

An IDE (Integrated Development Environment) typically combines:

Q33

Which statement about the main method's parameter is true?

Q34

What is the result of compiling and executing the following class?

public class Test {
    public static void Main(String[] args) {
        System.out.println("Running");
    }
}
Q35

Which of the following is stored in secondary storage rather than in RAM?

Q36

Which statement is false?

Q37 Short answer

In two or three sentences, explain the difference between source code and object code, and name the tool that converts one into the other in Java.

Q38 Short answer

Explain, in your own words, why a .class file produced on a Windows machine can be executed on a Mac without being recompiled.

Q39 Short answer

Give one example each of a compile-time error, a run-time error and a logic error in a program that computes a student's average mark.

Q40 Programming

Write a complete Java program in a file Introduction.java that prints your name on the first line, your student ID on the second, and the sentence I am learning Java. on the third, using exactly one println per line. Add a javadoc comment above the class stating what the program does.