Introduction to Java

ICSE Class 9 Computer Applications · Solutions for Class 9 ICSE Logix Kips Computer Applications with BlueJ Java · 30 solved questions

Exercise
Marks
11 Mark · Multiple Choice Questions

Java applications ...........

Show SolutionHide Solution↓
  • Are platform independent ✓
  • 21 Mark · Multiple Choice Questions

    JVM stands for ...........

    Show SolutionHide Solution↓
  • Java Virtual Machine ✓
  • 31 Mark · Multiple Choice Questions

    JRE stands for ...........

    Show SolutionHide Solution↓
  • Java Runtime Environment ✓
  • 41 Mark · Multiple Choice Questions

    Stand-alone Java applications ........... for execution.

    Show SolutionHide Solution↓
  • Don't need Java-compatible web browser ✓
  • 51 Mark · Multiple Choice Questions

    Java uses ........... for execution.

    Show SolutionHide Solution↓
  • Compiler and interpreter ✓
  • 61 Mark · Multiple Choice Questions

    A program that translates code written in a high-level language into machine code is called ...........

    Show SolutionHide Solution↓
  • Compiler ✓
  • 71 Mark · Multiple Choice Questions

    A program that translates an assembly language program into machine code is called a/an ...........

    Show SolutionHide Solution↓
  • Assembler ✓
  • 81 Mark · Multiple Choice Questions

    Java is ...........

    Show SolutionHide Solution↓
  • All of these ✓
  • 91 Mark · Multiple Choice Questions

    Java can be used to write ...........

    Show SolutionHide Solution↓
  • Both stand-alone and internet applications ✓
  • 101 Mark · Multiple Choice Questions

    Java applications can run on ...........

    Show SolutionHide Solution↓
  • All of these ✓
  • 1State whether given statements are True or…

    Stand-alone Java applications cannot run independently on a computer.
    False

    Solution not available in the source paper.

    2State whether given statements are True or…

    A console based Java application is designed to be used via a text-only interface.
    True

    Solution not available in the source paper.

    3State whether given statements are True or…

    Java Applets are Java applications that run within a web browser.
    True

    Solution not available in the source paper.

    4State whether given statements are True or…

    The machine language version of the source code generated by the compilation process is specific to the processor you are compiling on.
    True

    Solution not available in the source paper.

    5State whether given statements are True or…

    The Bytecode files are generated with the ".java" extension.
    False

    Solution not available in the source paper.

    6State whether given statements are True or…

    Java uses a combination of compilation and interpretation.
    True

    Solution not available in the source paper.

    7State whether given statements are True or…

    Just-In-Time (JIT) compiler compiles selected portions of Bytecode into executable code.
    True

    Solution not available in the source paper.

    8State whether given statements are True or…

    An interpreter translates the source code instructions into machine code all at once.
    False

    Solution not available in the source paper.

    9State whether given statements are True or…

    JVM stands for Java Virtual Monitor.
    False

    Solution not available in the source paper.

    10State whether given statements are True or…

    Machine language for JVM is called Bytecode.
    True

    Solution not available in the source paper.

    1Assignment Questions

    Write a short note on types of Java programs.

    Show SolutionHide Solution↓

    There are two types of Java programs — Java Stand-Alone Applications and Java Applets.

    Java Stand-Alone Applications
    A stand-alone Java application refers to a Java program that can run independently on a computer. Acrobat Reader is an excellent example of this type of application. In Java, every stand-alone application begins its execution with the main() method. Java stand-alone applications can be classified into two types:
    a. Console based applications
    b. Graphical User Interface based applications

    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.

    2Assignment Questions

    How is Java platform independent?

    Show SolutionHide Solution↓

    Java applications are platform independent, which means that Java applications can be run on any platform. After Java source code is compiled, it is converted into bytecode. The bytecode is then interpreted by the JVM. JVM can be installed on several different operating systems such as Windows, UNIX, Macintosh, etc. JVM allows Java programs to run on almost any computer regardless of its hardware configuration. Due to this factor, Java is considered as a platform independent language.

    3Assignment Questions

    Describe the traditional compilation process with a suitable diagram.

    Show SolutionHide Solution↓

    In traditional compilation process, the machine language code generated by the compiler is specific to the platform for which the source code is compiled. Every high-level language has a separate platform specific compiler to generate the machine code that can run on the specific platform. For example, the executable file generated by compiling a C++ program on Windows platform will not run on Macintosh. It needs to be compiled with C++ Macintosh compiler. The below diagram illustrates this:

    ICSE Logix class 10 solutions illustrating Traditional Compilation Process
    4Assignment Questions

    Describe the Java compilation process with a suitable diagram.

    Show SolutionHide Solution↓

    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:

    ICSE Logix class 10 solutions illustrating Java Compilation Process
    5Assignment Questions

    How is traditional compilation process different from Java compilation process?

    Show SolutionHide Solution↓

    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.

    6Assignment Questions

    What are JVM and JIT?

    Show SolutionHide Solution↓

    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.

    7Assignment Questions

    Distinguish between the following:

    a. Source code and Object code

    Show SolutionHide Solution↓
    Source CodeObject Code
    It is a set of instructions written in a high-level programming language.It is the compiler generated machine language version of the source code.
    It can be read and understood by humans.It is not human readable but is understood by machines.

    b. Compiler and Interpreter

    CompilerInterpreter
    It converts the whole source program into the object program at once.It converts the source program into the object program, one line at a time.
    It displays the errors for the whole program together, after the compilation.It displays the error one line at a time and only after fixing that error the control goes to the next line.

    c. ".java" file and ".class" file

    ".java" file".class" file
    It contains the Java source code of the program.It contains the Bytecode of the program.
    It is written by human (programmer)It is generated by Java compiler.
    8Assignment Questions

    What is Java Bytecode?

    Show SolutionHide Solution↓

    The programs written in Java are compiled into a machine language for a virtual computer called Java Virtual Machine (JVM). The machine language for this special Java Virtual Machine is called Java Bytecode. The Bytecode files are generated with the ".class" extension.

    9Assignment Questions

    Describe the slogan, "Write once, run anywhere" in relation to Java.

    Show SolutionHide Solution↓

    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.

    10Assignment Questions

    Describe four features of Java.

    Show SolutionHide Solution↓

    Four features of Java are:

    1. Object Oriented — Java is an object-oriented programming language because it treats everything as an object. The entire program code and data resides within objects and classes. This enables us to easily use and extend the object model.
    2. Robust — Java is a robust and reliable programming language. It has strict compile time and runtime checking of data types. Memory allocation and de-allocation is automatic in Java, so there is less for the programmer to worry about.
    3. Platform Independent — The concept of "Write once, run anywhere", is one of the most important and powerful features of Java. Java applications can run on any platform that has a corresponding JVM installed on it.
    4. Simple — Java is simple and easy to learn programming language. The removal of many unreliable features of C and C++ (its predecessors) has simplified its understanding and implementation.

    Press ↓ to reveal a solution and move to the next question. Back to Solutions for Class 9 ICSE Logix Kips Computer Applications with BlueJ Java.