Exam 2 CIS 315

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Which is the only method specified by the Runnable interface?

run

Which Thread method requires a specified amount of time as input?

sleep

Your application must extend the Application class and implement which abstract method?

start

A recursive method should have a "base case". Which of the following is synonym for "base case"?

stopping condition

Which keyword should you use in the method header (just before the return type) to ensure that only one thread executes the method body at any one time?

synchronized

?

unbounded wildcard

Which Thread method temporarily releases an arbitrary amount of time for other threads to execute?

yield

All recursive methods have the following characteristics (Select all that apply, type numbers only spaces) 1. uses if-else or switch that leads to different cases. 2. one or more base cases 3. each recursive call reduces the original problem 4. have a void return type

1 2 3

To create a Socket object (which represents a communication endpoint), which two pieces of information are required by the Socket class constructor? (type number) 1. hostname or IP address 2. operating system 3. timeout parameter 4. port number

1 4

When two keys are mapped to the same index in a hash table, this is called: Double hashing A collision Linear probing Rehashing

A collision

A marker interface is: An unused interface An abstract interface An interface with an empty body An interface with a full implementation

An interface with an empty body

Generics: (select all that apply) Are any important part of the API of collection classes (like ArrayList). Have been part of Java since the beginning (JDK 1.0). Let you parameterize types. help detect errors at compile time, instead of runtime.

Are any important part of the API of collection classes (like ArrayList). Let you parameterize types. help detect errors at compile time, instead of runtime

Vector is most similar to which newer collection class? Stack Queue ArrayList Iterator

ArrayList

Which is the best data structure for storing a graph? HashSet HashMap TreeMap LinkedHashSet ArrayList

ArrayList

Which class(es) implement the List interface? ArrayList LinkedList PriorityQueue TreeSet

ArrayList and LinkedList

Which of the following is an abstract class? GregorianCalendar, java.util.date, Calendar, or ArrayList

Calendar

To sort and search collections you should use which class that contains mostly static methods? Math Collection Arrays Collections

Collections

Which class supports red, green, and blue values?

Color

O(1)

Constant time

An interface is a class-like construct that contains only: (Select all that Apply) Fields Constants Methods Abstract Methods

Constants and Abstract methods

A graph consists of _______ and ______ Sets Edges Lists Vertices Weights

Edges and Vertices

O(2^n)

Exponential time

A _____ is a mixture of JSF tags and XHTML tags.

Facelet

A JavaBean is written in HTML

False

A class may extend multiple abstract classes. T or F

False

An abstract class must have at least one method that is marked abstract. T or F

False

If you need to maintain insertion order in your map, you should use HashMap. True or False

False

Iteration takes more time and consumes more memory than recursion

False

JDBC was designed to work exclusively with Oracle databases.

False

Which class supports size and weight attribute values?

Font

Set

Group of nonduplicate elements

Which of the following are ways to traverse a tree? Inorder Preorder Postorder Backorder Depth-first Breadth-first

Inorder, Preorder, Postorder, Depth-first, Breadth-first

Which of the following are true of the Number class?(Select all that apply) It is abstract It is concrete It is a superclass of BigDecimal It is a subclass of BigDecimal It can be used as an object reference

It is abstract, It is a superclass of BigDecimal, It can be used as an object reference

What is the newest GUI framework supported by JAVA?

JavaFX

O(n)

Linear time

O(n log n)

Log-linear time

O(log n)

Logarithmic time

Which of these sorting algorithms is the most efficient? (consider the worst-case complexity) Selection sort Insertion sort Bubble sort Merge sort

Merge sort

JSF is based on which design pattern?

Model-View-Controller

Which Java keyword is used to indicate that the method is implemented in the JVM using code specific to the platform (i.e., operating system)? Native Transient Volatile Null

Native

What kind of performance can you expect from the search, insert, and delete operations of the typical hashtable? O(1) O(n) O(log n) O(n log n)

O(1)

Queue

Objects processed in FI-FO

Stack

Objects processed in LI-FO

PriorityQueue

Objects processed in order of priority

List

Ordered collection of elements

To lay out widgets with a desired size in a particular location, you would use a:

Pane

Precompiled for efficient use when repeatedly executed?

PreparedStatement

O(n^2)

Quadratic time

A generic class or interface without specifying a concrete type, called a ______ type, enables backward compatibility with earlier versions of Java. Object Abstract Primitive Raw

Raw

To send objects from one program to another using ObjectInputStream and ObjectOutputStream, the objects sent across the wire need to be instantiated from classes that implement which interface?

Runnable

Which of the following is the universal language for working with relational database systems

SQL

Which of the following are concrete classes? Map SortedMap NavigableMap TreeMap AbstractMap HashMap LinkedHashMap

TreeMap, HashMap, LinkedHashMap

Which of the following are concrete classes? Treeset Set SortedSet HashSet AbstractSet LinkedHashSet

TreeSet, HashSet, LinkedHashSet

A generic type can be defined for a class or interface. True or False

True

A subclass can be abstract even if its superclass is concrete. True or False

True

A tree is a graph. True or False

True

An O(log n) algorithm is more efficient than a O(n) algorithm. True or False

True

Assuming a BST with only a root node, if the next node to be added is less than the root, it should be added as the left child of the root. True or False

True

JavaServer Faces allows developers to separate HTML from Java code

True

Most database systems are relational database systems

True

One should try to make recursive methods use tail recursion to be more efficient

True

Sets are more efficient than lists for storing nonduplicate elements? True or False

True

Two equal objects (that produce a true return value when the equals method is called) must return the same hash code. True or False

True

You cannot use the new operator to instantiate an object from an abstract class. TorF

True

Which protocol guarantee lossless transmission and is therefore more suitable for audio and video than email?

UDP

Which data structure is the best choice for representing between cities? unweighted graph weighted graph TreeMap TreeSet

Weighted Graph

AVL trees are: Unary trees Degenerate trees Well-balanced trees Cyclic trees

Well-balanced trees

A server that uses a ServerSocket instance should listen for connections using which method?

accept

? extends T

bounded wildcard

________ checks whether the checkbox chk is selected.

chk.isSelected()

O(n^3)

cubic time

To implement your own hashing function in Java, you should override the ______ method which is defined in the Object Class

hashCode()

Java.util.Collection is a(n): Interface Abstract Class Final class class

interface

To set the node to the right of the text in a label lbl, use _______

lbl.setContentDisplay(ContentDisplay.RIGHT);

? super T

lower-bound wildcard

To create a label with the specified text, use _______

new Label(text);

To handle the key pressed event on a pane p, register the handler with p using ______

p.setOnKeyPressed(handler);

To handle the mouse click event on a pane p, register the handler with p using _____

p.setOnMouseClicked(handler);


संबंधित स्टडी सेट्स

8.4 Weather maps and weather prediction

View Set

Organizational Behavior Chapter 12

View Set