PrepAway - Latest Free Exam Questions & Answers

Which of the following best describes the role of the Java Virtual Machine in the execution of Java applets?

Which of the following best describes the role of the Java Virtual Machine in the execution of Java applets?

PrepAway - Latest Free Exam Questions & Answers

A.
Converts the source code into bytecode and blocks the sandbox

B.
Converts the bytecode into machine-level code

C.
Operates only on specific processors within specific operating systems

D.
Develops the applets, which run in a user’s browser

Explanation:
B: Java is an object-oriented, platform-independent programming language. It is employed as a full-fledged programming language and is used to write complete programs and
short programs, called applets, which run in a user’s browser. Java is platform independent because it creates intermediate code, bytecode, which is not processor-specific. The Java
Virtual Machine (JVM) then converts the bytecode into machine-level code that the processor on the particular system can understand.
A is incorrect because the Java Virtual Machine converts the bytecode into machine-level code. It does not convert the source code into bytecodea Java compiler does that. The
JVM also creates a virtual machine within an environment called a sandbox. This virtual machine is an enclosed environment in which the applet carries out its activities. Applets are
commonly sent over HTTP within a requested Web page, which means the applet executes as soon as it arrives. It can carry out malicious activity on purpose or accidentally if the
developer of the applet did not do his part correctly. So the sandbox strictly limits the applet’s access to any system resources. The JVM mediates access to system resources to
ensure the applet code behaves and stays within its own sandbox.
C is incorrect because Java is an object-oriented, platform-independent programming language. Other languages are compiled to object code for a specific operating system and
processor. This is why a particular application may run on Windows but not on Macintosh. An Intel processor does not necessarily understand machine code compiled for an Alpha
processor, and vice versa. Java is platform-independent because it creates intermediate codebytecodewhich is not processor-specific.
D is incorrect because the Java Virtual Machine does not write applets. Java is employed as a full-fledged programming language and is used to write complete programs and short
programs, called applets, which run in a user’s browser. A programmer creates a Java applet and runs it through a compiler. The Java compiler converts the source code into
bytecode. The user then downloads the Java applet. The bytecode is converted into machine-level code by the JVM. Finally, the applet runs when called upon.

One Comment on “Which of the following best describes the role of the Java Virtual Machine in the execution of Java applets?

  1. joe says:

    Java is platform independent because it creates intermediate code, bytecode, which is not processor-specific. The Java Virtual Machine (JVM) then converts the bytecode into machine-level code that the processor on the particular system can understand.




    0



    0

Leave a Reply