Deck 8: Java Thread Class, Exception Handling, and Garbage Collection

Full screen (f)
exit full mode
Question
Under what circumstances might you use the yield method of the Thread class

A)To call from the currently running thread to allow another thread of the same or higher priority to run
B)To call on a waiting thread to allow it to run
C)To allow a thread of higher priority to run
D)To call from the currently running thread with a parameter designating which thread should be allowed to run
Use Space or
up arrow
down arrow
to flip the card.
Question
Which of the following is the correct syntax for suggesting that the JVM performs garbage collection?

A)System.free();
B)System.setGarbageCollection();
C)System.out.gc();
D)System.gc();
Question
A class that cannot be a subclass is called as______ class.

A)abstract
B)parent class
C)Final
D)none of these
Question
When method defined in subclass which has same signature as a method in a super class, it is known as method

A)Overloading
B)Overriding
C)Packing
D)None of these
Question
Which of the following statement is correct?

A)For positive numbers, result of operators >> and >>> are same
B)Java provides two operators to do left shift <<< and <<
C)>> is the zero fill right shift operator
D)>>> is the signed right shift operator
Question
Java language has support for which of the following types of comment ?

A)block, line and javadoc
B)javadoc, literal and string
C)javadoc, char and string
D)single, multiple and quote
Question
Consider the following program:
Import myLibrary.*;
Public class ShowSomeClass
{
// code for the class...
}
What is the name of the java file containing this program?

A)myLibrary.java
B)ShowSomeClass.java
C)ShowSomeClass
D)ShowSomeClass.class 1.
Question
Which of the following is TRUE?

A)In java, an instance field declared public generates a compilation error.
B)int is the name of a class available in the package java.lang
C)Instance variable names may only contain letters and digits.
D)A class has always a constructor (possibly automatically supplied by the java compiler).
Question
Consider the following code snippet
String river = new String("Columbia");
System.out.println(river.length());
What is printed?

A)6
B)7
C)8
D)Columbia
Question
What is different between a Java applet and a Java application?

A)An application can in general be trusted whereas an applet can't.
B)An applet must be executed in a browser environment.
C)An applet is not able to access the files of the computer it runs on
D)(A), (B) and (C).
Question
You read the following statement in a Java program that compiles and executes.
Submarine.dive(depth);
What can you say for sure?

A)depth must be an int
B)dive must be a method.
C)dive must be the name of an instance fie
Question
Consider
Public class MyClass
{
Public MyClass(){/*code*/
}
// more code...
}
To instantiate MyClass, you would write?

A)MyClass mc = new MyClass();
B)MyClass mc = MyClass();
C)MyClass mc = MyClass;
D)MyClass mc = new MyClass;
Question
In Java Inheritance

A)all fields of a class are private
B)all fields of a class are protected
C)a new class is derived from an existing class
D)none of these above
Question
When does Exceptions in Java arises in code sequence?

A)Run Time
B)Compilation Time
C)Can Occur Any Time
D)None of the mentioned
Question
Which of these keywords is not a part of exception handling?

A)try
B)finally
C)thrown
D)catch
Question
Which of these keywords is used to manually throw an exception?

A)try
B)finally
C)throw
D)catch
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/16
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 8: Java Thread Class, Exception Handling, and Garbage Collection
1
Under what circumstances might you use the yield method of the Thread class

A)To call from the currently running thread to allow another thread of the same or higher priority to run
B)To call on a waiting thread to allow it to run
C)To allow a thread of higher priority to run
D)To call from the currently running thread with a parameter designating which thread should be allowed to run
To call from the currently running thread to allow another thread of the same or higher priority to run
2
Which of the following is the correct syntax for suggesting that the JVM performs garbage collection?

A)System.free();
B)System.setGarbageCollection();
C)System.out.gc();
D)System.gc();
System.gc();
3
A class that cannot be a subclass is called as______ class.

A)abstract
B)parent class
C)Final
D)none of these
Final
4
When method defined in subclass which has same signature as a method in a super class, it is known as method

A)Overloading
B)Overriding
C)Packing
D)None of these
Unlock Deck
Unlock for access to all 16 flashcards in this deck.
Unlock Deck
k this deck
5
Which of the following statement is correct?

A)For positive numbers, result of operators >> and >>> are same
B)Java provides two operators to do left shift <<< and <<
C)>> is the zero fill right shift operator
D)>>> is the signed right shift operator
Unlock Deck
Unlock for access to all 16 flashcards in this deck.
Unlock Deck
k this deck
6
Java language has support for which of the following types of comment ?

A)block, line and javadoc
B)javadoc, literal and string
C)javadoc, char and string
D)single, multiple and quote
Unlock Deck
Unlock for access to all 16 flashcards in this deck.
Unlock Deck
k this deck
7
Consider the following program:
Import myLibrary.*;
Public class ShowSomeClass
{
// code for the class...
}
What is the name of the java file containing this program?

A)myLibrary.java
B)ShowSomeClass.java
C)ShowSomeClass
D)ShowSomeClass.class 1.
Unlock Deck
Unlock for access to all 16 flashcards in this deck.
Unlock Deck
k this deck
8
Which of the following is TRUE?

A)In java, an instance field declared public generates a compilation error.
B)int is the name of a class available in the package java.lang
C)Instance variable names may only contain letters and digits.
D)A class has always a constructor (possibly automatically supplied by the java compiler).
Unlock Deck
Unlock for access to all 16 flashcards in this deck.
Unlock Deck
k this deck
9
Consider the following code snippet
String river = new String("Columbia");
System.out.println(river.length());
What is printed?

A)6
B)7
C)8
D)Columbia
Unlock Deck
Unlock for access to all 16 flashcards in this deck.
Unlock Deck
k this deck
10
What is different between a Java applet and a Java application?

A)An application can in general be trusted whereas an applet can't.
B)An applet must be executed in a browser environment.
C)An applet is not able to access the files of the computer it runs on
D)(A), (B) and (C).
Unlock Deck
Unlock for access to all 16 flashcards in this deck.
Unlock Deck
k this deck
11
You read the following statement in a Java program that compiles and executes.
Submarine.dive(depth);
What can you say for sure?

A)depth must be an int
B)dive must be a method.
C)dive must be the name of an instance fie
Unlock Deck
Unlock for access to all 16 flashcards in this deck.
Unlock Deck
k this deck
12
Consider
Public class MyClass
{
Public MyClass(){/*code*/
}
// more code...
}
To instantiate MyClass, you would write?

A)MyClass mc = new MyClass();
B)MyClass mc = MyClass();
C)MyClass mc = MyClass;
D)MyClass mc = new MyClass;
Unlock Deck
Unlock for access to all 16 flashcards in this deck.
Unlock Deck
k this deck
13
In Java Inheritance

A)all fields of a class are private
B)all fields of a class are protected
C)a new class is derived from an existing class
D)none of these above
Unlock Deck
Unlock for access to all 16 flashcards in this deck.
Unlock Deck
k this deck
14
When does Exceptions in Java arises in code sequence?

A)Run Time
B)Compilation Time
C)Can Occur Any Time
D)None of the mentioned
Unlock Deck
Unlock for access to all 16 flashcards in this deck.
Unlock Deck
k this deck
15
Which of these keywords is not a part of exception handling?

A)try
B)finally
C)thrown
D)catch
Unlock Deck
Unlock for access to all 16 flashcards in this deck.
Unlock Deck
k this deck
16
Which of these keywords is used to manually throw an exception?

A)try
B)finally
C)throw
D)catch
Unlock Deck
Unlock for access to all 16 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 16 flashcards in this deck.