Halaman

Tuesday, July 21, 2020

Section 7 Quiz Java Programming 2019 Learner - English

Section 7
(Answer all questions in this section)

Which of the following statements is NOT TRUE for the JVM heap?


Java Developer can explicitly allocate and deallocate the Heap Memory. (*)


The Heap can be managed by the Garbage Collector.


The Heap can be shared among all Java threads.


Class instance and arrays are allocated in the Heap Memory.





The function of Garbage Collection in Java is:


The JVM uses GC to clear the program output.


The JVM GC deletes all unused Java files on the system.


Memory occupied by objects with no reference is automatically reclaimed for reuse. (*)


As a Java programmer, we have to call the GC function specifically in order to manage the Java Memory.



Given the following code snippet:

String str = new String("Hello");
The "Hello" String literal will be located in which memory area in the JVM during runtime?


In the Heap area of the run-time data area in the JVM.


In the Method area of the run-time data area in the JVM.


In the Stack area of the run-time data area in the JVM.


In the constant pool area of the run-time data area in the JVM. (*)



Given the following code snippet:

String str = new String("Hello");
The str variable will be located in which memory area in the JVM during runtime?


str will stay in the heap area of the run-time data area in the JVM.


str will stay in the method area of the run-time data area in the JVM.


str will stay in the stack area of the run-time data area in the JVM. (*)


str will stay in the heap area of the constant pool run-time data area in the JVM.



Which of following statements describes Parallel and Serial Garbage collection?


A Serial garbage collector uses multiple threads to manage heap space.


A Parallel garbage collector uses multiple threads to manage heap space. (*)


A Parallel garbage collector uses multiple threads to manage stack space.


A Serial garbage collector uses multiple threads to manage stack space.


Which of the following allows the programmer to destroy an object referenced by x?


x.remove();


x.finalize();


x.delete();


Only the garbage collection system can destroy an object. (*)



Given the following output from the Minor GC:
[PSYoungGen: 9200K->1008K(9216K)] 9980K->3251K(19456K), 0.0045753 secs] [Times:user=0.03 sys=0.03, real=0.00 secs]
Which of the following statements is TRUE?


The pause time spent in GC is 0.03.


The size of the entire heap is 19456k (*)


This is a major garbage collection process.


The size of the tenured space is 19456k.



Which of the following statements is NOT true of the Java programming language?


All source code is written in plain text files with the extension .java.


Java source code files are compiled into .class files by the javac command.


The javac command can be used to run a Java application. (*)


A .class file contains platform independent bytecode.



During runtime, the Java platform loads classes dynamically as required.


True (*)


False



Given the java snippet below:

public class Foo{
   int x;
   public void testFoo(){
      int y=100;
   }
}

Which of the following statements is TRUE?


Compile error, as the variable x is not initialized.


Variable x resides in the stack area, and variable y resides in the heap of the JVM.


Variable x resides in the heap area, and variable y resides in the stack of the JVM (*)


Variable x stays in the heap area, and variable y resides in the method area of the JVM.


One of the primary goals of the Java platform is to provide an interpreted, just-in-time run time environment.


True (*)


False



Which of the following converts a human-readable file into a platform-independent code file in Java?


JRE


JDK


javac command (*)


java command



Which of the following statements is NOT TRUE about the JVM?


The JVM is a virtual Machine that acts as an intermediary layer between the Java Application and the Native Operating System.


The JVM reads byte code from the class file, and generates machine code.


The JVM does not understand the Java language specification.


The JVM reads Java source code, and then translates it into byte code. (*)



Which of the following statements describe the Java programming language?


Java is a high-level programming language.


The Java programming language includes a garbage collection feature.


Java is an object oriented programming language.


All of the above (*)



Java allows the same Java program to be executed on multiple operating systems.


True (*)


False

1 comment:

  1. Given the following output from the Minor GC:
    [GC [DefNew: 4032K->64K(4032K), 0.0429742 secs] 9350K->7748K(32704K), 0.0431096 secs]
    What estimated percentage of the Java objects will be promoted from Young space to Tenured space?
    0.2
    0.4
    0.6 (*)
    0.8
    0.9

    ReplyDelete

Final Exam Java Programming 2019 Learner - English

Final Exam