Intermediate Java Bytecode and Class Loading Mechanisms
Assess your understanding of Java bytecode and class loading processes.
Questions in this quiz
12 questions on Intermediate Java Bytecode and Class Loading Mechanisms. Work through them here, then start the quiz to answer them and see your score.
1.What is the primary role of the Java ClassLoader?
- ATo manage memory allocation for Java objects
- BTo execute Java bytecode
- CTo compile Java source code into bytecode
- DTo load Java classes into the JVM
2.Which of the following is NOT a phase in the Java class loading process?
- AInitialization
- BLoading
- CLinking
- DCompilation
3.In Java bytecode, what does the 'invokestatic' instruction do?
- AInvokes a static method
- BCreates a new object
- CInvokes an instance method
- DReturns from a method
4.Which class loader is responsible for loading classes from the Java Runtime Environment (JRE)?
- AExtension ClassLoader
- BCustom ClassLoader
- CSystem ClassLoader
- DBootstrap ClassLoader
5.What is the purpose of the 'verify' phase in the linking process of class loading?
- ATo initialize static fields
- BTo ensure the class is loaded into memory
- CTo resolve symbolic references
- DTo check the correctness of the bytecode
6.How does the JVM handle multiple class loaders?
- ABy loading all classes with the Bootstrap ClassLoader
- BBy delegating class loading to the parent class loader
- CBy using a single global class loader
- DBy using a random class loader for each class
7.Which of the following is a characteristic of Java bytecode?
- AIt is executed directly by the CPU
- BIt is human-readable
- CIt is platform-dependent
- DIt is platform-independent
8.What happens if a class is not found during the loading phase?
- AThe JVM automatically creates a stub for the class
- BThe JVM throws a ClassNotFoundException
- CThe JVM terminates immediately
- DThe JVM continues execution without the class
9.Which instruction is used in Java bytecode to create a new object?
- Aanewarray
- Bnewobject
- Cnew
- Dnewarray
10.What is the role of the 'resolve' phase in class loading?
- ATo convert symbolic references to direct references
- BTo verify the class bytecode
- CTo initialize class variables
- DTo load the class into memory
11.Which of the following is true about the Extension ClassLoader?
- AIt loads classes from the Java extensions directory
- BIt loads classes from the system classpath
- CIt can load classes from any URL
- DIt is the parent of the Bootstrap ClassLoader
12.What does the 'initialize' phase in class loading involve?
- AExecuting static initializers and initializing static fields
- BLoading the class file into memory
- CVerifying the bytecode
- DResolving symbolic references