Introduction To Java: Class 10 - Logix Kips Icse Computer Applications With Bluej
Introduction To Java: Class 10 - Logix Kips Icse Computer Applications With Bluej
Introduction To Java: Class 10 - Logix Kips Icse Computer Applications With Bluej
Introduction to Java
Class 10 - Logix Kips ICSE Computer Applications with
BlueJ
Multiple Choice Questions
Question 1
1. Machine language ✓
2. Assembly language
3. High-level language
4. English language
Question 2
Question 3
Question 4
Question 5
Question 6
A program that translates code written in a high-level language into machine code is
called ...........
1. Assembler
2. Linker
3. Compiler ✓
4. None of these
Question 7
A program that translates an assembly language program into machine code is called ...........
1. Assembler ✓
2. Linker
3. Compiler
4. None of these
Question 8
1. robust
2. object oriented
3. secure
4. All of these ✓
Question 9
Question 10
1. Windows platform
2. Macintosh platform
3. UNIX platform
4. All of these ✓
Question 11
Question 12
1. a void method
2. an overloaded method
3. a main method ✓
4. no methods
Question 13
1. .java ✓
2. .txt
3. .class
4. .BlueJ
Question 14
1. .obj
2. .java
3. .class ✓
4. .BlueJ
Question 15
Assignment Questions
Question 1
Answer
There are two types of Java programs — Java Stand-Alone Applications and Java Applets.
Java Applets
Java applets are Java applications that run within a web browser. They are mainly used for
internet programming. The applet is capable of performing many tasks on a web page, such as
displaying graphics, playing sounds, and accepting user input.
Question 2
Which language does the CPU understand?
Answer
Question 3
Answer
Question 4
Answer
In Java compilation process, the source code of a Java program is compiled to an intermediate
binary code called the Bytecode. This Bytecode cannot be directly executed by the machine. It is
understood by a virtual machine known as Java Virtual Machine or JVM. JVM contains a Java
interpreter which converts the Bytecode into machine code of the target computer. JVM is
platform specific i.e. each platform has its own JVM. But once the proper JVM is installed on
the machine, it can run any Java Bytecode program. The below diagram illustrates this:
Question 5
Answer
Program written in an interpreted language is converted into machine code line by line and
executed one line at a time whereas program written in a compiled language is converted into
machine code all at once and executed.
Question 6
Answer
In traditional compilation process, the machine language code generated by the compiler is
specific to the platform for which the source code is compiled. The executable file generated for
one platform like Windows will not work on other platforms like Macintosh. In Java compilation
process, the source code of a Java program is compiled to an intermediate binary code called the
Bytecode. This Bytecode is interpreted and executed by JVM on the target platform. Bytecode is
platform independent so the same Bytecode which is generated for one platform like Windows
will work on other platforms like Macintosh without any modifications.
Question 7
Answer
JVM
JVM stands for the Java Virtual Machine. It is a virtual machine that runs Java programs and can
be installed on several different operating systems such as Windows, UNIX, Macintosh etc.
JVMs allow Java programs to run on almost any computer. A JVM processes instructions similar
to a physical processor. However, the Java code (with "java" extension) must first be converted
into Bytecode that the JVM understands.
JIT
JIT is the Just-In-Time compiler included in the JVM that compiles selected portions of the
Bytecode into executable codes to improve the execution performance.
Question 8
Answer
It can be read and understood by humans. It is not human readable but is understood by
Source Code Object Code
machines.
Answer
Compiler Interpreter
It converts the whole source program into the It converts the source program into the object program,
object program at once. one line at a time.
It displays the errors for the whole program It displays the error one line at a time and only after fixing
together, after the compilation. that error the control goes to the next line.
Answer
It contains the Java source code of the program. It contains the Bytecode of the program.
Question 9
Answer
Bytecode and JVM makes Java programs platform independent. This is one of the most
important and powerful features of Java. The Bytecode of a Java program can be run on any
platform that has a corresponding JVM installed on it. No modifications to this Bytecode are
required. Hence, it is said that Java provides "Write once, run anywhere" capabilities.
Question 10.
Question 11
Answer
Question 12
What role does the Java Virtual Machine play in the compilation and interpretation process?
Answer
Java Virtual Machine or JVM is a virtual machine that runs Java programs. It takes the compiled
Bytecode as input, converts it into machine code with the help of the Java interpreter. Selected
portions of the Bytecode are also compiled by JVM using the Just-In-Time (JIT) compiler for
performance. This machine code generated by JVM is then executed by the processor. So JVM
along with Bytecode gives Java its "Write once, run anywhere" capabilities.
Question 13
Can Java run on any machine? What is required to run Java on a computer?
Answer