Deck 11: Java Programming : JDBC API, Layout Managers, and Event Handling

Full screen (f)
exit full mode
Question
Which statement is static and synchronized in JDBC API?

A)executeQuery()
B)executeUpdate()
C)getConnection()
D)prepareCall()
Use Space or
up arrow
down arrow
to flip the card.
Question
Which driver is efficient and always preferable for using JDBC applications?

A)Type - 4
B)Type - 1
C)Type - 3
D)Type - 2
Question
Which one of the following does not extends java.awt.Component

A)CheckBox
B)Canvas
C)CheckbocGroup
D)Label
Question
What is default layout manager for panels and applets?

A)Flowlayout
B)Gridlayout
C)BorderLayout
D)None of above
Question
java.awt.Component class method getLocation() returns Point (containg x and y cordinate).What does this x and y specify

A)Specify the postion of components lower-left component in the coordinate space of the component's parent.
B)Specify the postion of components upper-left component in the coordinate space of the component's parent.
C)Specify the postion of components upper-left component in the coordinate space of the screen.
D)None of above
Question
Which of the following methods finds the maximum number of connections that a specific driver can obtain?

A)Database.getMaxConnections
B)Connection.getMaxConnection
C)DatabaseMetaData.getMaxConnections
D)ResultSetMetaData.getMaxConnections
Question
What is the disadvantage of Type-4 Native-Protocol Driver?

A)At client side, a separate driver is needed for each database.
B)Type-4 driver is entirely written in Java
C)The driver converts JDBC calls into vendor-specific database protocol
D)It does not support to read MySQL data.
Question
What is the preferred way to handle an object's events in Java 2?

A)Override the object's handleEvent( ) method.
B)Add one or more event listeners to handle the events
C)Have the object override its process Event ( ) methods.
D)Have the object override its dispatch Event ( ) methods.
Question
Which component method is used to access a component's immediate container?

A)getVisible()
B)getImmediate()
C)getParent()
D)getContainer()
Question
Which of the following creates a List with 5 visible items and multiple selections enabled?

A)new List(5, true)
B)new List(true, 5)
C)new List(5, false)
D)new List(false, 5)
Question
An Applet has its Layout Manager set to the default of FlowLayout. What code would be the correct to change to another Layout Manager?

A)setLayoutManager(new GridLayout());
B)setLayout(new GridLayout(2,2));
C)setGridLayout(2,2);
D)setBorderLayout();
Question
How do you change the current layout manager for a container?

A)Use the setLayout method.
B)Once created you cannot change the current layout manager of a component
C)Use the setLayoutManager meth
Question
Which of the following methods can be used to draw the outline of a square within a JAVA.awt.Component object?

A)drawLine()
B)fillRect()
C)drawPolygon().
D)drawPolygon()
Question
State true or false
(i) JPanel is a class included in awt package
(ii) Anonymous classes are mostly used for event handling
(iii) Names of anonymous classes must be unique
(iv) JOptionPane is an inner class

A)i-false, ii-false, iii-true, iv-true
B)i-true, ii-false, iii-true, iv-false
C)i-false, ii-true, iii-false, iv-false
D)i-true, ii-true, iii-false, iv-true
Question
State true or false
(i) Java RMI supports distributed objects written entirely in java
(ii) Java RMI makes use of stubs and skeleton
(iii) In Java RMI an object registers itself with a media server
(iv) IDL is interface declaration language

A)True, True, False, False
B)False, True, True, True
C)True, False, True, False
D)True, True, True, True
Question
Match the following
(a) Datagram Socket (i) UDP connection
(b) URL (ii) provides a necessary framework of debugging java programs
(c) java.net (iii) makes it possible to communicate over a network with java programs
(d) sun.tools.debug (iv) is a java object that represents WWW address

A)a-i, b-iv, c-iii, d-ii
B)a-i, b-iv, c-ii, d-iii
C)a-ii, b-iii, c-i, d-iv
D)a-ii, b-i, c-iii, d-iv
Question
State true or false
(i) public can only be assigned to class
(ii) protected protects a statement
(iii) protected method is never accessible outside the package
(iv) friendly variable may be accessible outside class

A)True, True, False, True
B)False, False, False, True
C)False, True, False, False
D)True, False, False, False
Question
Which refers to a channel through which data flow from the source to the destination:

A)String
B)Character
C)Stream
D)Buffer
Question
The ________ method help in clearing the contents of the buffer:

A)flush()
B)clear()
C)rub()
D)vanish()
Question
Which of these methods can be used to output a string in an applet?

A)display()
B)print()
C)drawString()
D)transient()
Question
Which of these methods are used to register a MouseMotionListener?

A)addMouse()
B)addMouseListener()
C)addMouseMotionListner()
D)eventMouseMotionListener()
Question
What is a listener in context to event handling?

A)A listener is a variable that is notified when an event occurs.
B)A listener is an interface that is notified when an event occurs.
C)A listener is a method that is notified when an event occurs.
D)None of the mentioned
Question
Which of these events will be generated if scroll bar is manipulated?

A)ActionEvent
B)ComponentEvent
C)AdjustmentEvent
D)WindowEvent
Question
Which of these events will be generated if we close a Frame window?

A)ActionEvent
B)ComponentEvent
C)AdjustmentEvent
D)WindowEvent
Question
Which of these methods in KeyEvent class can be used to know which key is pressed?

A)getKeyCode()
B)getModifier()
C)getActionKey()
D)getActionEvent()
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/25
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 11: Java Programming : JDBC API, Layout Managers, and Event Handling
1
Which statement is static and synchronized in JDBC API?

A)executeQuery()
B)executeUpdate()
C)getConnection()
D)prepareCall()
getConnection()
2
Which driver is efficient and always preferable for using JDBC applications?

A)Type - 4
B)Type - 1
C)Type - 3
D)Type - 2
Type - 4
3
Which one of the following does not extends java.awt.Component

A)CheckBox
B)Canvas
C)CheckbocGroup
D)Label
CheckbocGroup
4
What is default layout manager for panels and applets?

A)Flowlayout
B)Gridlayout
C)BorderLayout
D)None of above
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
5
java.awt.Component class method getLocation() returns Point (containg x and y cordinate).What does this x and y specify

A)Specify the postion of components lower-left component in the coordinate space of the component's parent.
B)Specify the postion of components upper-left component in the coordinate space of the component's parent.
C)Specify the postion of components upper-left component in the coordinate space of the screen.
D)None of above
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
6
Which of the following methods finds the maximum number of connections that a specific driver can obtain?

A)Database.getMaxConnections
B)Connection.getMaxConnection
C)DatabaseMetaData.getMaxConnections
D)ResultSetMetaData.getMaxConnections
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
7
What is the disadvantage of Type-4 Native-Protocol Driver?

A)At client side, a separate driver is needed for each database.
B)Type-4 driver is entirely written in Java
C)The driver converts JDBC calls into vendor-specific database protocol
D)It does not support to read MySQL data.
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
8
What is the preferred way to handle an object's events in Java 2?

A)Override the object's handleEvent( ) method.
B)Add one or more event listeners to handle the events
C)Have the object override its process Event ( ) methods.
D)Have the object override its dispatch Event ( ) methods.
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
9
Which component method is used to access a component's immediate container?

A)getVisible()
B)getImmediate()
C)getParent()
D)getContainer()
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
10
Which of the following creates a List with 5 visible items and multiple selections enabled?

A)new List(5, true)
B)new List(true, 5)
C)new List(5, false)
D)new List(false, 5)
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
11
An Applet has its Layout Manager set to the default of FlowLayout. What code would be the correct to change to another Layout Manager?

A)setLayoutManager(new GridLayout());
B)setLayout(new GridLayout(2,2));
C)setGridLayout(2,2);
D)setBorderLayout();
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
12
How do you change the current layout manager for a container?

A)Use the setLayout method.
B)Once created you cannot change the current layout manager of a component
C)Use the setLayoutManager meth
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
13
Which of the following methods can be used to draw the outline of a square within a JAVA.awt.Component object?

A)drawLine()
B)fillRect()
C)drawPolygon().
D)drawPolygon()
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
14
State true or false
(i) JPanel is a class included in awt package
(ii) Anonymous classes are mostly used for event handling
(iii) Names of anonymous classes must be unique
(iv) JOptionPane is an inner class

A)i-false, ii-false, iii-true, iv-true
B)i-true, ii-false, iii-true, iv-false
C)i-false, ii-true, iii-false, iv-false
D)i-true, ii-true, iii-false, iv-true
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
15
State true or false
(i) Java RMI supports distributed objects written entirely in java
(ii) Java RMI makes use of stubs and skeleton
(iii) In Java RMI an object registers itself with a media server
(iv) IDL is interface declaration language

A)True, True, False, False
B)False, True, True, True
C)True, False, True, False
D)True, True, True, True
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
16
Match the following
(a) Datagram Socket (i) UDP connection
(b) URL (ii) provides a necessary framework of debugging java programs
(c) java.net (iii) makes it possible to communicate over a network with java programs
(d) sun.tools.debug (iv) is a java object that represents WWW address

A)a-i, b-iv, c-iii, d-ii
B)a-i, b-iv, c-ii, d-iii
C)a-ii, b-iii, c-i, d-iv
D)a-ii, b-i, c-iii, d-iv
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
17
State true or false
(i) public can only be assigned to class
(ii) protected protects a statement
(iii) protected method is never accessible outside the package
(iv) friendly variable may be accessible outside class

A)True, True, False, True
B)False, False, False, True
C)False, True, False, False
D)True, False, False, False
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
18
Which refers to a channel through which data flow from the source to the destination:

A)String
B)Character
C)Stream
D)Buffer
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
19
The ________ method help in clearing the contents of the buffer:

A)flush()
B)clear()
C)rub()
D)vanish()
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
20
Which of these methods can be used to output a string in an applet?

A)display()
B)print()
C)drawString()
D)transient()
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
21
Which of these methods are used to register a MouseMotionListener?

A)addMouse()
B)addMouseListener()
C)addMouseMotionListner()
D)eventMouseMotionListener()
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
22
What is a listener in context to event handling?

A)A listener is a variable that is notified when an event occurs.
B)A listener is an interface that is notified when an event occurs.
C)A listener is a method that is notified when an event occurs.
D)None of the mentioned
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
23
Which of these events will be generated if scroll bar is manipulated?

A)ActionEvent
B)ComponentEvent
C)AdjustmentEvent
D)WindowEvent
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
24
Which of these events will be generated if we close a Frame window?

A)ActionEvent
B)ComponentEvent
C)AdjustmentEvent
D)WindowEvent
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
25
Which of these methods in KeyEvent class can be used to know which key is pressed?

A)getKeyCode()
B)getModifier()
C)getActionKey()
D)getActionEvent()
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 25 flashcards in this deck.