Answers with explanations are posted at the bottom of the page.
Q1: What is a source code?
(A) It’s the code in the operating system.
(B) It’s the machine code.
(C) It’s the file that contains Java program code.
(D) It’s the file generated by the compiler.
(E) It’s the byte code.
Q2: Which of the following describe the correct sequence? Choose all that apply.
(A) Write Code –> Compile –> Execute
(B) Interpret –> Compile –> Execute
(C) Source Code –> Byte Code
(D) Byte Code –> Source Code
Q3: Which of the following is the correct command to compile “Hello.java” source code?
(A) java Hello.java
(B) javac Hello.java
(C) java Hello
(D) javac Hello
Q4: Find the true statement(s).
(A) High-level language has high level of intelligence
(B) Low-level language has low-level of intelligence
(C) Java is a high-level language
(D) Computer understands Java
(E) Computer understands low-level language
Q5: Find the true statement(s).
(A) Machine code is written in 0
s and 1
s
(B) Machine code is written by machines
(C) Machine code is written by humans
(D) Machine code is source code
(E) Machine code is low-level language
Answers
Q1: Answer: C
Source code refers to the file that contains the program code. It’s the file with the extension .java.
Q2: Answer: A, C
(A) First you write a program. Compile it. Then run (execute) it.
(C) Source code is translated to a byte code during compilation step.
Q3: Answer: B
The correct command is javac <sourcecode.java>
For a file “Hello.java”, the correct command is javac Hello.java
Q4: Answer: C, E
Computer only understands machine code which is a low-level language. Java is a high-level language. This is why it’s compiled to be translated to a bytecode (a machine code version).
Q5: Answer: A, E
Machine code is a low-level language written in 0
s and 1
s (binary digits).
2022 Copyright