Java's Class Library and Garbage Collector Flashcards

1
Q

What is the Java Class Library (JCL)?

a) A collection of Java Virtual Machines
b) A set of common libraries that developers must download separately
c) A collection of commonly used programming resources and packages
d) A group of Java applications for advanced users

A

c) A collection of commonly used programming resources and packages

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which Java package contains basic classes and interfaces such as the Object class and the Thread class?

a) java.sql
b) java.math
c) java.lang
d) java.util

A

c) java.lang

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What can the java.math package be used for?

a) Managing SQL database connections
b) Performing basic math operations such as logarithms and trigonometry
c) Formatting text and dates
d) Creating multi-threaded programs

A

b) Performing basic math operations such as logarithms and trigonometry

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which Java package would you use to format text and dates?

a) java.sql
b) java.math
c) java.lang
d) java.text

A

d) java.text

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the primary purpose of Java’s garbage collector?

a) To allocate new resources for all variables
b) To automatically clean up unused objects and free up resources
c) To optimize the performance of mathematical calculations
d) To interpret bytecode into machine code

A

b) To automatically clean up unused objects and free up resources

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is considered an unused object in the context of Java’s garbage collector?

a) An object that is still being referenced by the program
b) An object that has not been created yet
c) An object no longer referenced by any part of the running program
d) An object that is allocated but never initialized

A

c) An object no longer referenced by any part of the running program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does Java’s garbage collector do when it identifies unreferenced objects?

a) It reallocates them for future use
b) It deletes them and frees up resources like memory and processor time
c) It stores them in a temporary buffer
d) It compresses them to save space

A

b) It deletes them and frees up resources like memory and processor time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which language feature makes garbage collection unnecessary in Java?

a) Explicit resource allocation and deallocation by the developer
b) Use of the malloc and free functions
c) Built-in garbage collector that runs automatically
d) Manual memory management

A

c) Built-in garbage collector that runs automatically

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which of the following is a downside of Java’s automatic garbage collector?

a) It cannot identify unused objects
b) It requires the developer to free memory explicitly
c) It adds some additional overhead by consuming resources itself
d) It only works for dynamic programming languages

A

c) It adds some additional overhead by consuming resources itself

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are JVM languages?

a) Languages that run only on Java Virtual Machines with no compilation
b) Languages with interpreters that translate directly to machine code
c) Languages that can be compiled into JVM bytecode and run on a JVM
d) Languages that are incompatible with Java syntax

A

c) Languages that can be compiled into JVM bytecode and run on a JVM

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which of the following JVM languages is primarily used for Android app development?

a) Groovy
b) Scala
c) Clojure
d) Kotlin

A

d) Kotlin

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which JVM language is closely related to the Lisp programming language?

a) Scala
b) Kotlin
c) Groovy
d) Clojure

A

d) Clojure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What makes learning JVM languages easier for Java developers?

a) All JVM languages use a completely different syntax from Java
b) JVM languages have similar syntax and structure to Java
c) Java developers must learn JVM languages from scratch
d) JVM languages do not run on the Java Virtual Machine

A

b) JVM languages have similar syntax and structure to Java

How well did you know this?
1
Not at all
2
3
4
5
Perfectly