deo cho ai dau

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Which layout should you use to organize the components of a container in a tabular form?

GridLayout

A component that lets the user pick a color.

JColorChooser

Select incorrect statement about ServerSocket class. (choose 1)

To make the new object available for client connections, call its accept() method, which returns an

Select incorrect statement about ServerSocket class.

To make the new object available for client connections, call its accept() method, which returns an instance of ServerSocket

Select incorrect statement about ServerSocket class. (choose 1)

To make the new object available for client connections, call its accept() method, which returns an instance of ServerSocket

Select incorrect statement about ServerSocket class. (choose 1)

To make the new object available..connections, call its accept() method,..of ServerSocket

Which of the following statement is correct about object serialization?

Transient fields are not serialized

Which of the following statement is correct about object serialization?

Transient fields are not serialized.

Which of these methods can be used to change location of an event?

TranslatePoint()

In the following code fragment, after execution of line 1, sbuf references an instance of the StringBuffer class. After execution of line 2, sbuf still references the same instance. a In the following code fragment, after execution of line 1, sbuf references an instance of the StringBuffer class. After execution of line 2, sbuf still references the same instance. 1. StringBuffer sbuf = new StringBuffer("FPT"); 2. sbuf.append("-University");

True

The Java Foundation Classes (JFC) is a set of GUI components which simplify the development of desktop applications?

True

These two ways are used to create a Frame By creating the object of Frame class (association) By extending Frame class (inheritance)

True

With respect to the Java socket. (1) A socket contains two binary streams for sending and receiving data.

True, false, false

The first in the most common objects are used in a database Java program:(1) java.sql.Connection(2) java.sql.Statement(3) java.sql.ResultSet(4) java.sql.ResultSetMetaData

(1)

The first in the most common objects are used in a database Java program: (1) java.sql.Connection (2) java.sql.Statement (3) java.sql.ResultSet (4) java.sql.ResultSetMetaData

(1) java.sql.Connection

Which of the following is correct about RowSet?

A RowSet objects are JavaBeans components.

What is the difference between a Scollbar and a Scrollpane?

A Scrollbar is a Component, but not a Container.

What is the difference between a Scollbar and a Scrollpane?

A Scrollbar is a Component,but not a Container.

Which of the following statements is correct?

Basically, RMI technology uses traditional sockets..are created invisibly to developers.

Which of these clause will be executed even if no exceptions are found?

finally

Which method returns the preferred size of a component?

getPreferredSize( )

Which method returns the preferred size of a component?

getPreferredSize()

Which of these method of Thread class is used to find out the priority given to a thread?

getPriority()

Which of these methods of httpd class is used to read data from the stream?

getRawRequest()

What Checkbox method allows you to tell if a Checkbox is checked?

getState()

Which of these method returns an instance of DateFormat that can format time information?

getTimeInstance()

Which of these methods can be used to know the degree of adjustment made by the user?

getValue()

Which of these methods is used to obtain the object that generated a WindowEvent?

getWindow()

Which of these methods is used to get x coordinate of the mouse?

getXCoordinate()

Which of these method is called when http daemon is acting like a normal web server?

handleGet()

Which of these variables stores the number of hits that are successfully served out of cache?

hits.to.cache

Which of these tranfer protocol must be used so that URL can be accessed by URLConnection class object?

http

The methods wait() and notify() are defined in?

java.lang.Object

A component that displays an icon, but that doesn't react to user clicks

label

a common constructor of the class java.util.locale:

locale(string(language),string(nation))

Which of these is an instance variable of httpd that is a Hashtable?

log

Which of these method of httpd class is used to get report on each hit to HTTP server?

logEntry()

Suppose class Supe, in package packagea, has a method called doSomething(). Suppose class Subby, in package packageb, overrides doSomething(). What access modes may Subby?s version of the method have?

public ,protected

In Graphics class Which method is used to set the graphics current color to the specified color?

public abstract void setColor(Color c)

Which of the following statements will compile without error?

public interface AccountListener{void actionPerformed(AccountEvent event);}

In Graphics class which method is used to draws a rectangle with the specified width and height?

public void drawRect(int x, int y, int width, int height)

In Windows systems, the ...... program helps creating the Stub of a RMI server and the ...... program will work as a RMI container (RMI registry).

rmic.exe, rmiregistry.exe

In Windows systems, the ...... program helps creating the Stub of a RMI server and the ...... program will work as a RMI container (RMI registry).

rmic.exe, rmiregistry.exeWith respect to steps in RMI implementation.(1) Create the remote interface(2) Create the remote object(3) Create the client object(4) Create the Stub The order should be followed:|1, 2, 4, 3

Which of these method is used to find a URL from the cache of httpd?

serveFromCache()

Select incorrect statement about Socket class

server through UDP

Which method of the component class is used to set the position and the size of a component?

setBounds()

Which of these method of Thread class is used to Suspend a thread for a period of time?

sleep()

Which of these method of Thread class is used to suspend a thread for a period of time?

sleep()

A(An) ....... is one endpoint of a two-way communication link between two programs running on the network.

socket

A/An ...... is bound to a port number so that the TCP layer can identify the application having network comunication

socket

You can invoke ______________ on a Socket object, say socket, to obtain an InetAddress object.ocket.getInetAddress();

socket.getInetAddress();

To obtain an ObjectInputStream from a socket, use ________.

socket.getObjectStream()

We can replace a card layout of a container with ..........

tabbed pane

Which of these method of MimeHeader is used to return the string equivalent of the values stores on MimeHeader?

toString()

To display number in desired format, you have to use the NumberFormat class or its subclasses.

true

To run an object on a separate thread, the object must be a subclass of Thread.

true

You should always invoke the unlock method in the finally clause.

true

You should not directly invoke the run() method of a thread object.

true

getInputStream() and getOutputStream() are used to produce InputStream and OutputStream on the socket.

true

Which JDBC processing model that requires a JDBC driver that can communicate with the particular data source being accessed?

two-tier

Which of these formatting strings of SimpleDateFormat class is used to print AM or PM in time?

a

A resource bundle is ___________

a Java class file or a text file that provides locale-specific information.

with respect to the class java.util.Locale

all true

Which Font attributes are available through the FontMetrics class?

ascent,leading,height

The following way is used to create a frame is by creating the object of Frame class?

association

Which of the following layout managers subdivides its territory into a matrix of rows and columns?

Grid Layout

A component that lets the user pick a color.

color chooser

What does URL stands for?

Uniform Resource Locator

Which of the following statement is correct about Card layout?

Card layout arranges components in time rather than in space.

In a client-server application model, which side will initialize a connection?

Client

In a JDBC application, suppose that the Connection, named con, was created. Study the following code:

The above code will throw an exception.

In JDBC model, which driver types provide access to database through native code libraries C/C++?

Type 2-driver

The next() method of the java.sql.ResultSet class return

a boolean value

Which of the following options is a method that you need to override when implementing the ActionListener interface?

actionPerformed()

In a complex GUI containing a lot of components and user must be select some data in a group of specific data, the component should be used is .......

combo box

In a client-server application model, which sides will initiate a connection?

Client

The default layout manager used by JPanel is:

FlowLayout

In which layer of the JDBC architecture does the JDBC-ODBC bridge reside?

It resides in the JDBC layer.

Which of the following protocols is a reliable protocol?

TCP

Suppose that the current position of a ResultSet, named rs, is at the last record, the statement rs.next() will return

false

Which of the following layout classes is in java.awt package?

All of the others.

The correct order in which database -accessing objects should be created:

Connection - Statement- ResultSet - ResultSetMetaData

Select correct statement. In RMI implementations,

The remote class must implement the remote inteface

The container can display three completely different components at different times, depending perhaps on user input or program state. Even if the components' sizes differ, switching from one component to the next shouldn't change the amount of space devoted to the component.

CardLayout

Which of these is a full form of DNS?

Domian Name Service

Which of the following layout managers arranges components in horizontal rows (left to right in the order they were added to their container), starting new rows if necessary?

Flow Layout

The container has a row of components that should all be displayed at the same size, filling the container's entire area. Which layout is the best choice for this purpose?

GridLayout

The container has one component that should take up as much space as possible. Which layouts that easily deal with this situation should be selected?

GridLayout

Which of the following layout managers will make all its components the same size?

GridLayout

In Swing, what is the role of the component's model?

It is responsible for the data that the component presents to the users.

Select incorrect statement about FlowLayout. (choose 1)

It is the default layout manager type for JFrame.

Which of the following options is a valid method that is used to bind a name to an object in RMI model?

Naming.rebind(name, object)

One of the benefits of Type 1 driver (JDBC - ODBC Bridge) is that it can provide connection to a database when Java driver is not available for that database. Which of the following options is another advantage of the Type 1 driver?

None of the others

Select correct statement(s). (1) 12 buttons can not be added to a container which is assigned to a grid layout 2x5.(2) If 2 components are added to the center region of a border-layout container, they will be seen by user as side-by-side components.

None of the others.

Which of the following classes can be used for writing and reading objects (serializing/de-serializing) from and to a file?

ObjectInputStream/ObjectOutputStream

Select a correct statement about TCP and UDP protocol:

TCP (Transmission Control Protocol) is a connection-based protocol that provides a reliable flow of data between two computers.

Suppose you are building a client - server based application using TCP socket technique. Assume at the same time, 5 clients are connecting to the server, and then the server needs to send data to the client number 2. How can the server make sure that it sends the data exactly to the 2nd client, rather than mistakenly to other clients?

The server creates a separate InputStream and OutputStream

With respect to the Java socket. (1) A socket contains two binary streams for sending and receiving data. (2) A socket contains two text streams for sending and receiving data. (3) Developers must implement background operations for sending and receiving data.

True, false, false

With respect to networking and the client-server model. (1) A server runs on a specific computer and has a socket that is bound to a specific port number. The server just waits, listening to the socket for a client to make a connection request. (2) To connect to the server, the client must know the hostname or IP of the machine on which the server is running and the port number on which the server is listening

True, true

With respect to JDBC, (1) In the two-tier model, a Java application talks directly to the data source. (2) In the three-tier model, a "middle tier" of services is let between a Java program and the data source. (3) The JDBC API supports two-tier processing model for database access only.

True, true, false

You are going to execute an insert statement to add some data into the database. Which of the following methods should you use?

executeUpdate()

Which of the following layout manager will present components with the same size.

java.awt.GridLayout

The Java program can

not directly access data in a database file that is managed by a database management system.

In a client-server application model, which side will wait for a connection?

server

Which method do you use to enable and disable components such as JButton s?

setEnable

To make the background color of a label different with the color of its container, we need to use the ..... method of the JLabel class first.

setOpaque(true)

You are required to build an application that can connect to database to display data to end users. The requirement for the database connectivity is that it must provide a performance as fast as possible. Suppose that all types of drivers are available. Which type should you choose to satisfy the requirement?

type 2

Which of these events is generated when the size os an event is changed?

ComponentEvent

How do you indicate where a component will be positioned using Flowlayout?

Do nothing, the FlowLayout will position the component

Which type of model holds a text component's content?

Document

The class is the primary class that has the driver information.

DriverManager

is a layout manager that was developed for use by GUI builder tools, but it can also be used manually

GroupLayout

The data in DefaultTableModel are stored in ___________.

a Vector

Which of the following statements are true?

-cau "for SQL query"

Which are true about the Container class?

-cau The getBorder( )

To create a subclass, use the ____ keyword.

extends

Suppose that the current position of a ResultSet, named rs, is at the last record, the statement rs.next() will return ......

false

The URL constructor throws MalformedURLException if the URL is syntactically incorrect.

false

The server can create a server socket regardless of whether the port is in use or not.

false

When using the GridBagLayout manager, each new component requires a new instance of the GridBagConstraints class. Is this statement true or false?

false

When you say Class.forName() loads the driver class, does it mean it imports the driver class using import statement?

false

You can find all the available locales from a Swing object.

false

You can set a priority for an object of ThreadGroup using the setPrority() method.

false

You cannot get instances of InputStream or OutputStream because InputStream and OutputStream are abstract classes.

false

t1 = new Thread(this,"Thread_1"); t2 = new Thread(this,"Thread_2"); t1.start(); t2.start();

falsefalse

The ____ reserved word in a method definition ensures that subclasses cannot override this method.

final

How can you execute a stored procedure in the database?

Call method execute() on a CallableStatement object

In JDBC API, which of the following statements can be used to call a stored procedure?

CallableStatement

In JDBC, which of the following class/interface should be used to call a store procedure?

CallableStatement

RMI applications often comprise two separate programs, a server and a client and they...

Can run in two separate virtual machines

Which of the following classes have a paint( ) method?

Canvas,Frame

Which Component subclass is used for drawing and painting?

Canvas.

The class lets you implement an area that contains different components at different times

CardLayout

The container can display three completely different components at different times, depending perhaps on user input or program state.

CardLayout

Which class is used to create a pop-up list of items from which the user may choose?

Choice

What is the difference between a Choice and a List?

Choice is displayed in a compact form that requires..choices

Which of the following statements loads the JDBC-ODBC driver?

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver")

Invoking Class.forName method may throw ___________.

ClassNotFoundException

Which of the following may not be synchronized

Classes

A Frame's background color is set to Color. Yellow, and a Button's background color is to Color.Blue. Suppose the Button is added to a Panel, which is added to the Frame. What background color will be used with the Panel?

Colr.Yellow

A Framefs background color is set to Color. Yellow, and a Buttonfs background color is to Color.Blue. Suppose the Button is added to a Panel, which is added to the Frame. What background color will be used with the Panel?

Colr.Yellow

What background color will be used with the Panel?

Colr.Yellow

In order for objects in a List to be sorted, those objects must implement which interface and method?

Comparable interface and its compareTo method.

In order for objects in a List to be sorted, those objects must implement which interface and method? (Choose one.)

Comparable interface and its compareTo method.

t = new Thread(this,"My Thread"); t.start();

Compilation Error

Suppose a source file contains a large number of import statements. How do the imports affect the time required to compile the source file?

Compilation takes slightly more time.

Which is a component in AWT that can contain another components like buttons, textfields, labels etc.?

Container

Which of these events is generated when the component is added or removed?

ContainerEvent

Suppose a source file contains a large number of import statements. How do the imports affect the time required to compile the source file? (Choose one.)

Compilation takes slightly more time.

These four methods commonly used in?1)public void add(Component c)2)public void setSize(int width,int height)3)public void setLayout(LayoutManager m)4)public void setVisible(boolean)

Component class

FocusEvent is subclass of which of these classes?

ComponentEvent

Which of these is superclass of ContainerEvent class?

ComponentEvent

Which of these is superclass of WindowEvent class?

ComponentEvent

Which of these interfaces define four methods?

ComponentListener

Which containers use border layout as their default layout ?

Dialog,Frame,Window

29 _________ specify the permissible values for an attribute.

Domain constraints

25 ________ are known as intra-relational constraints, meaning that a constraint involves only one relation.

Domain constraints..Primary key constraints

An object is uses to obtain a Connection to a Database

Driver Manager

The ... class is the primary class that has the driver information.

Driver Manager

A(n) object is uses to obtain a Connection to a Database

DriverManager

The Following steps are required to perform 1) Implement the Listener interface and overrides its methods 2) Register the component with the Listener

Event Handling

Which of these class is super class of all the events?

EventObject

____ are generated when the user presses a key, clicks a button, or selects a menu item.

Events.

What are the types of Checkboxes and what is the difference between them?

Exclusive and Non-exclusive.

The Choice component allows multiple selection.

False.

The List component does not generate any events.

False.

How do you create a condition on a lock?

Condition condition = lock.newCondition();

Which is the four steps are used in working with JDBC?

Connect to the database Create a statement and execute the query Look at the result set Close connection

Interface ____ helps manage the connection between a Java program and a database.

Connection

helps manage the connection between a Java program and a database

Connection

To connect to a local MySQL database named test, use

Connection connection = DriverManager.getConnection("jdbc:mysql://localhost/test");

Suppose a method called finallyTest() consists of a try block, followed by a catch block, followed by a finally block. Assuming the JVM doesn?t crash and the code does not execute a System.exit() call, under what circumstances will the finally block not begin to execute?

If the JVM doesn't crash and the code does not execute a System.exit() call, the finally block will always execute.

Which component can display an image, but cannot get focus?

JLabel

Which method do you use to specify the default button for a top-level container such as a JFrame or JDialog?

JRootPane's setDefaultButton method

If all three top-level elements occur in a source file, they must appear in which order?

Package declaration, imports, class/interface/enum definitions.e. Imports must come first; class/interface/enum definitions is not significant

Select correct statement. In RMI implementations, _____

The remote class must implement the remote inteface.

What happens if you call deleteRow() on a ResultSet object?

The row you are positioned..and from the database

Suppose you are building a client - server based application using TCP socket

The server creates a separate InputStream and OutputStream objects for each one. Then,

Which of these methods can be used to get reference to a component that was removed from a container?

getchild()

You are building an rmi application. Which of the following interfaces you must extend for your remote interface?

java.rmi.Remote

In RMI implementations, all methods, declared in the remote interface, must throw the ...exception.

java.rmi.RemoteException

Out of byte[] or a java.sql.Blob, which has best performance when used to manipulate data from database?

java.sql.Blob

Out of String or a java.sql.Clob, which has best performance when used to manipulate data from database?

java.sql.Clob

Which of these package is used for all the text related modifications?

java.text

Which of these package is used for text formatting in Java programming language?

java.text

Event class is defined in which of these libraries?

java.util

Given arrays a1 and a2, which call returns true if a1 and a2 have the same length, and a1[i].equals(a2[i]) for every legal index i?

java.util.Arrays.equals(a1, a2);

The Java program can .........

not directly access data in a database file that is managed by a database management system.

Which of these method wakes up all the threads?

notifyAll()

31 What information may be obtained from a ResultSetMetaData object?

number of columns in the result set

Object ob2= ob1

ob1 equals ob2, ob1==ob2

3 Which of the following expressions must be true if you create a thread using Thread = new Thread(object)?

object instanceof Runnable

Which of these methods is used to know the full URL of an URL object?

toExternalForm()

8 An exception occurs if the resume() method is invoked by a finished thread object.

true

An applet cannot connect to a server program on a Web server where the applet was loaded.

true

Swing components cannot be combined with AWT components.

true

The Runnable interface is more general than the Thread class. You can convert any class that extends Thread to a class that implements Runnable.

true

The TimeZone class has a static method for obtaining all the available time zone IDs.

true

The client can connect to the server regardless of whether the port is in use or not.

true

The locale property is in the Component class, thus, every Java Swing component has the locale property.

true

You must specify a name for the thread group that you will create.

true

. What is the default value of priority variable MIN_PRIORITY AND MAX_PRIORITY?

1 & 10

What is the default value of priority variable MIN_PRIORITY AND MAX_PRIORITY?

1 & 10

Which is the four steps are used in working with JDBC?

1)Connect2)Create3)Look4)Close

Select correct statement(s). (1) Swing is part of the Java Foundation Classes and provides a rich set of GUI components. (2) Before you think about what your GUI will look like , it's important to think about what it will

1, 2

Select correct statement(s).(1) Swing is part of the Java Foundation Classes and provides a rich set of GUI components.

1, 2

In Java Network programming using sockets, five steps are usually used:

1, 2, 3, 4, 5

In Java Network programming using sockets, five steps are usually used: 1) Open a socket. 2) Open an input stream and output stream to the socket.

1, 2, 3, 4, 5

Select correct statement(s).(1) The Swing's list component (JList) can display text only.

3

How many bits are in a single IP address?

32

How many ports of TCP/IP are reserved for specific protocols?

1024

Select a correct statement below:

Naming.lookup("rmi://192.168.12.1/obj1") ;

You are trying to look up obj1 object on the server 192.168.12.1 using RMI technology with default port

Naming.lookup("rmi://192.168.12.1/obj1") ;

You are trying to look up obj1 object on the server 192.168.12.1 using RMI technology with default port. Select a correct statement below:

Naming.lookup("rmi://192.168.12.1/obj1") ;

Which of the following components allow multiple selections?

Non-exclusive Checkboxes.,List.

Given a string constructed by calling s = new String("xyzzy"), which of the calls modifies the string?

None of the above

Which of these methods are member of Remote class?

None of the mentioned

Which method do you use to enable or disable components such as JButtons?

None of the others

Which is the container that doesn't contain title bar and MenuBars. It can have other components like button, textfield etc?

Panel

If you need a Set implementation that provides value-ordered iteration, which class should you use? (Choose one.)

TreeSet

If you need a Set implementation that provides value-ordered iteration,which class should you use?

TreeSet

AWT is used for GUI programming in java?

True

AWT more powerful components like tables, lists, scroll panes, color chooser, tabbed pane etc.?

True

If a frame uses a Grid layout manager and does not contain any panels, then all the components within the frame are the same width and height.

True

Implement the Listener interface and overrides its methods is required to perform in event handling?

True

In the following code fragment, after execution of line 1, sbuf references an instance of the StringBuffer class. After execution of line 2, sbuf still references the same instance. 1. StringBuffer sbuf = new StringBuffer("FPT"); 2. sbuf.insert(3, "-University");

True

Swing components cannot be combined with AWT components.

True

The JDBC-ODBC Bridge supports multiple concurrent open statements per connection?

True

What is the default layouts for a applet, a frame and a panel?

True

You are required to build an application that connects to database to store and retrieve data. Your application must be independent with the underlying database. Which driver types should you use?

Type 3-driver

drivers that are pure Java and implement the network protocol for a specific data source. The client connects directly to the data source.

Type 4

Which type of driver converts JDBC calls into the network protocol used by the database management system directly?

Type 4 driver

Which of these constant value will change when the button at the end of scroll bar was clicked to increase its value?

UNIT_INCREMENT

Which of the following methods are defined on the Graphics class:

drawLine,drawImage,drawString

With respect to the java.sql.Statement interface,

executeQuery(...), executeUpdate(...)

With respect to the java.sql.Statement interface,(1) When we need retrieving data from a table of a database, the method...... of the Statement interface should be used.

executeQuery(...), executeUpdate(...)

With respect to the java.sql.Statement interface,(1) When we need retrieving data from a table of a database, the method...... of the Statement interface should be used.(2) When we need update data in a table of a database, the method...... of the Statement interface should be used.

executeQuery(...), executeUpdate(...)

When you want to delete some rows in a table of a database, the ...... method of the java.sql.Statement interface must be used.

executeUpdate()

Suppose salaries is an array containing floats. Which of the following are valid loop control statements for processing each element of salaries?

for(float f:salaries)

The .... method of the ...... class helps loading a JDBC driver.

forName(...), java.lang.Class

How many JDBC driver types does Sun define?

four

Which of these methods can be used to obtain the command name for invoking ActionEvent object?

getActionCommand()

Which of these method of DatagramPacket class is used to find the destination address?

getAddress()

Which of these methods can be used to determine the type of adjustment event?

getAdjustmentType()

You are building a table model class that extends the AbstractTableModel class. Which of the following methods is not required to re-implement?

getColumnName()

Consider the following url address:

http is protocol, 192.168.2.2:12 is socket.

Which of these package is used for invoking a method remotely?

java.rmi

Which of these package is used for remote method invocation?

java.rmi

In RMI implementations, all methods, declared in the remote interface, must throw the ____ exception.

java.rmi.RemoteException

Which packages contain the JDBC classes?

java.sql and javax.sql

What class is the top of the AWT event hierarchy?

java.util.eventObject

The Swing component classes can be found in the ________________ package.

javax.swing

Which of the following creates a List with 5 visible items and multiple selection enabled?

new List(5, true)

Which of the following methods are invoked by the AWT to support paint and repaint operations?

paint()

Which of these methods is used to make raw MIME formatted string?

parse()

Which of the following methods are needed for loading a database driver in JDBC?

registerDriver() method,Class.forName()

What happens if you call the method close() on a ResultSet object?

the database and JDBC resources are released

Select correct statement. In RMI implementations,

the remote class must implement the remote inteface.

When designing a hierarchy of classes, features and behaviors that are common to all classes are placed in ____.

the superclass

You can get all the available locales from an instance of Calendar, Collator, DateFormat, or NumberFormat.

true

You can get year, month, day, hour, minute, and second from an instance of GregorianCalendar.

true

You can transmit objects over the socket.

true

With respect to processing models for database access, ____

two-tier and three-tier models

The JDBC API supports processing models for database access

two-tier model

When we invoke repaint() for JAVA.awt.Component object, the AWT invokes the method

update()

Which of these class is used to access actual bits or content information of a URL?

All of the mentioned

Which of these class must be used to send a datatgram packets over a connection?

All of the mentioned

Which of these is an instance variable of class httpd?

All of the mentioned

Select correct statements about remote interface.

All remote interfaces must extend java.rmi.Remote.

Select correct statement(s) about remote class

All the others choices

Which of the following statements about a superclass is true?

An abstract method may be used in a superclass when there is no good default method for the superclass that will suit all subclasses' needs.

What is an event in delegation event model used by Java programming language?

An event is an object that describes a state change in a source.

Which of the following are passed as an argument to the paint() method?

A Graphics object

Which of the following is an event source?

A JButton object.

Which of the following is true regarding subclasses?

A subclass inherits methods and instance variables from its superclass

Which of the following is true regarding inheritance?

A superclass can force a programmer to override a method in any subclass it creates.

32 ________ is an attribute or a set of attributes that uniquely identifies the relation.

A superkey

Select the correct statement about JDBC two-tier processing model

A user's commands

Select the correct statement about JDBC two-tier processing model.

A user's commands are delivered to the database or other data source, and the results of those statements are sent back to the user.

Select correct statements about remote interface. (choose 1)

All of the others.

Which of the following options is not a valid thread priority property?

AVERAGE_PRIORITY

Give the abbreviation of AWT?

Abstract Windowing Toolkit

class that cannot be instantiated is called a/an ____.

Abstract class.

How do you prevent shared data from being corrupted in a multithreaded environment?

Access the variables only via synchronized methods.

What is the preferred way to handle an objectfs events in Java 2?

Add one or more event listeners to handle the events.

Which of these class is used for creating a client for a server-client operations?

AddClient.java

Which of these events will be notified if scroll bar is manipulated?

AdjustmentEvent

In which places can put the event handling code

All mentioned above

To use the ActionListener interface it must be implemented by a class there are several ways to do that find in the following?

All mentioned above

To connect to a server running on the same machine with the client, which of the following can be used for the hostname?

All of the above.

Which of the following can cause 'No suitable driver' error?

All of the above.

Which of the following is correct about transactions in JDBC?

All of the above.

Why will you set auto commit mode to false?

All of the above.

What MySQL property is used to create a surrogate key in MySQL?

AUTO_INCREMENT

Which of these exceptions handles the divide by zero error?

ArithmeticException

Which of these exceptions will occur if we try to access the index of an array beyond its length?

ArrayIndexOutOfBoundsException

What are the immediate super classes of the following classes?

Container class

What are the immediate super classes of the following classes?

Container-Component,MenuComponent-Object,Dialog-Window

Which of these interfaces handles the event when a component is added to a container?

ContainerListener

Which is used to store data and partial results, as well as to perform dynamic linking, return values for methods, and dispatch exceptions?

Frame

Which of the following is NOT a benefit of using JDBC?

JDBC programs are tightly integrated with the server operating system.

Which statements about JDBC are true?

JDBC stands for Java DataBase Connectivity

Do those components use any other models to handle other aspects of the componentsf state? If so, list the other modelsf types.

JList also uses a ListModel

Which Swing components use ListSelectionModel?

JList and JTable

Which of the following statements is correct?

Basically, RMI technology uses traditional sockets but socket classes are created invisibly to developers.

You are required to build a GUI application. The application has a main window which displays: - A tool bar at the top - A status bar at the bottom - A menu on the left - An information table on the right - A news board at the middle of the window Which of the following layout managers would you choose to achieve the above tasks?

BorderLayout

The container has one component that should take up as much space as possible. Which layouts that easily deal with this

BorderLayout or GridLayout

The container has one component that should take up as much space as possible. Which layouts that easily deal with this situation should be selected?

BorderLayout or GridLayout

A swing container that groups some common components in a complex GUI.

JPanel

The border layout resizes the ______ components to fill the remaining centre space.

Center

Which object is needed to group Checkboxes to make them exclusive?

CheckboxGroup.

toRadian() and toDegree() methods were added by which version of Java?

Java 2.0

Which are passive controls that do not support any interaction with the user?

Labels

What is meant by Controls and what are different types of controls?

Labels,Push buttons,Check boxes,Choice lists,Lists,Scroll bars,Text components

What is synchronization in reference to a thread?

It's a process of handling situations when two or more threads need access to a shared resource.

There are two classes in Java to enable communication using datagrams namely.

DataPacket and DataSocket

A Java monitor must either extend Thread or implement Runnable.

False

A signed data type has an equal number of non-zero positive and negative values available.

False

The element method alters the contents of a Queue.

False

Where is metadata stored in MySQL?

In the MySQL database mysql

Thread priority in Java is?

Integer

String s2 = "xyz"

Line 4, Line 6

Which of these Exceptions is thrown by remote method?

RemoteException

Statement objects return SQL query results as

ResultSet

Statement objects return SQL query results as ___ objects

ResultSet

Statement objects return SQL query results as objects

ResultSet

Which of the following required to be closed to close database operations?

ResultSet,Statement,Connection

Which of the following means that the ResultSet can only be read?

ResultSet.CONCUR_READ_ONLY

. Which of these class is used to make a thread?

Runnable

Select INCORRECT statement about serialization

When an Object Output

A method that has no implementation is called a/an ____ method.

abstract

Which of the following code is correct to obtain hour from a Calendar object cal?

cal.get(Calendar.HOUR);

RMI applications often comprise two separate programs, a server and a client and they _________.

can run in two separate virtual machines

With respect to the Java RMI, a server and a client program .......

can run in two separate virtual machines

Which Container method is used to cause a container to be laid out and redisplayed?

validate( )

Which Container method is used to cause a container to be laid out and redisplayed?

validate()

Which of these formatting strings of SimpleDateFormat class is used to print week of the year?

w

Which method do you use to force the prompt to a textfield ?

Textfield.requestFocus()

To implement RMI, classes need to be implemented: (1) Remote interface, (2) Server object, (3) Server program, (4) Client program, (5) Stub object, (6) Transport Object, (7) Remote reference Object

1, 2, 3, 4, 5

To implement RMI, classes need to be implemented:(1) Remote interface, (2) Server object, (3) Server program, (4) Client program,(5) Stub object, (6) Transport Object, (7) Remote reference Object

1, 2, 3, 4, 5

Select incorrect statement about RMI server

A client accesses

Select incorrect statement about RMI server.

A client accesses a remote object by specifying only the server name.

Select incorrect statement about RMI server.(choose 1)

A client accesses a remote object by specifying only the server name.

Select an incorrect statement.

A combobox can contain strings only.

Which of the following are true?

A component..an event listener,A component..own events.

Which of the following is correct about Connected RowSet?

A connected RowSet..nature,A connected RowSet doesn't..is terminated.

Which of the following may contain a menu bar?

A frame

What is a listener in context to event handling?

A listener is a object that is notified when an event occurs.

Which of these events is generated by scroll bar?

AdjustmentEvent

How do you prevent shared data from being corrupted in a multithreaded environment? (Choose one.)

Access the variables only via synchronized methods.

when a user selects a menu item,___is generated.

Action event

Which of these events is generated when a button is pressed?

ActionEvent

Which of these are integer constants defined in ActionEvent class?

All of the mentioned

Which of these are integer constants of ComponentEvent class?

All of the mentioned

Which of these class is necessary to implement datagrams?

All of the mentioned

Which of these method is used to avoid polling in Java?

All of the mentioned

Which of these methods will respond when you click any button by mouse?

All of the mentioned

Select correct statement about RMI. (choose 1)

All of the others.

Select correct statements about remote interface. (choose 1)A remote interface is an interface that describes the remotely accessible methods of a remote object.All remote interfaces must extend java.rmi.Remote.All methods in a remote interface must throw java.rmi.RemoteException The type of a remote reference is a remote interface

All of the others.

Two streams in a Java socket are ....

Binary streams

When a JDBC connection is created, it is in auto-commit mode

Both 1 and 2 are true

Which JDBC driver Type(s) can be used in either applet or servlet code?

Both Type 3 and Type 4

An application has a frame that uses a Border layout manager. Why is it probably not a good idea to put a vertical scroll bar at North in the frame?

Both a and b.

How does JDBC handle the data types of Java and database?

Both of the above.

Which of the following is correct about SQL Warning?

Both of the above.

Suppose a source file contains a large number of import statements and one class definition. How do the imports affect the time required to load the class?

Class loading takes no additional time.

There are two classes in Java to enable communication using datagrams (310) namely.

DataPacket and DataSocket

Which of these is a bundle of information passed between machines?

Datagrams

Which of this class can be used to format dates and times?

DateFormat

Which of the following are in the java.text package?

DateFormat.SimpleDateFormat .DateFormatSymbols

Select the best choice.

Deadlock describes a situation where two or more threads are blocked forever, waiting for each other.

In JTree control, which of the following classes represents for one node?

DefaultMutableTreeNode

A thread wants to make a second thread ineligible for execution. To do this, the first thread can call the yield() method on the second thread.

False

Swing is not a part of JFC (Java Foundation Classes) that is used to create GUI application?

False

The ActionListener interface is not used for handling action events?

False

The CheckboxGroup class is a subclass of the Component class.

False

With a Border layout manager, the component at Center gets all the space that is left over, after the components at North and South have been considered.

False

If a frame uses its default layout manager and does not contain any panels, then all the components within the frame are the same width and height.

False.

Which of these is wrapper around everything associated with a reply from an http server?

HTTP

Object ob2= new Object()

Have a nice day

SQL ________ statements may change the contents of a database.

INSERT UPDATE DELETE

Which is four-step approach to help you organize your GUI thinking. (Choose one.)

Identify needed components. Isolate regions of behavior. Sketch the GUI. Choose layout managers

Which is four-step approach to help you organize your GUI thinking.

Identify needed components.Isolate regions of behavior. Sketch the GUI.Choose layout managers.

Which is four-step approach to help you organize your GUI thinking. (Choose one.)

Identify needed components.Isolate regions of behavior.Sketch the GUI.

Which of the following is true regarding subclasses?

If a subclass does not call the superclass constructor, it must have a constructor without parameters.

Suppose a method called finallyTest() consists of a try block, followed by a catch block, followed by a finally block

If the JVM doesn't crash

With respect to JDBC. which statement is NOT CORRECT?

In the three-tier model. a "middle tier" of services is let

Which of these class is used to encapsulate IP address and DNS?

InetAddress

Which of these is a return type of getAddress method of DatagramPacket class?

InetAddress

MouseEvent is subclass of which of these classes?

InputEvent

Which of these is superclass of WindowEvent class?

InputEvent

Two streams are packed in a socket are .........

InputStream and OutputStream

27 In a relational data model, _________ imposes constraints on the data.

Integrity

Which of the following statements is false as far as different type of statements is concern in JDBC?

Interim Statement

Which of the following statements is correct regarding Type 4 JDBC driver (Native Protocol)?

It helps the Java applications communicate directly with the database using Java sockets.

What will happen if two thread of same priority are called to be processed simultaneously?

It is dependent on the operating system

In a relational data model, ________ provides the means for accessing and manipulating data.

Language SQL

Which of the following statements is not correct about JTree control?

Leaf nodes are those that can have children.

String s2 = new String("xyz")

Line 6

String s2 = new String(s1)

Line 6

Which object can be constructed to show any number of choices in the visible window?

List

Which of these interface abstractes the output of messages from httpd?

LogMessage

Which of these exception is thrown by URL class's constructors?

MalformedURLException

The ... class is used to implement a pull-down menu that provides a number of items to select from.

Menu

The class is used to implement a pull-down menu that provides a (307) number of items to select from.

Menu

Which of these is a standard for communicating multimedia content over email?

Mime

A _____ dialog prevents user input to other windows in the application unitl the dialog is closed.

Modal

How many locks does an object have?

One

What is the result of executing the following Java class: import java.awt.*; public class FrameTest extends Frame {public FrameTest() {add (new Button("First"));add (new Button("Second"));add (new Button("Third"));pack();setVisible(true);}public static void main(String args []) {new FrameTest();}} Select from the following options:

Only the "third" button is displayed.

If you want execute a SQL statement many times, the ____ object should be used.

PreparedStatement

Suppose that you will insert a lot of rows into a database table row-by-row. Which of the following interfaces should be used?

PreparedStatement

The ... object contains not just an SQL statement, but an SQL statement that has been precompiled.

PreparedStatement

The _____ object contains not just an SQL statement, but an SQL statement that has been precompiled.

PreparedStatement

Which type of Statement can execute parameterized queries?

PreparedStatement

Which of these are types of multitasking?

Process and Thread based

In which places can put the event handling code

Same class,Other class, Annonymous class

What is the difference between scrollbar and scrollpane

Scrollbar is..a container,Scrollpane handles..own scrolling.

Leaf nodes are those that can have children.

Textfield.requestFocus()

Which of these class is used to create servers that listen for either local or remote client programs?

ServerSockets

Which of these class allows us to define our own formatting pattern for dates and time?

SimpleDateFormat

The server listens for a connection request from a client using the following statement:

Socket s = serverSocket.accept()

is a flexible layout manager designed for use by GUI builders

SpringLayout

Which of the following are true?

The AWT automatically..maximized,The AWT .. data is changed.

What is the difference between a MenuItem and a CheckboxMenuItem?

The CheckboxMenuItem class extends the MenuItem class to support a menu item that may be checked or unchecked

Which of the following statements is correct about Flow layout?

The Flow layout arranges frames in horizontal rows.

Which of the following are passed as an argument to the paint( ) method?

The Graphic object

Which of the following are true?

The JVM runs until there are no non-daemon threads.

Which of the following are true?

The MouseListener...,The ActionListener..

Which containers use a FlowLayout as their default layout?

The Panel and the Applet classes

What is the role of RMI registry?

The RMI registry is a program that associates names with RMI services

What is the role of RMI registry?

The RMI registry is a program that associates names with RMI services.

Suppose interface Inty defines five methods. Suppose class Classy declares that it implements Inty but does not provide implementations for any of the five interface methods. Which are true?

The class will compile..declared abstract,The class may not be instantiated.

Which of the following are true?

The event-delegation..methods of event-handling classes.

Select incorrect statement about Socket class.

The java.net.Socket class contains code that knows how to find and communicate with a server through UDP.

Select incorrect statement about Socket class. (choose 1)

The java.net.Socket class contains code that knows how to find and communicate with a server through UDP.

Suppose that we have a combobox that contains a list of data. The combobox can only display to the user one item at a time

The list of data of the combobox can be

Suppose that we have a combobox that contains a list of data. The combobox can only display to the user one item at a time. In term of Model-View-Controller, which of the following statement is correct?

The list of data of the combobox can be considered as a representative of the Model.

With respect to threads in Java, select a correct statement.

The main method (entry point of a Java program) is a default thread.

Which of the following statements about an inner class is true?

The methods of an inner class can access variables declared in the enclosing scope.

What is the preferred size of a component?

The preferred size of a component size

Suppose you are building a client - server based application using TCP socket technique. Assume at the same time, 5 clients are connecting to the server, and then the server needs to send data to the client number 2. How can the server make sure that it sends the data exactly to the 2nd client, rather than mistakenly to other clients?

The server creates a separate InputStream and OutputStream objects for each one. Then, the server uses these two objects to send and receive data to and from the specific client.

What happens if you change the contents of the text field to "wwwww"?

The text field stays the same ... using the ß and Ekeys.

A text field has a variable-width font. It is constructed by calling new TextField("iiiii"). What happens if you change the contents of the text field to "wwwww"? (Bear in mind that i is one of the narrowest characters, and w is one of the widest.)

The text field stays the same width; to see the entire contents you will have to scroll by using the ß and à keys.

Which of the following statements about the wait() and notify() methods is true? (Choose one.)

The thread that calls wait() goes into the monitor's pool of waiting threads.

How do you change the current layout manager for a container?

Use the setLayout method

SQL keyword ... is followed by the selection criteria that specify the rows to select in a query

WHERE

SQL keyword ___ is followed by the selection criteria that specify the rows to select in a query

WHERE

Select INCORRECT statement about deserialize

We use readObject

Select INCORRECT statement about deserialize.

We use readObject() method of ObjectOutputStream class to deserialize.

Select INCORRECT statement about serialization.

When an Object Output Stream serializes an object that contains references..original object.

When is a thread considered as a dead thread?

When the run() method terminates.

Which of the following are true? (Choose two.)

When you declare a method to be synchronized, the method always synchronizes on the lock of the current object.,When you declare a block of code inside a method to be synchronized, you can specify the object on whose lock the block should synchronize.

Which of the following statements is not correct about JTree control?

Which of the following statements is not correct about JTree control?

method is used to wait for a client to initiate communications.

accept()

Which of these methods is defined in MouseMotionAdapter class?

mouseDragged()

Suppose class A extends Object; Class B extends A; and class C extends B. Of these, only class C implements java.io.Externalizable. Which of the following must be true in order to avoid an exception during deserialization of an instance of C?

must have a no-args constructor.

Suppose class A extends Object; class B extends A; and class C extends B. Of these, only class C implements java.io.Serializable. Which of the following must be true in order to avoid an exception during deserialization of an instance of C?

must have a no-args constructor.

How do you create a locale for the United States?

new Locale("en", "US"); ..Locale.US;

Which constructor creates a TextArea with 10 rows and 20 columns?

new TextArea(10, 20)

Which of these method of httpd class is used to write UrlCacheEntry object into local disk?

writeDiskCache()

Suppose that your program accesses MySQL or Oracle database. Which of the following statements are true?

x2the program will have a runtime error

A swing container that groups some common components in a complex GUI.

• JPanel

Which of these class is used to make a thread?

Thread

Which of these package contains classes and interfaces for networking?

java.net

When creating a server on a port that is already in use, __________.

java.net.BindException occurs.

Which of these method of DatagramPacket is used to find the port number?

port()

A dialog prevents user input to other windows in the application unitl the dialog is closed.

Modal

MVC is short call of

Model-View-Controller

Suppose you are building an application that connects to the database to store and retreive data. Your application is built based

Model.

The JDBC-ODBC bridge is

Multithreaded

To override a superclass method in a subclass, the subclass method ____.

Must use the same method name and the same parameter types.

________ is an open source DBMS product that runs on UNIX, Linux and Windows.

MySQL

Which of the following options is a valid method that is used to bind a name to an object in RMI model?

Naming.rebind(name, object);

Which of the following components allow multiple selections?

Non-exclusive Checkboxes. List.

Choose layout managers(1) 12 buttons can not be added to a container which is assigned to a grid layout 2x5.

None of the others.

Suppose that the layout of the frame f is BorderLayout. Study the following statement:

None of the others.

Suppose that the layout of the frame f is BorderLayout. Study the following statement:g.getContentPane().add ( new JButton("B")); The button B will be let at the .... region of the frame.

None of the others.

What information may be obtained from a ResultSetMetaData object

Number of columns in the result set

Which of the following statements are true?

NumberFormat using the static ..DecimalFormat..An instance created

What is Remote method invocation (RMI)?

RMI allows us to invoke a method of java object that executes on another machine.

In RMI Architecture, which of the following components is reponsible for storing a mapping between a specific name and a remote object?

RMI registry

Which of these interface is implemented by Thread class?

Runnable

How do you use the File class to list the contents of a directory?

String[] contents = myFile.list();

In a relational data model, _________ defines the representation of the data.

Structure

Can a class be itfs own event handler?

Sure.

The following specifies the advantages of It is lightweight. It supports pluggable look and feel. It follows MVC (Model View Controller) architecture.

Swing

if an object may be accessed by some threads. These accesses should be done through ____ methods.

Synchronized

Which of these is a protocol for breaking and sending packets to an address across a network?

TCIP/IP

Which of these are integer constants of TextEvent class?

TEXT_FORMAT_CHANGED

Which of the following allows non repeatable read in JDBC Connection?

TRANSACTION_REPEATABLE_READ

The default type of the ResultSet object is ...

TYPE_FORWARD_ONLY

The default type of the ResultSet object is ____.

TYPE_FORWARD_ONLY

What is the difference between a TextArea and a TextField?

TextAreas are used for displaying graphics

What are the SubClass of Textcomponent Class?

TextField and TextArea

Which components are used to get text input from the user.

TextField and TextArea.

Which of the following are methods of the Graphics class?

drawRect(),drawImage(),drawString()

Which of these interfaces define a method actionPerformed()?

ActionListener

Which of these events is generated when computer gains or losses input focus?

FocusEvent

JDBC supports ______ and ______ models

Two-tier and three-tier

Select correct statement(s).(1) The Swing's list component (JList) can display text only. (2) The Swing's button (JButton) can not contain an image. (3) The Swing's label (JLabel) can present an image.

3

In Java Network programming using sockets, five steps are usually used:1) Open a socket.2) Open an input stream and output stream to the socket.3) Read from and write to the stream according to the server's protocol.4) Close the streams.5) Close the socket.The right order is:

1, 2, 3, 4, 5

To implement RMI, classes need to be implemented: (1) Remote interface, (2) Server object, (3) Server program, (4) Client program,

1, 2, 3, 4, 5

With respect to steps in RMI implementation.(1) Create the remote interface

1, 2, 4, 3

With respect to steps in RMI implementation: (1) Create the remote interface (2) Create the remote object (3) Create the client object (4) Create the Stub The order should be followed:

1, 2, 4, 3

Suppose a Panel is added to a Frame and a Button is added to the Panel. If the Frame's font is set to 12-point TimesRoman, the Panel's font is set to 10-point TimesRoman, and the Button's font is not set, what font will be used to display the Button's label?

10-point TimesRoman

Suppose a Panel is added to a Frame and a Button is added to the Panel. If the Framefs font is set to 12-point TimesRoman, the Panelfs font is set to 10-point TimesRoman, and the Buttonfs font is not set, what font will be used to display the Buttonfs label?

10-point TimesRoman

what font will be used to display the Button label?

10-point TimesRoman

How many types of controls does AWT supports these controls are subclasses of component?

7

Which of the following statements about a Java interface is NOT true?

A Java interface must contain more than one method.

Which of the following (is)are true?

A MenuItem can be added to a Menu.

When you use a timer, you need to define a class that implements the ____ interface.

ActionListener

Which of these are constants defined in WindowEvent class?

All of the mentioned

Select correct statement about RMI. (choose 1)allow programmers to develop distributed Java programs with the same syntax and semantics used for non-distributed programs.use object serialization to marshal and unmarshal parameters, supporting true object-oriented polymorphism.RMI applications are often comprised of two separate programs: a server and a client.

All of the others.

Select correct statement about RMI

All the above

Suppose prim is an int and wrapped is an Integer. Which of the following are legal Java statements?

All the above

Select correct statement about RMI.

All the above(allow..,use..,RMI..)

Select correct statements about remote interface

All the others choices

Select correct statement(s) about remote class.

All the others choices(..extend.,..interface,..client)

Which of the following statements about abstract methods is true?

An abstract method has a name, parameters, and a return type, but no code in the body of the method.

Which class and static method can you use to convert an array to a List?

Arrays.asList

Study the statements: 1)When a JDBC connection is created, it is in auto-commit mode 2)Once auto-commit mode is disabled, no SQL statements will be committed until you call the method commit explicitly

Both 1 and 2 are true

Which of the following is correct about savepoint?

Both of the above.

17) Which of the following are direct or indirect subclasses of Component?

Button Label Frame

Which of the following are direct or indirect subclasses of Component?

Button,Label,Frame!Frame

Which of the following are direct or indirect subclasses of Component?

Button,Label,Frame,FileDialog,Applet

Which class is used for this Processing Method processActionEvent( )?

Button,List,MenuItem

The Swing Component classes that are used in Encapsulates a mutually exclusive set of buttons?

ButtonGroup

How can you retrieve information from a ResultSet?

By invoking the special ..the ResultSet:getString(..), getBoolean (..), getClob(..)

Which of the following layout managers arranges components in horizontal rows (left to right in the order they were added to their container)

Flow Layout

The default layout manager for every JPane is

FlowLayout

The default layout manager for every jpanel is

FlowLayout

Which of the following options are correct regarding the organization of layouts

FlowLayout,BorderLayout,CardLayout

Which is the container that contain title bar and can have MenuBars. It can have other components like button, textfield etc.?

Frame

Which of the following are direct or indirect subclasses of Container?

Frame FileDialog Applet

Which of the following AWT components can have a menu, either as a menu bar or pop-up menu, attached to it?

Frame,Window,Applet,Panel

How can you force garbage collection of an object?

Garbage collection cannot be forced.

is a sophisticated, flexible layout manager

GridBagLayout

The container has a row of components that should all be displayed at the same size, filling the container's entire area

GridLayout

Which of the following layout managers honours the preferred size of a component:

GridLayout

simply makes a bunch of components equal in size and displays them in the requested number of rows and columns

GridLayout

What will happen if two thread of same priority are called to be processed simultaneously?

It is dependent on the operating system.

17. What is multithreaded programming?

It's a process in which two or more parts of same process run simultaneously.

What is multithreaded programming?

It's a process in which two or more parts of same process run simultaneously.

Which of these interfaces define a method itemStateChanged()?

ItemListener

What is synchronization in reference to a thread?

Its a process of handling situations when two or more threads need access to a shared resource.

Which of the following code statements creates a graphical button which has "Calculate" as its label ?

JButton button = new JButton("Calculate").

The ActionListener interface is used for handling action events,For example,it's used by a

JButton,JCheckbox ,JMenuItem

The ActionListener interface is used for handling action events,For example,it's used by a

JButton,JMenuItem,JCheckbox

is a set of java API for executing SQL statements.

JDBC

Which of the following represents the hierarchy of GUI text components in the hierarchy of Swing components?

JTextField and JTextArea are subclasses of JTextComponent.

JDBC stands for:

Java Database Connectivity

In Java, every class declared without an extends clause automatically extends which class?

Object

All the componenet classes and container classes are derived from _ class.

Object.

Which of the following means that the ResultSet can be both read and updated?

ResultSet.UPDATABLE

Statement objects return SQL query results as ... objects

ResultSetSuppose a source file contains a large number of import statements and one class definition. How do the imports affect the time required to load the class? (Choose one.) | Class loading takes no additional time.

Suppose the type of xarr is an array of XXX, and the type of yarr is an array of YYY. When is the assignment xarr = yarr; legal?

Sometimes

How do you specify what the program should do when the user clicks a button?

Specify the actions to take in a class that implements the ActionListener interface.

A(n) object is used to submit a query to a database

Statement

Which of the following are interfaces?

Statement ..ResultSet.. Connection

To create a statement on a Connection object conn, use

Statement statement = conn.createStatement();

When is a thread started running?

The Scheduler decides when a thread is started running.

Which containers use a BorderLayout as their default layout?

The Window, Frame and Dialog classes

In a JDBC application, suppose that the Connection, named con, was created. Study the following code:String sql= "select * from Students";Statement stmt = con.createStatement();ResultSet rs= stmt.executeQuery(sql);// code for data accessing in the result set.con.close();rs.close();

The above code will throw an exception.

Which are true about the Container class?

The validate( )..,The add( ) ..,The getComponent( )..

Which are true about the Container class?

The validate()..,The add(),The getComponent()

Race condition may happen if:

There is more than one threads access the shared data of the application.

How can you ensure that multithreaded code does not deadlock?

There is no single technique that can guarantee non-deadlocking code.

When two or more objects are added as listeners for the same event, which listener is first invoked to handle the event?

There is no way to determine which listener will be invoked first.

Which of interface contains all the methods used for handling thread related operations in Java?

ThreadHandling interface

t.setPriority(Thread.MAX_PRIORITY); System.out.println(t);

Thread[New Thread,10,main]

Which of the following statements about threads is true? (Choose one.)

Threads inherit their priority from their parent thread.

Select incorrect statement about ServerSocket class

To make the new object

With respect to the Java socket.(1) A socket contains two binary streams for sending and receiving data.(2) A socket contains two text streams for sending and receiving data.(3) Developers must implement background operations for sending and receiving data.The statement (1) is ..., (2) is ..., and (3) is ...

True, false, false

With respect to JDBC,(1) In the two-tier model, a Java application talks directly to the data source.(2) In the three-tier model, a "middle tier" of services is let between a Java program and the data source.(3) The JDBC API supports two-tier processing model for database access only.

True, true, false

With respect to networking and the client-server model. (1) A socket is one endpoint (a combination of an IP address and a port number)

True, true, true

With respect to networking and the client-server model. (1) A socket is one endpoint (a combination of an IP address and a port number) of a two-way communication link between two programs running on the network..(2) TCP (Transmission Control Protocol) is a connection-based protocol that provides a reliable flow of data between two computers.(3) UDP (User Datagram Protocol) is a protocol that sends independent packets of data, called datagrams, from one computer to another with no guarantees about arrival.

True, true, true

With respect to networking and the client-server model.(1) A socket is one endpoint (a combination of an IP address and a port number) of a two-way communication link between two programs running on the network..(2) TCP (Transmission Control Protocol) is a connection-based protocol that provides a reliable flow of data between two computers.(3) UDP (User Datagram Protocol) is a protocol that sends independent packets of data, called datagrams, from one computer to another with no guarantees about arrival.

True, true, true

With respect to networking and the client-server model. (1) A server runs on a specific computer and has a socket that is bound to a

True, true.

With respect to networking and the client-server model. (1) A server runs on a specific computer and has a socket that is bound to a specific port number. The server just waits, listening to the socket for a client to make a connection request.(2) To connect to the server, the client must know the hostname or IP of the machine on which the server is running and the port number on which the server is listening

True, true.

With respect to networking and the client-server model.(1) A server runs on a specific computer and has a socket that is bound to a specific port number. The server just waits, listening to the socket for a client to make a connection request.(2) To connect to the server, the client must know the hostname or IP of the machine on which the server is running and the port number on which the server is listening .

True, true.

With respect to processing models for database access, in the ... model a Java application talks directly to the data source

Two-tier

With respect to processing models for database access, in the ... model, a Java application talks directly to the data source.

Two-tier

JDBC supports ______ and ______ models.

Two-tier and three-tier

JDBC supports and models.

Two-tier and three-tier

______________ drivers that implement the JDBC API as a mapping to another data access API, such as ODBC. Drivers of this type are generally dependent on a native library, which limits their portability.

Type 1

drivers that implement the JDBC API as a mapping to another data access API, such as ODBC. Drivers of this type are generally dependent on a native library, which limits their portability.

Type 1

Which type of driver provides JDBC access via one or more ODBC drivers?

Type 1 driver

You are required to build an application that can connect to database to display data to end users. The requirement for the database connectivity is that it must provide a performance as fast as possible. Suppose that all types of drivers are available. Which type should you choose to satisfy the requirement?

Type 2

drivers that are written partly in the Java programming language and partly in native code. These drivers use a native client library specific to the data source to which they connect. Again, because of the native code, their portability is limited.

Type 2

drivers that use a pure Java client and communicate with a middleware server using a database-independent protocol. The middleware server then communicates the client's requests to the data source.

Type 3

Which constructor creates a TextArea with 10 rows and 20 columns?

Usage is TextArea(rows, columns)

Which of the following are true? (Choose three.)

When an application begins running, there is one non-daemon thread, whose job is to execute main().,A thread created by a daemon thread is initially also a daemon thread.,A thread created by a non-daemon thread is initially also a non-daemon thread.

What are the subclasses of the Container class?

Window,Panel,ScrollPane

Which of these events is generated when the a window is closed?

WindowEvent

Which of these events will be generated if we close an applet's window?

WindowEvent

If you attempt to compile and execute the following application, will it ever print out the message In xxx? 1. class TestThread3 extends Thread { 2. public void run() { 3. System.out.println("Running"); 4. System.out.println("Done"); 5. } 6. 7. private void xxx() { 8. System.out.println("In xxx"); 49 9. } 10. 11. public static void main(String args[]) { 12. TestThread3 ttt = new TestThread3(); 13. ttt.xxx(); 14. ttt.start(); 12. } 13. }

Yes

Is it possible to write code that can execute only if the current thread owns multiple locks?

Yes

You are required to build a GUI application. The application has a main window which displays:

You are required to build a GUI application. The application has a main

A monitor called mon has 10 threads in its waiting pool; all these waiting threads have the same priority. One of the threads is thr1. How can you notify thr1 so that it alone moves from the Waiting state to the Ready state?

You cannot specify which thread will get notified.

A monitor called mon has 10 threads in its waiting pool; all these waiting threads have the same priority. One of the threads is thr1. How can you notify thr1 so that it alone moves from the Waiting state to the Ready state? (Choose one.)

You cannot specify which thread will get notified.

You have a class which extends the JComponent class. In this class you have created a painted graphical object. Your code will change the data in the graphical object. What additional code is needed to ensure that the graphical object will be updated with the changed data?

You must call the component object's repaint() method.

Database meta data are retrieved through ____________.

a Connection object

Result set meta data are retrieved through ____________.

a ResultSet Object

The next() method of the java.sql.ResultSet class return ......

a boolean value.

Which method of the container class can be used to add components to a Panel.

add() method.

Which of these methods are used to register a keyboard event listener?

addKeyListener()

Which of these methods are used to register a mouse motion listener?

addMouseMotionListner()

DefaultTableModel contains the methods for

adding a column ..inserting a new row..adding a new row

Which of these are constants defined in WindowEvent class?

all

What is the return value from stmt.executeUpdate("insert into T values (100, 'Smith')")

an int value indicating how many rows are effected from the invocation

No output because of compile error at line: System.out.println("b="+b)

b = b * b1

With respect to the Java RMI, a server and a client program .......

can run in two separate virtual machines.

A single try block must be followed by which of these?

finally & catch

What does the following code draw?

g.drawLine(10, 10, 10, 50);

Which of these methods can be used to obtain the reference to the container that generated a ContainerEvent?

getContainerEvent()

Which of these methods is used to know the type of content used in the URL?

getContentType()

. Which function of pre defined class Thread is used to check weather current thread being checked is still running?

isAlive()

Which of these method of DatagramPacket is used to obtain the byte array of data contained in a datagram?

getData()

Which of these methods is used to know host of an URL?

getHost()

Which of these methods can be used to determine the type of event?

getID()

What methods are used to get and set the text label displayed by a Button object?

getLabel() and setLabel()

Which of these methods is used to know when was the URL last modified?

getLastModified()

Which of these method of DatagramPacket is used to find the length of byte array?

getLength()

Which of these methods can be used to know which key is pressed?

getModifier()

Which Component method is used to access a component's immediate Container?

getParent()

Which of these methods can be used to obtain the coordinates of a mouse?

getPoint()

Consider the following url address:http://192.168.2.2:12/users/index.html Select a correct statement:

http is protocol, 192.168.2.2:12 is socket.

Which of these class is used for operating on request from the client to the server?

httpd

Which function of pre defined class Thread is used to check weather current thread being checked is still running?

isAlive()

Which of these method is used to find out that a thread is still running or not?

isAlive()

34 Where is com.mysql.jdbc.Driver located?

in a JAR file mysqljdbc.jar

Which method executes only once

init() method

DefaultTableModel contains the methods for

inserting a new row..adding a column..adding a new row

Which of the following is used generally used for altering the databases?

int executeUpdate()

Which of these methods can be used to know the type of focus change?

isTemporary()

Package of drawstring() method is

java.awt

What class is at the top of the AWT event hierarchy?

java.awt.AWTEvent.

Which class provides many methods for graphics programming?

java.awt.Graphics

Which of these packages contains all the classes and methods required for even handling in Java?

java.awt.event

Which of these packages contains all the event handling interfaces?

java.awt.event

Which package provides many event classes and Listener interfaces for event handling?

java.awt.event

Which of these packages contain all the Java's built in exceptions?

java.lang

The Swing component classes can be found in the package.

javax.swing

A database URL for a MySQL database named test on host panda.armstrong.edu is ________.

jdbc:mysql://panda.armstrong.edu/test

22 A database URL for an access database source test is ________.

jdbc:odbc:test

. Which of these method waits for the thread to treminate?

join()

Which of these method waits for the thread to treminate?

join()

common syntax of each line in the properties file:

key = value

Which of these methods will be invoked if a character is entered?

keyTyped()

You want to construct a text area that is 80 character-widths wide and 10 character-heights tall. What code do you use?

new TextArea(10, 80)

Suppose class A has a method called doSomething(), with default access. Suppose class B extends A and overrides doSomething(). Which access modes may not apply to B?s version of doSomething()?

private

URL referring to databases use the form:

protocol:subprotocol:datasoursename

1. Which of these method is used to implement Runnable interface?

run()

Which of these method is used to implement Runnable interface?

run()

Which of these method is used to start a server thread?

run()

Which of these statement is incorrect?

run() method is used to begin execution of a thread before start() method in special

Which of these statement is incorrect?

run() method is used to begin execution of a thread before start() method in special cases.

Which TextComponent method is used to set a TextComponent to the read-only state ?

setEditable()

Which of the following is correct about setFetchSize(int)?

setFetchSize(int) defines the number of rows that will be read from the database when the ResultSet needs more rows.

Which method do you use to add a menu bar to a top-level container such as a JFrame?

setJMenuBar

Which method is method to set the layout of a container?

setLayout( )

Which method is method to set the layout of a container?

setLayout()

The layout of a container can be altered by using which of the following methods

setLayout(aLayoutManager)

An Applet has its Layout Manager set to the default of FlowLayout. What code would be the correct to change to another Layout Manager?

setLayout(new GridLayout(2,2));

Which of the following is correct about setMaxRows(int)?

setMaxRows(int) method of the ResultSet specifies how many rows a ResultSet can contain at a time.

Which of these method is used to explicitly set the priority of a thread?

setPriority()

Which method is used to set the text of a Label object?

setText( )

By which method You can set or change the text in a Label?

setText()

Which method is used to set the text of a Label object?

setText()

Which method will cause a Frame to be displayed?

show( ) setVisible( )

Which method will cause a Frame to be displayed?

show(),setVisible()

. Which of these method of Thread class is used to Suspend a thread for a period of time?

sleep()

Which of these method can be used to make the main thread to be executed last among all the threads?

sleep()

Which of these method is used to begin the execution of a thread?

start()

Which of these data member of HttpResponse class is used to store the response from a http server?

statusCode

To execute a SELECT statement "select * from Address" on a Statement object stmt, use

stmt.executeQuery("select * from Address");

The ____reserved word is used to deactivate polymorphism and invoke a method of the superclass.

super

Which of these keywords are used to implement synchronization ?

synchronized

Suppose that you want to have an object eh handle the TextEvent of a TextArea object t.How should you add eh as the event handler for t?

t.addTextListener(eh);

Which of these method is used to tell the calling thread to give up monitor and go to sleep until some other thread enters the same monitor?

wait()

Suppose you are building an application that connects to the database to store and retreive data. Your application is built based on Model-View-Controller pattern. Which of the following components is responsible for connecting to the database?

• Model.


Kaugnay na mga set ng pag-aaral

Understanding relationships quiz

View Set

Muscles of shoulder & arm (origin, insertion, action, innervation)

View Set

Chapter 2 - Number Systems, Operations and Codes

View Set

MGT 301 Chpt 9-12 Homework questions

View Set

Цитати історія ЗНО

View Set