AJ MCQ Final
AJ MCQ Final
Unit 1 : JDBC
Multiple Choice Questions
A) java.io.date
B) java.sql.date
C) java.util.date
D) java.util.dateTime
A) Slow performance
D) Better performance
A) Slow performance
A) java.sql.TimeStamp
B) java.sql.Time
C) java.io.Time
D) java.io.TimeStamp
A) Statement
B) PreparedStatement
C) CallableStatment
D) CalledStatement
A) setMaxRows(int i)
B) setMinRows(int i)
C) getMaxrows(int i)
D) getMinRows(int i)
A) setBatch()
B) deleteBatch()
C) removeBatch()
D) addBatch()
A) rollback()
B) rollforward()
C) deleteTransaction()
D) RemoveTransaction()
A) TRANSACTION_NONE
B) TRANSACTION_READ_COMMITTED
C) TRANSACTION_REPEATABLE_READ
D) TRANSACTION_NONREPEATABLE_READ
D) Thin driver
12) How many JDBC product components does the Java software provides?
A)3
B)2
C)4
D)5
A) 3
B) 4
C) 2
D) 5
14) Which result set generally does not show changes to the underlying database
that are made while it is open. The membership, order, and column values of
A) TYPE_FORWARD_ONLY
B) TYPE_SCROLL_INSENSITIVE
C) TYPE_SCROLL_SENSITIVE
15) JDBC is a Java API that is used to connect and execute query to the database
A) True
B) False
16) Which method is used for an SQL statement that is executed frequently?
A) prepare Statement
B) prepare Call
C) create Statement
A) Statement interface
B) PreparedStatement interface
C) ResultSet interface
18) Which JDBC product components does the Java software provide?
20) Which class has traditionally been the backbone of the JDBC architecture?
C) JDBC-ODBC bridge
ANSWER KEY
Q.1 Q.2 Q.3 Q.4 Q.5 Q.6 Q.7 Q.8 Q.9 Q.10
D D C A C C A D A D
Q.11 Q.12 Q.13 Q.14 Q.15 Q.16 Q.17 Q.18 Q.19 Q.20
A A B B A A B D A A
Unit 2 : Networking
A) java.io
B) java.util
C) java.net
D) java.network
across a network?
A) TCP/IP
B) DNS
C) Socket
D) proxy server
3. Which class is used to create servers that listen for either local client or remote
client program?
A) ServerSockets
B) httpserver
C) httpResponse
D) none
D) none
5. Which method of URL class represent a URL and it has complete set of methods
A) java.net.URL
B) java.net.URLConnection
C) both A and B
D) none
A) java.net
B) java.rmi
C) java.lang
D) java.math
7. The URLConnection class can be used to read and write data to specified
A) true
B) false
A) true
B) false
A) Socket
B) IP address
C) Protocol
D) MAC address
10. The flush() method of printStream class flushes any uncleared buffers in
memory?
A) true
B) false
A) Socket
B) IP address
C) Protocol
D) MAC address
12) In Inetaddress class which method returns the host name of IP address?
D) none
A) All
B) IP address
C) Protocol
D) MAC address
15) Which classes are used for connection less socket programming?
A) Datagram Socket
B) Datagram packet
C) Both a and b
D) none
16) how many ports TCP/IP are reserved for specific protocol?
A) 10
B) 1024
C) 2048
D) 512
A) 8
B) 16
C) 32
D) 64
A) Datagram packet
B) URL
C) InetAddress
D) ContentHandler
A) findAddress()
B) getAddress()
C) Address()
D) Whois()
A) port()
B) getPort()
C) findPort()
D) receivedPort()
ANSWER KEY
Q.1 Q.2 Q.3 Q.4 Q.5 Q.6 Q.7 Q.8 Q.9 Q.10
C A A B A C A A B A
Q.11 Q.12 Q.13 Q.14 Q.15 Q.16 Q.17 Q.18 Q.19 Q.20
C A A A C B C C B A
A) True
B) False
about a session?
A) session identifier
B) creation time
A) True
B) False
4) Which class provides stream to read binary data such as image etc from the
request object?
A) ServltInputStream
B) ServletOutputStream
C) Both A & B
A) True
B) False
A) RMI Communication
B) HTTP Communication
C) Socket Communication
7) Which methods are used to bind the objects on HttpSession instance and get
the objects?
A) setAttribute
B) getAttribute
C) Both A & B
servlets?
A) Add-on ServletEngine
B) Embedded ServletEngine
C) Standalone ServletEngine
doTrace()?
A) Genereic Servlets
B) HttpServlets
10) Which cookie it is valid for single session only and it is removed each time
A) Persistent cookie
B) Non-persistent cookie
11) JavaServer Pages often serve the same purpose as programs implemented
A) True
B) False
12) Which action tags are used in JSP for developing web application with Java
Bean?
A) jsp:useBean
B) jsp:setProperty
C) jsp:getProperty
D) Both B & C
13) Which technology do we mix our business logic with the presentation logic?
A) Servlet
B) JSP
C) Both A & B
14) Which is the Microsoft solution for providing dynamic Web content?
A) ASP
B) JSP
C) Both A & B
15) A bean encapsulates many objects into one object, so we can access this
object from multiple places.
A) True
B) False
A) Declaration Tag
B) Scriptlet tag
C) Expression tag
17) Which JSP Action tags is used to include the content of another resource, it
A) jsp:include
B) jsp:forward
C) jsp:plugin
D) jsp:papam
18) In JSP how many ways are there to perform exception handling?
A) 3
B) 2
C) 4
D) 5
A) import
B) Content Type
C) Extends
D) Info
A) HTML tags
B) JSP tags
C) Both A & B
ANSWER KEY
Q.1 Q.2 Q.3 Q.4 Q.5 Q.6 Q.7 Q.8 Q.9 Q.10
A D B A A D C C B B
Q.11 Q.12 Q.13 Q.14 Q.15 Q.16 Q.17 Q.18 Q.19 Q.20
A D A A A B A B B C
Unit 4 : Multithreading
a. execute()
b. run()
c. launch()
d. main()
a. 10
b. 12
c. 5
d. 8
a. run()
b. execute()
c. start()
d. None
threadE.start();
a) 0
b) 1
c) 2
d) 3
a) Start ()
b) Run ()
c) Execute ()
d) Launch ()
a) 1
b) 2
c) 3
d) 4
Q9) Which method is used to make main thread to wait for all child threads
a) Join ()
b) Sleep ()
c) Wait ()
d) Stop ()
a) 0
b) 1
c) 5
d) 10
Q11) If a priority of a java thread is 3 then the default priority of its child thread
will be
a) 0
b) 1
c) 5
d) 3
a) isAlive()
b) run ()
c) alive ()
d) keepAlive()
a) 1, 10
b) 0,10
c) 0,255
d) 1,256
a) Run ()
b) Start ()
c) Execute ()
d) call ()
a) Background
b) Foreground
c) Both
d) none
Q17) Which method is used to create a daemon thread?
a) setDaemon(boolean value)
b) setThread(boolean value)
c) createDaemon(boolean value)
d) makeDeamon(boolean value);
d) All correct
Q19) Which method is used to wait for child threads to finish in Java?
a) Wait ()
b) Sleep ()
c) Join ()
d) isAlive()
a) Start()
b) Run()
c) Main()
d) Execute()
ANSWER KEY
Q.1 Q.2 Q.3 Q.4 Q.5 Q.6 Q.7 Q.8 Q.9 Q.10
C B A A C A B A&B A C
Q.11 Q.12 Q.13 Q.14 Q.15 Q.16 Q.17 Q.18 Q.19 Q.20
D A B,C,D A A A A A C B
a) Doubleton
b) Singleton
c) Stateful
d) Stateless
a) /
b) \
c) –
d) //
4. Which of the following is correct error when loading JAR file with duplicate
name?
a) java.io.NullPointerException
b) java.lang.ClassNotFound
c) java.lang.ClassFormatError
d) java.lang.DuplicateClassError
a) True
b) False
a) Introspection
b) Events
c) Persistence
d) Serialization
7. What is the attribute of java bean to specify scope of bean to have single
a) prototype
b) singleton
c) request
d) session
a) init
b) init-method
c) initialization
d) initialization-method
a) destroy
b) destroy-method
c) destruction
d) destruction-method
a) @Qualifier
b) @Type
c) @Constructor
d) @Name
c) RMI allows us to invoke a method of java object that executes parallely in same
machine
a) java.applet
b) java.rmi
c) java.lang.rmi
d) java.lang.reflect
a) checkIP()
b) addLocation()
c) AddServer()
a) RemoteException
b) InputOutputException
c) RemoteAccessException
d) RemoteInputOutputException
15. Which of these class is used for creating a client for a server-client operations?
a) serverClientjava
b) Client.java
c) AddClient.java
d) ServerClient.java
16. Which of these package is used for all the text related modifications?
a) java.text
b) java.awt
c) java.lang.text
d) java.text.modify
import java.lang.reflect.*;
class Additional_packages
try
Class c = Class.forName("java.awt.Dimension");
System.out.println(constructors[i]);
catch (Exception e)
System.out.print("Exception");
d) Runtime Error
import java.lang.reflect.*;
class Additional_packages
try
Class c = Class.forName("java.awt.Dimension");
System.out.println(fields[i]);
catch (Exception e)
System.out.print("Exception");
19. What is the length of the application box made in the following Java program?
import java.awt.*;
import java.applet.*;
Graphic g;
a) 20
b) Default value
c) Compilation Error
d) Runtime Error
import java.lang.reflect.*;
class Additional_packages
try
Class c = Class.forName("java.awt.Dimension");
System.out.println(methods[i]);
catch (Exception e)
System.out.print("Exception");
package
ANSWER KEY
Q.1 Q.2 Q.3 Q.4 Q.5 Q.6 Q.7 Q.8 Q.9 Q.10
A B A C B D B B B A
Q.11 Q.12 Q.13 Q.14 Q.15 Q.16 Q.17 Q.18 Q.19 Q.20
A B D A C A A C C B