Deck 19: Java Never Ends
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/26
Play
Full screen (f)
Deck 19: Java Never Ends
1
An alternative to deriving a thread from the Thread class is to inherit the Runnable interface.
False
2
The programming statements used to accomplish a threads task should be included in the method:
A)start)
B)init)
C)run)
D)none of the above
A)start)
B)init)
C)run)
D)none of the above
C
3
What method in the Thread class is responsible for pausing a thread for a specific amount of milliseconds?
A)pause)
B)sleep)
C)hang)
D)kill)
A)pause)
B)sleep)
C)hang)
D)kill)
B
4
The FXML file in a JavaFX application contains the code that controls what happens when GUI components are selected.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
5
SQL stands for Structured Query Language.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
6
The Java language does not support multithreading.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
7
A server creates at least two sockets,one to listen for input,and another that is created when a client connects to the server.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
8
____________ is an enhancement of simple accessor and mutator methods.
A)Event handling
B)Introspection
C)Persistence
D)None of the above
A)Event handling
B)Introspection
C)Persistence
D)None of the above
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
9
The JavaFX scene graph:
A)Is used to plot XY graphs
B)Describes the layout of GUI components in a JavaFX application
C)Is an application that is used to lay out components in a JavaFX application
D)Is used with lambda expressions to define nameless functions
A)Is used to plot XY graphs
B)Describes the layout of GUI components in a JavaFX application
C)Is an application that is used to lay out components in a JavaFX application
D)Is used with lambda expressions to define nameless functions
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
10
____________ means that an object has an identity that extends beyond one session.
A)Event handling
B)Introspection
C)Persistence
D)None of the above
A)Event handling
B)Introspection
C)Persistence
D)None of the above
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
11
If your class implements Runnable then what method is invoked to start the thread?
A)run)
B)execute)
C)start)
D)main)
A)run)
B)execute)
C)start)
D)main)
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
12
An InterruptedException is a checked exception.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
13
The Java library that supports database connectivity is called:
A)ODBC
B)CDBC
C)MDBC
D)JDBC
A)ODBC
B)CDBC
C)MDBC
D)JDBC
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
14
The sleep method of the Thread class requires one formal parameter that represents the number of:
A)nanoseconds
B)microseconds
C)picoseconds
D)milliseconds
A)nanoseconds
B)microseconds
C)picoseconds
D)milliseconds
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
15
____________ refers to a framework that facilitates software building by connecting software components from diverse sources.
A)JavaBeans
B)Threads
C)SQL
D)all of the above
A)JavaBeans
B)Threads
C)SQL
D)all of the above
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
16
What is an advantage of applying Java 8 lambda expressions to a Collection class?
A)The potential for syntax errors is reduced
B)The JVM can parallelize operations applied to elements of the collection
C)The collection can be displayed graphically
D)Lambda expressions help map the collection to a database
A)The potential for syntax errors is reduced
B)The JVM can parallelize operations applied to elements of the collection
C)The collection can be displayed graphically
D)Lambda expressions help map the collection to a database
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
17
A thread's start method invokes the thread's run method.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
18
Threads execute in a ___________ fashion.
A)parallel
B)serial
C)complex
D)none of the above
A)parallel
B)serial
C)complex
D)none of the above
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
19
When a server executes the accept)method it:
A)Blocks and waits for a connection
B)Checks for a connection and if there is none it exits
C)Blocks but in a new thread
D)Any of the above,depending on the input parameters to accept)
A)Blocks and waits for a connection
B)Checks for a connection and if there is none it exits
C)Blocks but in a new thread
D)Any of the above,depending on the input parameters to accept)
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
20
Java's Thread class is in the ____________ package.
A)java.util
B)java.thread
C)java.lang
D)javax.swing
A)java.util
B)java.thread
C)java.lang
D)javax.swing
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
21
What is a JavaBean?
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
22
What other programming technique can be combined with sockets so a server can handle requests from multiple clients?
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
23
Discuss the components of the JavaBean model.
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
24
What are Enterprise JavaBeans?
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
25
What is a socket?
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck
26
Rewrite the following code to use a Lambda expression for the button action listener.
import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.Color;
import java.awt.Container;
import java.awt.FlowLayout;
public class ButtonDemo3 extends JFrame
{
public ButtonDemo3 )
{
setSize250,100);
setDefaultCloseOperationJFrame.EXIT_ON_CLOSE);
setTitle"Button Demo");
Container contentPane = getContentPane );
contentPane.setBackgroundColor.BLUE);
contentPane.setLayoutnew FlowLayout ));
JButton goButton = new JButton"Green");
goButton.addActionListener
{ e } - > contentPane.setBackgroundColor.GREEN));
contentPane.addgoButton);
}
public static void mainString[] args)
{
ButtonDemo3 buttonGui = new ButtonDemo3 );
buttonGui.setVisibletrue);
}
}
import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.Color;
import java.awt.Container;
import java.awt.FlowLayout;
public class ButtonDemo3 extends JFrame
{
public ButtonDemo3 )
{
setSize250,100);
setDefaultCloseOperationJFrame.EXIT_ON_CLOSE);
setTitle"Button Demo");
Container contentPane = getContentPane );
contentPane.setBackgroundColor.BLUE);
contentPane.setLayoutnew FlowLayout ));
JButton goButton = new JButton"Green");
goButton.addActionListener
{ e } - > contentPane.setBackgroundColor.GREEN));
contentPane.addgoButton);
}
public static void mainString[] args)
{
ButtonDemo3 buttonGui = new ButtonDemo3 );
buttonGui.setVisibletrue);
}
}
Unlock Deck
Unlock for access to all 26 flashcards in this deck.
Unlock Deck
k this deck