Advanced Java Programming (AJP) MCQs
Advanced Java Programming (AJP) MCQs
6. Which class can be used to represent the Checkbox with a textual label that can
appear in a menu ?
A) MenuBar
B) MenuItem
C) CheckboxMenuItem
D) Menu
Answer: c
21. Which class encapsulates a blank window upon which we can draw?
a) Applet
b)Canvas
c)Window
d)Frame
Answer: b
25. The correct constructor of Insets( ) which uses the values is…
a) Insets(int top, int left, int bottom, int right)
b) Insets(int bottom, int right, int top, int left)
c) Insets(int right, int top, int left, int bottom)
d)Insets(Dimesnion d1, Dimension d2)
Answer: a
28. Which method is used to append the text at the end of TextArea?
a) append( )
b) add( )
c) appendAt( )
d) addAt( )
Answer: a
35. How can the Checkbox class be used to create a radio button?
a) By associating Checkbox objects with a CheckboxGroup.
b) using RadioButton class of AWT
c) using the RoundButton class
d) None
Answer: a
40. The URL Connection class can be used to read and write data to
the specified resource referred by the URL
a) True
b) False
Answer: a
41. Which of the following constructor creates a TextField with 5 columns width?
a) TextField()
b) TextField(5)
c) TextField(5,5)
d) Both a and b
Answer: d
44. TCP, FTP, Telnet, SMTP, POP etc. are examples of?
a) Socket
b) IP Address
c) Protocol
d) MAC Address
Answer: c
47. How would you set the color of a graphics context called g to cyan?
a) g.setColor(Color.cyan);
b) g.setCurrentColor(cyan);c
c) g.setColor("Color.cyan");
d) g.setColor("cyan’);
Answer: a
49. In Int Address class which method returns the host name of the
IP Address?
a) Public String get Hostname()
b) Public String getHostAddress()
c) Public static IntAddress get Localhost()
d) None of the mentioned
Answer: a
50. Which of the following is a passive component?
a) Label
b) Button
c) Checkbox
d) Scrollbar
Answer: a
60. Which of the following constructor creates a TextField with 5 columns width?
a) TextField()
b) TextField(5)
c) TextField(5,5)
d) Both a and b
Answer: d
67. Which type of driver converts JDBC calls into the network protocol used
by the database management system directly?
a) Type 1 driver
b) Type 2 driver
c) Type 3 driver
d) Type 4 driver
Answer: d
69. Which type of driver provides JDBC access via one or more ODBC
drivers?
a) Type 1 driver
b) Type 2 driver
c) Type 3 driver
d) Type 4 driver
Answer: a
72. Which constructor is used to give multiple mode selection facility to List?
a) List()
b) List(3)
c) List(3,true)
d) List(3,false)
Answer: c
75. How do you know in your Java program that a SQL warning is
generated as a result of executing a SQL statement in the database?
a) You must catch the checked SQLException which is thrown by the method which
executes the statement
b) You must catch the unchecked SQLWarningException which is thrown by the method
which executes the statement
c) You must invoke the getWarnings() method on the Statement object (or a sub
interface thereof)
d) You must query the ResultSet object about possible warnings generated by the
database
Answer: c
77.How can you execute DML statements (i.e. insert, delete, update) in the
database?
a) By making use of the InsertStatement, DeleteStatement or UpdateStatement classes
b) By invoking the execute(…) or executeUpdate(…) method of a normal Statement
object or a sub-interface object thereof
c) By invoking the executeInsert(…), executeDelete(…) or executeUpdate(…) methods
of
the DataModificationStatement object
d) By making use of the execute(…) statement of the DataModificationStatement
object
Answer: b
83. In which cryptography the public and private key are used?
a) Symmetric key cryptography b)Asymmetric key cryptography
c)both a and b
d) None of the above
Answer: b
84. Which constructor is used to create ServerSocket connected to port no 1254 and
maxq length as 50.
a) ServerSocket(1254)
b)ServerSocket()
c)ServerSockect(50)
d)None of the above
Answer: a
85. A technique that creates a subletting effect; one server answers ARP requests
for multiple hosts?
a) Proxy Server
b)Proxy firewall
c)Proxy ARP
d)None of the above
Answer: a
86. Which client accesses the Web server by using a GET MESSAGE?
a) HTTP
b) FTP
c) SMTP
d) IMTP
Answer: a
89. Which protocol that web browsers and servers use to transfer hypertext pages
and images?
a) TCP/IP
b) UDP
c) HTTP
d) SMTP
Answer: c
93. Which class is used to encapsulate both the numerical IP address and the domain
name for that address?
a) InetAddress
b) SocketAddress
c) IPAdress
d) DNSSockets
Answer: a
107. In JSP how many ways are there to perform exception handling?
a) 3
b) 2
c) 4
d) 5
Answer: b
112. What servlet processor was developed by Apache Foundation and Sun?
a) Apache Tomcat
b) Apache web server
c) Sun servlet processor
d) None of the above
Answer: a
113. What is invoked via HTTP on the Web server computer when it responds to
requests from a user's Web
browser?
a) A java Application
b) A java servlet
c) A java Applet
d) all of the above
Answer: b
117. The doGet() method in the example extracts values of the parameter’s type and
number by using
__________
a) request.getParameter()
b) request.setParameter()
c) responce.getParameter()
d) responce.getAttribute()
Answer: b
121. What is the limit of data to be passed from HTML when doGet() method is used?
a) 4K
b) 8K
c) 2K
d) 1K
Answer: c
124. Which method is used to specify before any lines that uses the PrintWriter?
a) setPageType()
b) setContextType()
c) setContentType()
d) setResponseType()
Answer: c