CS 0007 - Introduction to
Java - Midterm fully solved
2025(graded A+)
Major Components of a Computer - answer CPU, Memory/RAM, I/O,
Secondary Storage
Secondary Storage - answer External Hard Drive, Disk Drive (CD)
Variable - answer Symbolic names made up by the programmer that
represents locations in the computer's RAM
Keyword - answer Reserved words
Constants (declared final) - answer Symbolic names made up by the
programmer whose values cannot be changed
Binary Operators - answer Operators that perform operations in one
or more operands
What are the commands to compile and run a file called ReadIt.java?
- answer javac ReadIt.java
java Readit
True or False? The Java Virtual Machine is a program that reads Java
byte code instructions and executes them as they are read. - answer
True
In Java, the beginning of a line comment is marked with? - answer //
, In Java, _____ must be delared before they can be used. - answer
variables
If the following Java statements are executed, what will be
displayed?
System.out.println("The top three winners are\n");
System.out.println("Jody, the Giant\n");
System.out.print("Buffy, the Barbarian");
System.out.print("Adelle, the Alligator"); - answer The top three
winners are
Jody, the Giant
Buffy the BarbarianAdelle, The Alligator
Which of the following is NOT a primitive data type?
A) short
B) long
C) float
D) String - answer D) String
What will be displayed as a result of executing the following code?
int x = 5, y = 20;
x += 32;
y /= 4;
System.out.println("x = " + x + ",y = " +y); - answer x = 37, y = 5
The _____ statement is used to make simple decisions in Java -
answer if/else
Java - Midterm fully solved
2025(graded A+)
Major Components of a Computer - answer CPU, Memory/RAM, I/O,
Secondary Storage
Secondary Storage - answer External Hard Drive, Disk Drive (CD)
Variable - answer Symbolic names made up by the programmer that
represents locations in the computer's RAM
Keyword - answer Reserved words
Constants (declared final) - answer Symbolic names made up by the
programmer whose values cannot be changed
Binary Operators - answer Operators that perform operations in one
or more operands
What are the commands to compile and run a file called ReadIt.java?
- answer javac ReadIt.java
java Readit
True or False? The Java Virtual Machine is a program that reads Java
byte code instructions and executes them as they are read. - answer
True
In Java, the beginning of a line comment is marked with? - answer //
, In Java, _____ must be delared before they can be used. - answer
variables
If the following Java statements are executed, what will be
displayed?
System.out.println("The top three winners are\n");
System.out.println("Jody, the Giant\n");
System.out.print("Buffy, the Barbarian");
System.out.print("Adelle, the Alligator"); - answer The top three
winners are
Jody, the Giant
Buffy the BarbarianAdelle, The Alligator
Which of the following is NOT a primitive data type?
A) short
B) long
C) float
D) String - answer D) String
What will be displayed as a result of executing the following code?
int x = 5, y = 20;
x += 32;
y /= 4;
System.out.println("x = " + x + ",y = " +y); - answer x = 37, y = 5
The _____ statement is used to make simple decisions in Java -
answer if/else