Dev-Cpp: A Applet
Dev-Cpp: A Applet
Ouck acess
Corel 03-Jul-17 2:33 PM Fide fol
cygwin 09-Jul-16 804 PM File fol
Dell 29-Apr-16 1:50 PM File fol
Dev-Cpp 12-Jul-16 7:57 PMFlefot
esktop ecipse 19-Apr-194:50 PM File fol
ESD 27-Jun-18 1:39 PM File fol
hibematejar 06-Jan-16 3:27 PM File fol
NOarne HP Universal Print Driver 02-Aug-18 12:32 P.. Filefol
HP_UM4345MFP PS 32bt 02-Aug-18 1248 P... File fol
inetpub 25-Jun-18 913 PM Filefol
This PC Intel 13-Sep-15 849 PM File fol
logs 31-Oct-17 1057 AM File fol
MnGW 04-Feb-16,1:27PM Filefol
Review Questions
1. What is Dialog box?
2. Write a java program to illustrate Filedialog box.
T Technical
TM
aDialog b PileDialog
c File d None of these
Answere:
1. b3 4
5. |a8.
9. b10. a 11. d 12. d
13. 14.e 15. |b 16. b
17.c 18. b 19. 20. c
21. b 22. a 23. b 24. d
25 a 26.b 27. c 28.
29. a 30. d 31. 32. | d
33. d 34a 35. b 36.
37. a38. a 39. a 40. a
41. b
O00
dvanced Java Programming
2- 25
For the button
component the color, the size of the Swings
button will be decided by the view. Multiple Cholce Questlons
Q.1 Pluggablelook and feel and lightweight
The controller is for
managing user interaction
the components are the features supported by
with the model. It is basically for
input. The controller takes handling the user a Swing b AWT
of mouse
care
keyboard events. For example For the and Core Java djNone of these
button a.2 Swing is based
on architecture
component the reaction of events on the button a client server model view controller
press will be decided by the controller.
The MVC architecture of
c layered d none of these
swing specifies how these Q.3 Swing is not a part of JFCJava Foundation
three Objects (Model, View and
Controller) interact. Classes) that is used to create GUI application
For the text field the model is al True
contents of the text
field. The model
nothing but the
Q.4 The Java Foundation Classes
False
must (JFC)is a set of
implement method to change the contents and
the GUI components which simplify the
to discover the contents. For development of desktop applications.
textexample model
had methods to add, to remove the characters. One aTrue b False
important thing to note is Q.5 Following letter used
that the model is as a prefix to swing
completely non visual. component.
a A
For a single
model there can be more
than one
Ds
views. Each view can show different aspect of the Q.6 is of the features of
content. For example- A particular web page can be one
object oriented
programming that allows the creation of
viewed in its WYSIWwYG (What-You-See-Is-What hierarchical classifications.
You-Get) form or in the raw tagged form. But there a Polymorphism bClass
are some components like button for which it is not eInheritance
ossible to have multiple views for the same model. d Object
a.7 In Swing JButton dass is derived from
The controller handles the user-input events such as a AbstractButton bToggleButton
mouse clickS and keyboard strokes. On receiving cJComponent d None of these
he events the controller decides whether to Q.8 The
JTextComponent derives two components
ranslate it into corresponding model or in views. JTextField and
f user presses the button then the controller calls aComboBox TextArea
he event handling methods in order to handle the cJSlider dAll of the above
utton press. The controller tells the view to Q.9 In Swing class hierarchy the class present at the
update
self and to display the desired result. For root is
isplaying the desired result the view reads the aComponent bWindow
ontent from the model. Thus model-view and cContainer aObject
Q.10 pane can be used to add
ontroller works together in order to accomplish the
Component to container
ertain task.
a Glass bContent
jew Question c Container d All of above
Write a short note on -MVC Architecture Q.11 Select the correct source code
using swing for
generating following output.
TM
Apole aned.
public void
aList JComboBox
public void paint(Graphics g) cJLAbel d All of the above
paint(Graphics g)
g.drawString("WELcOME Q.15
TO SWING
g.msgWELCOME TO PROGRAM,20,40);
sWING
PROGRAM 20,40);
2-27 Swings
16
To generate
following output the
thatare used are components
Appiet
Appu Ap
Appleorange Grape Apple Applet Applet
**asBAssIStsssAsdsdstiasioissjojad01
C++ Uava
Lpwnvwnyownunwmwwd.A2i
Python
Checkbox, Textbox
6 Radiobutton, Textbox
C Checkbox,button
a List, Textbox
I. Canvas is a component
IL.ScrollPane is a container
aIis True and II is False
bIis False and II is True
cl and II both are False
and II both are true
2-29 Satngs
s w i n g - g i v e s tthe visual
n representation of
a31 the component
21. d a 23. 24. d
22
View
/Model
cController
29. b 30. a 31. b 32. e
n swing
the event1
handling task is carrie out
a.32
by 33. a L
Model
b View
dNone of these Explanations:
eontroller
Q.19: In above code we have pass 2 as a first
represents enterprise data and the business items
a33 parameter to the constructor list. Hence first two
rules that gives access to enterprise data.
of the list will be displayed. The second parameter to
CModel bView S t 1s true that means this list is a scrollable. Hence the
events? a WINDOW_ACTIVATED
setBackground(Color.red):
ublic void
actionPe
Performed(ActionEvent e)
added as
Q.31 When two itemStateChanged( ItemEvent
itemEvent e)
e)
itemStateChanged
are
or more objects is
which listener
listeners for the same event, action(Event e,Object o)
f first invoked to handle the event
a The first object that was added as listener. d xtValueChanged( TextEvent e):
b The last object that was added as listener.
Answers
will be
cThere is no way to determine which listener 1. c 2 d3. a
invoked first. 5. b 6 . c 7. a 8.
dIt is impossible to have more than one listener tor a
9. a 10.|b 11. d 12
given event.
13. d 14.d 15. d 16.
Q.32 Consider following code and fill up thecor
event listener method 17. d 18. a 19. a 20. a
add(box1);
add(box2);
add(box3);
box1.additemListener(this);
box2.addItemListener(this);
box3.additemListener(this);
public void
repaint();
msg=I ike";
msg+=g.getSelectedCheckbox().getlabel(0:
g.drawString(mag.10,100);
echnical Puhlicatings
Multiple Cholce Questions ?
Q.1 Which contains the classes and
interfaces required for Java networking
package
ajava.io bjava.util
cjava.net djava.awt
class ?
Q.2 Which methods are commonly used in ServerSocket
True b False
Which of these class is used to
h of
Which of these is
False
a11
a.11 a full form of DNS ?
aData Network Service
Data Name Service
cDomain Network Service
Domain Name Service
System.out.print(x);
a 0 1
True aFalse
Q.13 The client in socket
programming must know which informations ?
a IP address of server |bPort number
Both a and b
dNone of the above
a14 Datagram is basically an information but there is no guarantee of its content, arrival or arrival tine.
aTrue False
15 What is the output of this program ?
import java.net.";
class networking {
public static void main(Stringll args) throws UnknowwnHostException
InetAddress objl =
InetAddress.getByName(www.google.com")
InetAddress obj2 = InetAddress.getByName(www.google.com'%
boolean x= abj1.equals(obj2);
System.out.print(z);
ao
ue False
Technicel Publicetions An up thrustfor knowedg
Advanced Java Programming 4-34 iruao
a.16 Port number 80 is reserved for a.20 Which method of URI
, protocol
and it has cmplete u h maud
aFTP HTTP URIL in Java ?
a Telnet manipulate
SMTP
a.17 While using the getlLocalHost() method the a java.net.URL
bjava.net.URIconnection
exceptionisthrown
afUnknownHostException bNullHostException java.net.URI
d None of the above
LostHostException diOException
Q.18 The class is used for accessing the Answers
attributes of remote resource.
1 . 2 b 3.4 b
a URLconnection URL 6.
b7
URI dnone of these
9. c19. b 11. d 12.
a.19 The correct way of using ServerSocket is 13. c 14. | a 15.c 16
a ServerSocket{int port)
bServerSocket(int port, int maxQueue) 17. a 18.a 19. d 2
cServerSocket(int port, int maxQueue, InetAddress
localAddress)
aAll of these
PrOgTu
rs=null;
c2
.Which type of driver provides JDBC access via
if(statl=null) one or more ODBC drivers?
{ a Type 1driver bType 2 driver
stat.close();
cType 3driver d Type 4 driver
stat nul;
.8 Which type of driver converts JDBC calls into
Which packages contain the JDBC classes ? a Type 1and 2 b Type 1 and 3
ajava.jdbc and javax.jdbe Type 3 and 4 d Type 4 only
Jjava.jdbc and java.jdb.sq a.13 Which of the following is false as far as
type 4
CRva.sql and javax.sql driver is concern?
b3
TM
Technical Publcations An up thrust for knowledsge
Autumndlaru Prynaremiry_ 5-118 Interac
acting
twith Data
y p e 4 drivers uses socket class to connect to the d| A DataSource is a factory of connection
nnections to a
physical data source.
database.
Q.19 Which of the following describes the
d Type 4 drivers can not be used with Netscape. the correc
sequence of the steps involved in ma
.14 Which of the following JDBC drivers is known
connection with a database. aking a
as a partially java driver ?
1. Loading the driver.
aDBC-ODBCbridge driver
2. Process the results.
bNative-APl driver 3. Making the connection with the database
eNetwork protocol driver the SQL statements.
4. Executing
dThindriver a 1,3,4.2 D1,2.34
a.15 Which class has strong support of the JDBC
architecture ? C2,1.3,4 d 4,1,2,3
a.20 Which of the following methods are needed
a The JDBC driver manager for
loading a database driver in JDBC?
b The JDBC driver test suite laregisterDriver() method
The DBC-ODBC bridge
b Class.forName()
d All of these and b
Q.16 In order to transfer data between a database cBoth a
cA
services.
Newlt vlfet ?
deletekuw() ona a.32 Toexee ute a ntatement, we invku metvw
o are
ositioned on
la deleted from lexerutetUpdate methow
heKeslt:et, but nol from the databane.
bwxecutelel method
1he
il ale positioned on la deleted from eexecutetMmt methon
and from the
databane.
Resultt
talse
renult set, is said to be
You
a will get a compile error: 'The method doen a fetch method beurrent method
eist because you can not delete row» from next method d access method
a ResultSet.
Q.34 The ResultSet.next method is used to mowe tn
DBC-ODBC
bridge supports multple the next row of the Resultet, making it the
meurrent open statements per connectlon ? current row,
30 Databasessystem
17. a 18. | d 19.a 20. c
compiles query when it is
exeuted binitialized
21.
a22.b23. d 24. d
prepared d invoked
25. b 26. | a 27.a 28. a
29. e 30.e 31.b 32. a
5 an open source DBMS product that runs
n
window as well as Linux.
33.
34a 35. b 36.
SPISQL b MySQL
37. a
MicTrosoft Access a sQL Server O00
Technical Publicetions
An up thrust for know/edge
6-22
Advanced Java Programming
Servlet instance is
created
this method is void. b
method is invoked
Review Question
Cinit, Service, destroy
1. Explain session management and cookies in servlet. d All of these
Q.9 What is the
difference between
Multiple Choice Questions Servlet andd
se
specificationdefines an applet?
Q.1 The Java.
application programming
interface for aservlets execute on servers while applets execute
communication between the web server and the on browser
aservlet b randomise
dynamic pages
applet d script cservlets can execute Single request while applets
Q.2 Which method is used to specify before any execute multiple requests
lines that uses the PintWriter?
d None of these
asetPageType0 setContextType0
Q.10 A deployment descriptor describes
csetContentType0 ld]setResponseType0
a web component response settings
Q.3 What are the functions of Servlet container ?
6-23 Servlets
eauest.getParameter()
.20 What type of servlets use these methods 17. d 18. a 19. a 20. b
doGet(), doPost),doHead, doDelete(0
doTrace ? 21. a 22. c 23. a 24. b