Вы находитесь на странице: 1из 83

Questions on AWT

This topic is part of SCJP 1.2 exam but not SCJP 1.4 exam.
1. Which of the following classes are derived from the Container class. Select the
four correct answers.
A. Component
B. Panel
C. java.applet.Applet
D. Dialog
E. Frame
F. MenuComponent
2. Which of the following classes are derived from the Component class. Select
the four correct answers.
A. Container
B. Window
C. List
D. MenuItem
E. Choice
3. Name the class used to represent a GUI application window, which is
optionally resizable and can have a title bar, an icon, and menus. Select the one
correct answer.
A. Window
B. Panel
C. Dialog

D. Frame
4. Which abstract class is the super class of all menu related classes.
5. Which of these classes can be added to a Frame component. Select the three
correct answers.
A. Menu
B. Button
C. PopupMenu
D. Window
E. List
6. Which class can be used to represent a checkbox with a textual label that can
appear in a menu. Select the one correct answer.
A. MenuBar
B. MenuItem
C. CheckboxMenuItem
D. Menu
E. CheckBox
7. Which of these classes can be added to any Container class, using the add
method defined in Container class. Select the two correct answers.
A. Button
B. CheckboxMenuItem
C. Menu
D. Canvas
Answers to questions on AWT

1. b, c, d, e
2. a, b, c, e
3. d
4. MenuComponent
5. b, c, e
6. c
7. a, d

8.Applets - Java test


9.
1) Which is a special type of program that is embedded in the webpage to generate the dynamic content?
A) Package
B) Applet
C) Browser
D) None of the above
View Answer / Hide Answer
10.

11. ANSWER: B) Applet


12.

13.
2) Applet runs inside the browser and works at client side?
A) True
B) False
View Answer / Hide Answer
14.

15. ANSWER: A) True


16.

17.
3) In the following statements which is a drawback for Applet?
A) It works at client side so less response time
B) Secured
C) It can be executed by browsers running under many platforms, including Linux, Windows, and Mac Os etc.

D) Plugin is required at client browser to execute applet


View Answer / Hide Answer
18.

19. ANSWER: D) Plugin is required at client browser to execute applet


20.

21.
4) The java.applet.Applet class 4 life cycle methods and java.awt.Component class provides how many life
cycle methods for an applet?
A) 2
B) 3
C) 1
D) 4
View Answer / Hide Answer
22.

23. ANSWER: C) 1
24.

25.
5) Which life cycle method of an applet java.awt.Component class provides?
A) public void paint(Graphics g)
B) public void destroy()
C) public void stop()
D) public void init()
View Answer / Hide Answer
26.

27. ANSWER: A) public void paint(Graphics g)


28.

29.
6) Which is invoked after the init() method or browser is maximized?
A) public void start()
B) public void paint(Graphics g)
C) Public void stop()
D) Public void init()
View Answer / Hide Answer
30.

31. ANSWER: A) public void start()


32.

33.
7) Which is the correct order for lifecycle of an applet?
A) Applet is intialized,started,painted,destroyed,stopped
B) Applet is painted,started,stopped,initilaized,destroyed
C) Applet is initialized,started,painted,stopped,destroyed
D) None of the above
View Answer / Hide Answer
34.

35. ANSWER: C) Applet is initialized,started,painted,stopped,destroyed


36.

37.
8) To run an Applet which of these used?
A) By html file
B) By AppletViewer tool(for testing purpose)
C) Both A & B
D) None of the above
View Answer / Hide Answer
38.

39. ANSWER: C) Both A & B


40.

41.
9) Java Plug-in software is not responsible to manage the lifecycle of an Applet?
A) True
B) False
View Answer / Hide Answer
42.

43. ANSWER: B) False


44.

45.
10) java.applet defines how many interfaces?
A) 2
B) 3
C) 4
D) 5
View Answer / Hide Answer
46.

47. ANSWER: B) 3
48.

49.
11) Which Called when an applet begins execution, It is the first method called for any applet?
A) void init()
B) void destroy()
C) boolean isActive()
D) None of the above
View Answer / Hide Answer
50.

51. ANSWER: A) void init()


52.

53.
12) When an applet begins, the AWT calls the following methods, in this sequence?
A) init(),paint(),start()
B) Start(),paint(),init()
C) intit(),start(),paint()
D) paint(),start(),init()
View Answer / Hide Answer
54.

55. ANSWER: C) intit(),start(),paint()


56.

57.
13) when an applet is terminated the following sequence of methods calls takes place?
A) stop(),paint(),destroy()
B) destroy(),stop(),paint()
C) destroy(),stop()
D) stop(),destroy()
View Answer / Hide Answer
58.

59. ANSWER: D) stop(),destroy()


60.

61.
14) This method is used to suspend threads that dont need to run when the applet is not visible?
A) destroy()
B) paint()
C) stop()
D) start()
View Answer / Hide Answer
62.

63. ANSWER: C) stop()


64.

65.
15) Which method is called only once during the run time of your applet?
A) stop()
B) paint()
C) init()
D) destroy()
View Answer / Hide Answer
66.

67. ANSWER: C) init()


68.

69.
16) The APPLET tag is used to start an applet from both an HTML document and from an applet viewer?
A) True
B) False
View Answer / Hide Answer
70.

71. ANSWER: A) True


72.

73.
17) Which is a required attribute that gives the name of the file containing your applets compiled .class file?
A) CODE
B) CODEBASE
C) ALT

D) NAME
View Answer / Hide Answer
74.

75. ANSWER: A) CODE


76.

77.
18) Applet works at client side so less response time?
A) True
B) False
View Answer / Hide Answer

19) Applet runs inside the browser and does not works at client side?
A) True
B) False
View Answer / Hide Answer
78.

79. ANSWER: B) False


80.

81.
20) In Applet which are common security restrictions?
A) Applets can't load libraries or define native methods
B) An applet can't read every system property
C) Applets can play sounds
D) Both A & B
View Answer / Hide Answer
82.

83. ANSWER: D) Both A & B


84.

85.
21) Which Invoked immediately after the start() method, and also any time the applet needs to repaint itself in
the browser?
A) stop()
B) init()
C) paint()
D) destroy()
View Answer / Hide Answer
86.

87. ANSWER: C) paint()


88.

89.
22) An applet can play an audio file represented by the AudioClip interface in the java.applet package. The
AudioClip interface has how many methods?
A) 2
B) 3
C) 1
D) 4
View Answer / Hide Answer

90.

91. ANSWER: B) 3
92.

93.
23) An applet can play an audio file represented by the AudioClip interface in the java,applet package Causes
the audio clip to replay continually in which method?
A) public void play()
B) public void loop()
C) public void stop()
D) None of the above
View Answer / Hide Answer
94.

95. ANSWER: B) public void loop()


96.

97.
24) The following example shows the creation of a
import java.applet.*;
import java.awt.*;
public class Main extends Applet{
public void paint(Graphics g){
g.drawString("Welcome in Java Applet.",40,20);
}
}
A) Banner using Applet
B) Basic Applet
C) Display clock
D) None of the above
View Answer / Hide Answer

98. ANSWER: B) Basic Applet


99.

100.
25) Applets cannot make network connection exception to the server host from which it originated?
A) True
B) False
View Answer / Hide Answer
101.

102.ANSWER: A) True

Basics of AWT and Swing - Java


test
1) Give the abbreviation of AWT?
A) Applet Windowing Toolkit
B) Abstract Windowing Toolkit
C) Absolute Windowing Toolkit
D) None of the above
View Answer / Hide Answer

ANSWER: B) Abstract Windowing Toolkit

2) Which is the container that contain title bar and can have MenuBars. It can have other
components like button, textfield etc.?
A) Panel
B) Frame
C) Window
D) Container
View Answer / Hide Answer

ANSWER: B) Frame

3) Which is a component in AWT that can contain another components like buttons, textfields,
labels etc.?
A) Window
B) Container
C) Panel
D) Frame
View Answer / Hide Answer

ANSWER: B) Container

4) AWT is used for GUI programming in java?


A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

5) The following specifies the advantages of


It is lightweight.
It supports pluggable look and feel.
It follows MVC (Model View Controller) architecture.
A) Swing
B) AWT
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) Swing

6) Swing is not a part of JFC (Java Foundation Classes) that is used to create GUI application?
A) True
B) False
View Answer / Hide Answer

ANSWER: B) False

7) Which class provides many methods for graphics programming?


A) java.awt
B) java.Graphics
C) java.awt.Graphics
D) None of the above
View Answer / Hide Answer

ANSWER: C) java.awt.Graphics

8) These two ways are used to create a Frame


By creating the object of Frame class (association)
By extending Frame class (inheritance)
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

9) The Following steps are required to perform


1) Implement the Listener interface and overrides its methods
2) Register the component with the Listener
A) Exception Handling
B) String Handling
C) Event Handling
D) None of the above

View Answer / Hide Answer

ANSWER: C) Event Handling

10) In which places can put the event handling code


A) Same class
B) Other class
C) Annonymous class
D) All mentioned above
View Answer / Hide Answer

11) Which package provides many event classes and Listener interfaces for event handling?
A) java.awt
B) java.awt.Graphics
C) java.awt.event
D) None of the above
View Answer / Hide Answer

ANSWER: C) java.awt.event

12) To use the ActionListener interface it must be implemented by a class there are several
ways to do that find in the following?
A) Creating a new class
B) using the class the graphical component
C) an anonymous inner class
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above

13) The ActionListener interface is not used for handling action events?
A) True
B) False
View Answer / Hide Answer

ANSWER: B) False

14) The ActionListener interface is used for handling action events,For example,it's used by a
A) JButton
B) JCheckbox
D) JMenuItem
C) All of these
View Answer / Hide Answer

ANSWER: C) All of these

15) Which is the container that doesn't contain title bar and MenuBars. It can have other
components like button, textfield etc?
A) Window
B) Frame
C) Panel
D) Container
View Answer / Hide Answer

ANSWER: C) Panel

16) How many types of controls does AWT supports these controls are subclasses of

component?
A) 7
B) 6
C) 5
D) 8
View Answer / Hide Answer

ANSWER: A) 7

17) Which are passive controls that do not support any interaction with the user?
A) Choice
B) List
C) Labels
D) Checkbox
View Answer / Hide Answer

ANSWER: C) Labels

18) By which method You can set or change the text in a Label?
A) setText()
B) getText()
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) setText()

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

A) List
B) Choice
C) Labels
D) Checkbox
View Answer / Hide Answer

ANSWER: B) Choice

20) Which object can be constructed to show any number of choices in the visible window?
A) Labels
B) Choice
C) List
D) Checkbox
View Answer / Hide Answer

ANSWER: C) List

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


A) Button,List,MenuItem
B) Button,Checkbox,Choice
C) Scrollbar,Component,Button
D) None of the above
View Answer / Hide Answer

ANSWER: A) Button,List,MenuItem

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

B) ButtonGroup
C) JButton
D) ImageIcon
View Answer / Hide Answer

ANSWER: B) ButtonGroup

23) Which is used to store data and partial results, as well as to perform dynamic linking, return
values for methods, and dispatch exceptions?
A) Window
B) Panel
C) Frame
D) Container
View Answer / Hide Answer

ANSWER: C) Frame

24) The following way is used to create a frame is by creating the object of Frame class?
A) inheritance
B) association
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: B) association

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

B) False
View Answer / Hide Answer

ANSWER: A) True

26) In Graphics class Which method is used to set the graphics current color to the specified
color?
A) public abstract void setFont(Font font)
B) public abstract void setColor(Color c)
C) public abstract void drawString(String str, int x, int y)
D) None of the above
View Answer / Hide Answer

ANSWER: B) public abstract void setColor(Color c)

27) 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)
A) Graphics class
B) Component class
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: B) Component class

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

height?
A) public void drawRect(int x, int y, int width, int height)
B) public abstract void fillRect(int x, int y, int width, int height)
C) public abstract void drawLine(int x1, int y1, int x2, int y2)
D) public abstract void drawOval(int x, int y, int width, int height)
View Answer / Hide Answer

ANSWER: A) public void drawRect(int x, int y, int width, int height)

29) Implement the Listener interface and overrides its methods is required to perform in event
handling?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

30) The Java Foundation Classes (JFC) is a set of GUI components which simplify the
development of desktop applications?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

Database connectivity with JDBC - online test

1) JDBC is a Java API that is used to connect and execute query to the database?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

2) Which of these API represents that software programs can follow to communicate with each other?
A) Interfaces
B) Classes
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: C) Both A & B

3) An API can be created for


A) applications
B) libraries
C) operating systems
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above

4) How many types of JDBC drivers available?


A) 3
B) 4
C) 2
D) 5
View Answer / Hide Answer

ANSWER: B) 4

5) In the following JDBC drivers which is known as partially java driver?


A) JDBC-ODBC bridge driver
B) Native-API driver
C) Network Protocol driver
D) Thin driver
View Answer / Hide Answer

ANSWER: B) Native-API driver

6) In the following JDBC drivers which are known as fully java driver?
A) Native-API driver
B) Network Protocol driver
C) Thin driver
D) Both B & C
View Answer / Hide Answer

ANSWER: D) Both B & C

7) Which driver uses ODBC driver to connect to the database?


A) JDBC-ODBC bridge driver
B) Native-API driver
C) Network Protocol driver
D) Thin driver
View Answer / Hide Answer

ANSWER: A) JDBC-ODBC bridge driver

8) Which driver converts JDBC calls directly into the vendor-specific database protocol?
A) Native-API driver
B) Network Protocol driver
C) Thin driver
D) Both B & C
View Answer / Hide Answer

ANSWER: C) Thin driver

9) Why java program cannot directly communicate with an ODBC driver?


A) ODBC written in C# language
B) ODBC written in C language
C) ODBC written in C++ language
D) None of the above
View Answer / Hide Answer

ANSWER: B) ODBC written in C language

10) How many steps are used to connect any java application with the database in java using JDBC?
A) 5
B) 4
C) 3
D) 6
View Answer / Hide Answer

ANSWER: A) 5

11) Which method of Class class is used to register the driver class, This method is used to dynamically load the
driver class?
A) forName()
B) getConnection()
C) createStatement()
D) executeQuery()
View Answer / Hide Answer

ANSWER: A) forName()

12) The default username for the oracle database is system?


A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

13) Give the ways to set Temporary Path of JDK in Windows?


A) Open command prompt
B) copy the path of jdk/bin directory
C) write in command prompt: set path=copied_path
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above

14) Abbrevate the term DSN?


A) Digital Source Name
D) Data Source Name
C) Data Socket Name
D) Data String Name
View Answer / Hide Answer

ANSWER: D) Data Source Name

15) The default username for the mysql database is?


A) System
B) root
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: B) root

16) The following example to connect Java Application with access?


import java.sql.*;
class Test{
public static void main(String ar[]){
try{
String url="jdbc:odbc:mydsn";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection c=DriverManager.getConnection(url);
Statement st=c.createStatement();
ResultSet rs=st.executeQuery("select * from login");
while(rs.next()){
System.out.println(rs.getString(1));

}
}catch(Exception ee){System.out.println(ee);}
}}
A) With DSN
B) With out DSN
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) With DSN

17) In DriverManager class which method is used to establish the connection with the specified url?
A) public static void registerDriver(Driver driver)
B) public static void deregisterDriver(Driver driver)
C) public static Connection getConnection(String url)
D) public static Connection getConnection(String url,String userName,String password)
View Answer / Hide Answer

ANSWER: C) public static Connection getConnection(String url)

18) In Connection interface which method Drops all changes made since the previous commit/rollback?
A) public void rollback()
B) public void commit()
C) public void close()
D) public Statement createStatement()
View Answer / Hide Answer

19) Which interface provides methods to execute queries with the database?
A) Connection interface
B) Statement interface
C) ResultSet interface
D) None of the above
View Answer / Hide Answer

ANSWER: B) Statement interface

20) Which maintains a cursor pointing to a particular row of data,Initially, cursor points to before the first row?

A) Connection interface
B) Statement interface
C) ResultSet interface
D) None of the above
View Answer / Hide Answer

ANSWER: C) ResultSet interface

21) ResultSet object can be moved forward only and it is updatable?


A) True
B) False
View Answer / Hide Answer

ANSWER: B) False

22) Which is used to execute parameterized query?


A) Statement interface
B) PreparedStatement interface
C) ResultSet interface
D) None of the above
View Answer / Hide Answer

ANSWER: B) PreparedStatement interface

23) The performance of the application will be faster if you use PreparedStatement interface because query is
compiled only once?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

24) This is an example of prepared statement interface that ?


PreparedStatement stmt=con.prepareStatement("select * from emp");
ResultSet rs=stmt.executeQuery();
while(rs.next()){

System.out.println(rs.getInt(1)+" "+rs.getString(2));
}
A) deletes the record
B) retrieve the record
C) updates the record
D) inserts the record
View Answer / Hide Answer

ANSWER: B) retrieve the record

25) ResultSetMetaData interface is useful because it provides methods to get metadata from the ResultSet object?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

26) By using Which interface You can store images in the database in java by the help of ?
A) PreparedStatement interface
B) ResultSetMetaData interface
C) DatabaseMetData interface
D) None of the above
View Answer / Hide Answer

ANSWER: A) PreparedStatement interface

27) Abbreviate the full form of CLOB?


A) Character Large Object
B) Character Loop Object
C) Collection Large Object
D) Collection Loop Object
View Answer / Hide Answer

ANSWER: A) Character Large Object

28) Which is used to call the stored procedures and functions, CallableStatement interface?
A) CallableStatement Interface
B) PreparedStatement Interface
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) CallableStatement Interface

29) The performance of the application will be faster if you use PreparedStatement interface because query is
compiled only once?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

30) The ACID properties does not describes the transaction management well ?
A) True
B) False
View Answer / Hide Answer

ANSWER: B) False

31) JDBC stands for?


A) Java database connectivity
B) Java database concept
C) Java database communications
D) None of the above
View Answer / Hide Answer

ANSWER: A) Java database connectivity

32) ARRAY,CLOB,BLOB and REF type columns can be updated in?

A) JDBC 2.0
B) JDBC 1.0
C) JDBC 3.0
D) JDBC 4.0
View Answer / Hide Answer

ANSWER: C) JDBC 3.0

33) In Transaction Management of JDBC which means once a transaction has been committed, it will remain so,
even in the event of errors, power loss etc.?
A) Atomicity
B) Isolation
C) Consistency
D) Durability
View Answer / Hide Answer

ANSWER: D) Durability

34) In Transaction Management in JDBC Transaction represents?


A) single unit of work
B) Multiple unit of work
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) single unit of work

35) which interfaces provide methods for batch processing in JDBC?


A) java.sql.Statement
B) java.sql.PreparedStatement
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: C) Both A & B

36) JDBC RowSet is the wrapper of ResultSet,It holds tabular data like ResultSet but it is easy and flexible to use?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

Basic concepts of networking - online test


1) Show some networking terminologies given below?
A) IP Address
B) Protocol
C) MAC Address
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above

2) TCP,FTP,Telnet,SMTP,POP etc. are examples of ?


A) Socket
B) IP Address
C) Protocol
D) MAC Address
View Answer / Hide Answer

ANSWER: C) Protocol

3) Which classes are used for connection-oriented socket programming?


A) Socket
B) ServerSocket
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: C) Both A & B

4) Which class can be used to create a server socket. This object is used to establish communication with the
clients?
A) ServerSocket
B) Socket
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) ServerSocket

5) Which methods are commonly used in ServerSocket class?


A) public OutputStream getOutputStream()
B) public Socket accept()
C) public synchronized void close()
D) None of the above
View Answer / Hide Answer

ANSWER: B) public Socket accept()

6) URL is an acronym for?


A) Uniform Resource Locator
B) Unified Resource Locator
C) Uniform Restore Locator
D) Unified Restore Locator
View Answer / Hide Answer

ANSWER: A) Uniform Resource Locator

7) The URLConnection class can be used to read and write data to the specified resource referred by the URL?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

8) The java.net.InetAddress class represents an?


A) Socket
B) IP Address
C) Protocol
D) MAC Address
View Answer / Hide Answer

ANSWER: B) IP Address

9) In InetAddress class which method it returns the host name of the IP Address?
A) public String getHostName()
B) public String getHostAddress()
C) public static InetAddress getLocalHost()
D) None of the above
View Answer / Hide Answer

ANSWER: A) public String getHostName()

10) Which classes are used for connection-less socket programming?


A) DatagramSocket
B) DatagramPacket
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: C) Both A & B

11) Which class is message that can be sent or received. If you send multiple packet, it may arrive in any
order,Moreover, packet delivery is not guaranteed?
A) DatagramPacket
B) DatagramSocket
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) DatagramPacket

12) Which constructor of DatagramSocket class is used that it creates a datagram socket and binds it with the given
Port Number?
A) DatagramSocket(int port)
B) DatagramSocket(int port, InetAddress address)
C) DatagramSocket()
D) None of the above
View Answer / Hide Answer

ANSWER: B) DatagramSocket(int port, InetAddress address)

13) Which steps occur when establishing a TCP connection between two computers using sockets?
A) The server instantiates a ServerSocket object, denoting which port number communication is to occur on
B) The server invokes the accept() method of the ServerSocket class. This method waits until a client connects to the
server on the given port
C) After the server is waiting, a client instantiates a Socket object, specifying the server name and port number to
connect to
D) All of the above
View Answer / Hide Answer

ANSWER: D) All of the above

14) The flush() method of PrintStream class flushes any uncleared buffers in memory?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

15) Which method of URL class represents a URL and has complete set of methods to manipulate URL in Java?
A) java.net.URL
B) java.net.URLConnection
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) java.net.URL

16) URL stands for Uniform Resource Locator and represents a resource on the World Wide Web, such as a Web
page or FTP directory?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

17) Which package provides core functionality?


A) java.net
B) java.rmi
C) java.lang
D) java.math
View Answer / Hide Answer

ANSWER: C) java.lang

18) These networking classes encapsulate the "socket" paradigm pioneered in the (BSD) Give the abbrevation of
BSD?
A) Berkeley Software Distribution
B) Berkeley Socket Distribution
C) Berkeley System Distribution
D) None of the above
View Answer / Hide Answer

ANSWER: A) Berkeley Software Distribution

19) Which class is used to create servers that listen for either local client or remote client programs?
A) ServerSockets
B) httpServer
C) httpResponse
D) None of the above
View Answer / Hide Answer

ANSWER: A) ServerSockets

20) The client in socket programming must know which informations?


A) IPaddress of Server
B) Port number
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: C) Both A & B

21) Datagram is basically an information but there is no guarantee of its content, arrival or arrival time.
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

22) The DatagramSocket and DatagramPacket classes are not used for connection-less socket programming.
A) True
B) False
View Answer / Hide Answer

ANSWER: B) False

Java I/O Package - online test


1) A stream is a sequence of data.In Java a stream is composed of?
A) Bytes
B) Bits
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) Bytes

2) Which stream does Java application uses to read data from a source, it may be a file, an array, peripheral device
or socket?
A) InputStream
B) OutputStream
C) Input/OutputStream
D) None of the above
View Answer / Hide Answer

ANSWER: A) InputStream

3) These commonly used methods of


1) public abstract int read()throws IOException
2) public int available()throws IOException
3) public void close()throws IOException
A) OutputStream class
B) InputStream class
C) Input/OutputStream class
D) None of the above
View Answer / Hide Answer

ANSWER: B) InputStream class

4) Which is used for writing data to a file in file handling?


A) FileInputStream
B) FileOutputStream
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: B) FileOutputStream

5) Which is used for reading streams of raw bytes such as image data. For reading streams of characters, consider
using FileReader?
A) FileInputStream
B) FileOutputStream
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) FileInputStream

6) Which is Commonly used Methods of ByteArrayOutputStream class?


A) ByteArrayOutputStream()
B) ByteArrayOutputStream(int size)
C) public synchronized void writeTo(OutputStream out) throws IOException
D) Both A & B
View Answer / Hide Answer

ANSWER: C) public synchronized void writeTo(OutputStream out) throws IOException

7) SequenceInputStream class is used to read data from?


A) Single Stream
B) Multiple streams
C) Multilevel Streams
D) None of the above
View Answer / Hide Answer

ANSWER: B) Multiple streams

8) Which is used an internal buffer, It adds more efficiency than to write data directly into a stream. So, it makes the
performance fast?
A) BufferedOutputStream
B) ByteArrayOutputStream
C) BufferedInputStream
D) ByteArrayInputStream
View Answer / Hide Answer

ANSWER: A) BufferedOutputStream

9) which classes does Sun Microsystem has suggested not to use the, if you have to read and write the textual
information?
A) BufferedInputStream and BufferedOutputStream
B) SequenceInputStream and SequenceOutputStream

C) FileInputStream and FileOutputStream


D) Both A & B
View Answer / Hide Answer

ANSWER: C) FileInputStream and FileOutputStream

10) The CharArrayWriter class is not used to write data to multiple files?
A) True
B) False
View Answer / Hide Answer

ANSWER: B) False

11) Which are the ways to read data from the keyboard?
A) InputStreamReader
B) Console
C) Scanner
D) DataInputStream
E) All Mentioned above
View Answer / Hide Answer

ANSWER: E) All Mentioned above

12) Which class can be used to read data line by line by readLine() method?
A) BufferedReader
B) InputStreamReader
C) DataInputStream
D) None of the above
View Answer / Hide Answer

ANSWER: A) BufferedReader

13) Which is used to converts the byte-oriented stream into character-oriented stream?
A) Console
B) Scanner

C) InputStreamReader
D) DataInputStream
View Answer / Hide Answer

ANSWER: C) InputStreamReader

14) These four methods are commonly used in?


public char[] readPassword(String fmt,Object... args)
public String readLine()
public String readLine(String fmt,Object... args)
public char[] readPassword(
A) Scanner Class
B) Console class
C) InputStreamReader class
D) DataInputStream
View Answer / Hide Answer

ANSWER: B) Console class

15) Which class breaks the input into tokens using a delimiter which is whitespace bydefault, It provides many
methods to read and parse various primitive values?
A) Console class
B) Scanner class
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: B) Scanner class

16) Which class automatically flushes the data so there is no need to call flush() method. Moreover, its methods don't
throw IOException?
A) Console class
B) Scanner Class
C) FileInputStream class
D) PrintStream class
View Answer / Hide Answer

ANSWER: D) PrintStream class

17) The PrintStream class provides methods to?


A) read data to another stream
B) Write data to another stream
C) read data to same stream
D) write data to same stream
View Answer / Hide Answer

ANSWER: B) Write data to another stream

18) Which class is used to uncompress the file in the deflate compression format, It provides facility to the other
uncompression filters?
A) DeflaterOutputStream class
B) InflaterInputStream class
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: B) InflaterInputStream class

19) The PipedInputStream and PipedOutputStream classes can be used to read and write data simultaneously?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

20) Which are subclasses of FilterInputStream and FilterOutputStream?


A) PipedInputStream
B) PipedOutputStream
C) DataInputStream
D) DataOutputStream
E) Both C & D
View Answer / Hide Answer

ANSWER: E) Both C & D

21) To achieve performance, the DataInputStream class comes with some special methods like?
A) WriteDouble()
B) WriteInt()
C) WriteBytes()
D) None of the above
View Answer / Hide Answer

ANSWER: D) None of the above

22) Which method of DataInputStream class reads a line from the file and returns it as a string ?
A) WriteInt()
B) readLine()
C) readInt()
D) writeDouble()
View Answer / Hide Answer

ANSWER: B) readLine()

23) The stream tokenizer class can recognize identifiers, numbers, quoted strings, and various comment styles?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

24) The java.io.StreamTokenizer.nextToken() method parses the next token from the?
A) input stream of this tokenizer
B) output stream of this tokenizer
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) input stream of this tokenizer

25) Breaking a string or stream into meaningful independent words is known as tokenization.
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

26) Which package includes StringTokenizer which tokenizes a string into independent words?
A) java.awt
B) java.applet
C) java.util
D) java.lang
View Answer / Hide Answer

ANSWER: C) java.util

27) In which field of StreamTokenizer if the token is a word, this filed contains the word that can be used in
programming?
A) String sval
B) double nval
C) int ttype
D) static final int TT_WORD
View Answer / Hide Answer

ANSWER: B) double nval

28) StreamTokenization has following programs they are?


A) Tokenizing text file contents
B) Printing file contents
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: C) Both A & B

29) Java application uses an output stream to read data from a source, it may be a file, an array, peripheral device or
socket?
A) True
B) False
View Answer / Hide Answer

ANSWER: B) False

30) Both InputStream and OutputStream class is an abstract class. It is the superclass of all classes representing an
output stream of bytes.
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

Java Threads - online test


1) The life cycle of the thread is controlled by ?
A) JVM
B) JDK
C) JRE
D) None of the above
View Answer / Hide Answer

ANSWER: A) JVM

2) In how many states Threads can be explained ?


A) 4
B) 5
C) 3
D) 2
View Answer / Hide Answer

ANSWER: B) 5

3) In which state the thread is still alive, but is currently not eligible to run?
A) Non-Runnable
B) Terminated
C) Runnable
D) Running
View Answer / Hide Answer

ANSWER: A) Non-Runnable

4) In Which state after invocation of start() method, but the thread Scheduler has not selected it to be the running
thread?
A) Running
B) Runnable
C) Terminated
D) Non-Runnable
View Answer / Hide Answer

ANSWER: B) Runnable

5) These two ways are used to?


By extending Thread class
By implementing Runnable interface.
A) Joining a thread
B) Naming a thread
C) Create a thread
D) sleeping a thread
View Answer / Hide Answer

ANSWER: C) Create a thread

6) Which method is used in thread class to starts the execution of the thread.JVM calls the run() method on the
thread?
A) public void start()
B) public void run()
C) public void stop()
D) public coid suspend()
View Answer / Hide Answer

ANSWER: A) public void start()

7) Which method is used in thread class to tests if the current thread has been interrupted?
A) public static boolean interrupted()
B) public boolean isInterrupted()
C) public void interrupt()
D) public boolean isAlive()
View Answer / Hide Answer

ANSWER: A) public static boolean interrupted()

8) Which method in thread class causes the currently executing thread object to temporarily pause and allow other
threads to execute?
A) public boolean isAlive()
B) public int getId()
C) public void yield()
D) public boolean isDaemon()
View Answer / Hide Answer

ANSWER: C) public void yield()

9) Thread class constructor allocates a new thread object?


A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

10) Many threads at a time can run in a single process?


A) True
B) False
View Answer / Hide Answer

ANSWER: B) False

11) Under Which scheduling the highest priority task executes until it enters the waiting or dead states or a higher
priority task comes into existence?
A) Under time slicing
B) Under Preemptive scheduling
C) Under Pretime slicing
D) None of the above
View Answer / Hide Answer

ANSWER: B) Under Preemptive scheduling

12) How many methods does a thread class provides for sleeping a thread?
A) 3
B) 1
C) 4
D) 2
View Answer / Hide Answer

ANSWER: D) 2

13) Can we start a thread twice?


A) Yes
B) No
View Answer / Hide Answer

ANSWER: B) No

14) What if we call run() method directly instead start() method?


A) Each thread starts in a separate call stack.
B) Invoking the run() method from main thread, the run() method goes onto the current call stack rather than at the
beginning of a new call stack
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: C) Both A & B

15) Which method waits for a thread to die?


A) stop()
B) start()
C) terminate()
D) join()
View Answer / Hide Answer

ANSWER: D) join()

16) Which method returns a reference to the currently executing thread object?
A) currentThread()
B) runningThread()
C) runnableThread()
D) None of the above
View Answer / Hide Answer

ANSWER: A) currentThread()

17) In Naming a thread which method is used to change the name of a thread?
A) public String getName()
B) public void setName(String name).
C) public void getName()
D) public String setName(String name)
View Answer / Hide Answer

ANSWER: B) public void setName(String name)

18) Default priority value of a thread class for NORM_PRIORITY is?


A) 1
B) 10
C) 5
D) 4
View Answer / Hide Answer

ANSWER: C) 5

19) This is an example for priority of a thread give the output for the following program ?
class Multi10 extends Thread{
public void run(){
System.out.println("running thread name is:"+Thread.currentThread().getName());
System.out.println("running thread priority is:"+Thread.currentThread().getPriority());
}
public static void main(String args[]){
Multi10 m1=new Multi10();
Multi10 m2=new Multi10();
m1.setPriority(Thread.MIN_PRIORITY);
m2.setPriority(Thread.MAX_PRIORITY);
m1.start();
m2.start();
}
}
A) running thread name is:Thread-0
running thread priority is:1
running thread name is:Thread-1
running thread priority is:5
B) running thread name is:Thread-0
running thread priority is:10
running thread name is:Thread-1
running thread priority is:1
C) running thread name is:Thread-0
running thread priority is:5
running thread name is:Thread-1
running thread priority is:1
D) None of the above
View Answer / Hide Answer

ANSWER: B)

20) Daemon thread provides services to user threads for background supporting tasks,It has no role in life than to
serve user threads?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

21) If you want to make a user thread as Daemon, it must not be started otherwise it will throw
IllegalThreadStateException?
A) True

B) False
View Answer / Hide Answer

ANSWER: A) True

22) In which Thread pool is used where container creates a thread pool to process the request?
A) Servlet
B) JSp
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: C) Both A & B

23) Which is the capability of control the access of multiple threads to any shared resource?
A) Serialization
B) Synchronization
C) Internationalization
D) None of the above
View Answer / Hide Answer

ANSWER: B) Synchronization

24) Mutual exclusive and inter-thread communication are two types of Synchorization for ?
A) Thread Synchronization
B) Process Synchronization
C) Object Synchronization
D) None of the above
View Answer / Hide Answer

ANSWER: A) Thread Synchronization

25) Which helps to keep threads from interfering with one another while sharing data. This can be done by three
ways in java:
1.by synchronized method

2.by synchronized block


3.by static synchronization
A) Inter-thread communication
B) Mutual Exclusive
C) Initial-thread communication
D) None of the above
View Answer / Hide Answer

ANSWER: B) Mutual Exclusive

26) The following two methods in Synchronization block is correct or not?


Synchronized block is not used to lock an object for any shared resource.
Scope of synchronized block is larger than the method.
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

27) If you make any static method as synchronized, the lock will be on the?
A) class not on object
B) object
C) class
D) object not on class
View Answer / Hide Answer

ANSWER: A) class not on object

28) Both threads are waiting for each other to release the lock, the condition is called deadlock?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

29) In which mechanism a thread is paused running in its critical section and another thread is allowed to enter (or
lock) in the same critical section to be executed?
A) Inter-thread communication
B) Initial-thread communication
C) Mutual Exclusive
D) None of the above
View Answer / Hide Answer

ANSWER: A) Inter-thread communication

30) In inter-thread communication in java the following method is used for public final void wait(long timeout)throws
InterruptedException?
A) waits until object is notified
B) waits for the specified amount of time
C) waits until object is released
D) None of the above
View Answer / Hide Answer

ANSWER: B) waits for the specified amount of time

31) Which method returns the interrupted flag afterthat it sets the flag to false if it is true?
A) isInterrupted()
B) static interrupted()
C) non static interrupted()
D) Both A & C
View Answer / Hide Answer

ANSWER: B) static interrupted()

32) In Reentrant Monitor It eliminates the possibility of single thread deadlocking?


A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

Java Database Connectivity - Advanced Java Test


1) The JDBC API is used to invoke SQL commands directly?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

2) Why do you need the JDBC API?


A) ODBC is not appropriate for direct use from the Java programming language because it
uses a C interface
B) A literal translation of the ODBC C API into a Java API would not be desirable
C) ODBC is hard to learn
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above

3) Abbreviate for the term UDA?


A) Unified Data Access
B) Universal Data Access
C) Universal Digital Access
D) Uniform Data Access
View Answer / Hide Answer

ANSWER: B) Universal Data Access

4) A JDBC technology-based driver ("JDBC driver") makes it possible to do?


A) Establish a connection with a data source
B) Send queries and update statements to the data source
C) Process the results
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above

5) Which was first most widely used programming interface for accessing relational databases,
It offers the ability to connect to almost all databases on almost all platforms.?
A) JDBC API
B) ODBC API
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: B) ODBC API

6) Microsoft has introduced UDA as an umbrella term that covers?


A) OLE DB
B) ADO
C) RDS
D) ODBC
E) All mentioned above
View Answer / Hide Answer

ANSWER: E) All mentioned above

7) Which models does JDBC API supports for database access?


A) Two-tier models
B) Three-tier models
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: C) Both A & B

8) In which model a Java applet or application talks directly to the data source?
A) Two-tier models
B) Three-tier models
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) Two-tier models

9) The JDBC API is what allows access to a data source from a Java middle tier?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

10) In which of the following JDBC a server technology are its support for?
A) Connection pooling
B) Distributed transactions
C) Disconnected rowsets
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above

11) How many JDBC product components does the Java software provides?
A) 3
B) 2
C) 4
D) 5
View Answer / Hide Answer

ANSWER: A) 3

12) In the following which JDBC product components does the Java software provides?
A) the JDBC driver manager
B) the JDBC driver test suite
C) the JDBC-ODBC bridge
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above

13) Which class has traditionally been the backbone of the JDBC architecture?
A) the JDBC driver manager
B) the JDBC driver test suite
C) the JDBC-ODBC bridge
D) All mentioned above
View Answer / Hide Answer

ANSWER: A) the JDBC driver manager

14) Which provides some confidence that JDBC drivers will run your program?
A) the JDBC-ODBC bridge
B) the JDBC driver manager
C) the JDBC driver test suite
D) None of the above
View Answer / Hide Answer

ANSWER: C) the JDBC driver test suite

15) JDBC technology-based drivers generally fit into how many categories?
A) 4
B) 3
C) 2
D) 5
View Answer / Hide Answer

ANSWER: A) 4

16) Which kind of driver converts JDBC calls into calls on the client API for Oracle, Sybase,
Informix, IBM DB2, or other DBMS?

A) JDBC-ODBC bridge plus ODBC driver


B) Native-API partly-Java driver
C) JDBC-Net pure Java driver
D) Native-protocol pure Java driver
View Answer / Hide Answer

ANSWER: B) Native-API partly-Java driver

17) In which driver Network connection is indirect that a JDBC client makes to a middleware
process that acts as a bridge to the DBMS server?
A) JDBC-Net
B) JDBC-ODBC bridge
C) Native API as basis
D) Native protocol as basis
View Answer / Hide Answer

ANSWER: A) JDBC-Net

18) A leading database connectivity vendor, worked together to produce the?


A) JDBC-ODBC Bridge
B) JDBC Driver Test Suite
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: C) Both A & B

19) Which list gives a quick way to determine which Connection method is appropriate for
creating different types of SQL statements?

A) createStatement
B) PrepareStatement
C) prepareCall
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above

20) Which method is used for an SQL statement that is executed frequently?
A) prepareStatement
B) prepareCall
C) createStatement
D) None of the above
View Answer / Hide Answer

ANSWER: A) prepareStatement

21) The ResultSet.next method is used to move to the next row of the ResultSet, making it the
current row?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

22) How many Result sets available with the JDBC 2.0 core API, The following constants,
defined in the ResultSet interface, are used to specify these?
A) 2

B) 3
C) 4
D) 5
View Answer / Hide Answer

ANSWER: B) 3

23) In which the 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 rows are typically
fixed when the result set is created?
A) TYPE_FORWARD_ONLY
B) TYPE_SCROLL_INSENSITIVE
C) TYPE_SCROLL_SENSITIVE
D) ALL MENTIONED ABOVE
View Answer / Hide Answer

ANSWER: B) TYPE_SCROLL_INSENSITIVE

24) In concurrency which Indicates a result set that cannot be updated programmatically?
A) CONCUR_UPDATABLE
B) CONCUR_READ_ONLY
C) BOTH A & B
D) None of the above
View Answer / Hide Answer

ANSWER: B) CONCUR_READ_ONLY

25) Which methods returns a stream that simply provides the raw bytes from the database
without any conversion?

A) getCharacterStream
B) getBinaryStream
C) getAsciiStream
D) getUnicodeStream
View Answer / Hide Answer

ANSWER: B) getBinaryStream

26) Which method is used for retrieving streams of both ASCII and Unicode characters is new
in the JDBC 2.0 core API?
A) getCharacterStream
B) getBinaryStream
C) getAsciiStream
D) getUnicodeStream
View Answer / Hide Answer

ANSWER: A) getCharacterStream

27) Drivers that are JDBC Compliant should normally support scrollable result sets, but they
are not required to do so?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

28) The intent is for JDBC drivers to implement nonscrollable result sets using the support
provided by the underlying database systems?
A) True

B) False
View Answer / Hide Answer

ANSWER: B) False

29) In order to transfer data between a database and an application written in the Java
programming language, the JDBC API provides which of these methods?
A) Methods on the ResultSet class for retrieving SQL SELECT results as Java types.
B) Methods on the PreparedStatement class for sending Java types as SQL statement
parameters.
C) Methods on the CallableStatement class for retrieving SQL OUT parameters as Java types.
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above

30) The JDBC types BINARY, VARBINARY, and LONGVARBINARY are closely related in that
VARBINARY represents a?
A) a small variable-length binary value
B) a small fixed-length binary value
C) a large variable-length binary value
D) Both A & B
View Answer / Hide Answer

ANSWER: A) a small variable-length binary value

31) In which the JDBC type represents a 64-bit signed integer value between
-9223372036854775808 and 9223372036854775807?
A) SMALLINT

B) BIGINT
C) TINYINT
D) INTEGER
View Answer / Hide Answer

ANSWER: B) BIGINT

32) In which the JDBC type represents a "single precision" floating point number that supports
seven digits of mantissa?
A) REAL
B) DOUBLE
C) FLOAT
D) INTEGER
View Answer / Hide Answer

ANSWER: A) REAL

33) In Which type may optionally have a custom mapping to a class in the Java programming
language,A custom mapping consists of a class that implements the interface SQLData and an
entry in a java.util.Map object?
A) ARRAY
B) CLOB
C) DISTINCT
D) BLOB
View Answer / Hide Answer

ANSWER: C) DISTINCT

34) The JDBC API has always supported persistent storage of objects defined in the Java
programming language through the methods getObject and setObject?

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

35) In Advanced JDBC Data types which have defined new data types that are commonly
referred to as SQL3 types?
A) ISO( International Organization for Standardization)
B) IEC( the International Electrotechnical Commission)
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: C) Both A & B

Servlets - Advanced Java Test


1) In which advantage of servlet, Servlets are managed by JVM so no need to worry about memory leak, garbage
collection etc.?
A) Better performance
B) Portability
C) Robust
D) Secure
View Answer / Hide Answer

ANSWER: C) Robust

2) In the following statements identify the disadvantages of CGI?


A) If number of clients increases, it takes more time for sending response

B) For each request, it starts a process and Web server is limited to start processes
C) It uses platform dependent language e.g. C, C++, perl
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above

3) Servlet technology is used to create web application?


A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

4) In HTTP Request Which Asks for the loopback of the request message, for testing or troubleshooting?
A) PUT
B) OPTIONS
C) DELETE
D) TRACE
View Answer / Hide Answer

ANSWER: D) TRACE

5) In HTTP Request method Get request is secured because data is exposed in URL bar?
A) True
B) False
View Answer / Hide Answer

ANSWER: B) False

6) In the HTTP Request method which is non-idempotent?


A) GET
B) POST
C) BOTH A & B

D) None of the above


View Answer / Hide Answer

ANSWER: B) POST

7) Give the examples of Application Server from the following?


A) Apache
B) Tomcat
C) JBoss
D) Weblogic
E) Both C & D
View Answer / Hide Answer

ANSWER: E) Both C & D

8) Abbreviate the term MIME?


A) Multilevel internet Mail Extension
B) Multipurpose internet Mail Extension
C) Multiuse information Mail Extension
D) None of the above
View Answer / Hide Answer

ANSWER: B) Multipurpose internet Mail Extension

9) Which packages represent interfaces and classes for servlet API?


A) javax.servlet
B) javax.servlet.http
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: C) Both A & B

10) The web container maintains the life cycle of a servlet instance,give the lifecycle of a servlet?
A) Servlet class is loaded

B) Servlet instance is created


C) init,Service,destroy method is invoked
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above

11) The sendRedirect() method of HttpServletResponse interface can be used to redirect response to another
resource, it may be servlet, jsp or html file?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

12) In RequestDispacher which method is used to sends the same request and response objects to another servlet?
A) forward()
B) sendRedirect()
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) forward()

13) An object of Which is created by the web container at time of deploying the project?
A) ServletConfig
B) ServletContext
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: B) ServletContext

14) An attribute in servlet is an object that can be set, get or removed from one of the following scopes?
A) session scope

B) request scope
C) application scope
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above

15) How many techniques are used in Session Tracking?


A) 4
B) 3
C) 2
D) 5
View Answer / Hide Answer

ANSWER: A) 4

16) Which cookie it is valid for single session only; it is removed each time when user closes the browser?
A) Persistent cookie
B) Non-persistent cookie
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: B) Non-persistent cookie

17) Which object of HttpSession can be used to view and manipulate information about a session, such as the?
A) session identifier
B) creation time
C) last accessed time
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above

18) Which methods are used to bind the objects on HttpSession instance and get the objects?

A) setAttribute
B) getAttribute
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: C) Both A & B

19) Which class provides stream to read binary data such as image etc. from the request object?
A) ServltInputStream
B) ServletOutputStream
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) ServltInputStream

20) These methods doGet(),doPost(),doHead,doDelete(),deTrace() are used in?


A) Genereic Servlets
B) HttpServlets
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: B) HttpServlets

21) Sessions is a part of the SessionTracking and it is for maintaining the client state at server side?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

22) In Session tracking which method is used in a bit of information that is sent by a web server to a browser and
which can later be read back from that browser?

A) HttpSession
B) URL rewriting
C) Cookies
D) Hidden form fields
View Answer / Hide Answer

ANSWER: C) Cookies

23) Using mail API we cannot send mail from a servlet?


A) True
B) False
View Answer / Hide Answer

ANSWER: B) False

24) Servlets handle multiple simultaneous requests by using threads?


A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

25) Which type of ServletEngine is a server that includes built-in support for servlets?
A) Add-on ServletEngine
B) Embedded ServletEngine
C) Standalone ServletEngine
D) None of the above
View Answer / Hide Answer

ANSWER: C) Standalone ServletEngine

26) Connection Pooling Class manages no of user requests for connections to improve the performance?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

27) Which of these ways used to communicate from an applet to servlet?


A) RMI Communication
B) HTTP Communication
C) Socket Communication
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above

28) Web server is used for loading the init() method of servlet?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

29) Which class can handle any type of request so it is protocol-independent?


A) GenericServlet
B) HttpServlet
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) GenericServlet

30) In Servlet Terminology what provides runtime environment for JavaEE (j2ee) applications. It performs many
operations that are given below:
1. Life Cycle Management
2. Multithreaded support
3. Object Pooling
4. Security etc.

A) Server
B) Webserver
C) Container
D) Application Server
View Answer / Hide Answer

ANSWER: C) Container

java Server Pages - Advanced Java Test


1) JavaServer Pages often serve the same purpose as programs implemented using the Common Gateway Interface
(CGI)?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

2) In JSP which can generate HTML dynamically on the client but can hardly interact with the web server to perform
complex tasks like database access and image processing etc.?
A) vs.Static HTML
B) vs.Server-Side Includes
C) vs.Pure Servlets
D) Vs.JavaScript
View Answer / Hide Answer

ANSWER: D) Vs.JavaScript

3) A JSP page consists of which tags?


A) HTML tags
B) JSP tags
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: C) Both A & B

4) These are the advantages of which technology, Extension to Servlet Easy to maintain; No need to recompile and
redeploy Fast Development Less code?
A) JSP
B) Servlet
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) JSP

5) In which technology, we mix our business logic with the presentation logic?
A) Servlet
B) JSP
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) Servlet

6) In the following which packages does a JSP API consists of?


A) javax.servlet.jsp
B) java.servlet
C) javax.servlet.jsp.tagext
D) Both A & C
View Answer / Hide Answer

ANSWER: D) Both A & C

7) The javax.servlet.jsp package has two interfaces find in the following?


A) JspPage
B) HttpJspPage
C) JspWriter
D) PageContext
E) Both A & B
View Answer / Hide Answer

ANSWER: E) Both A & B

8) Which tag is used to execute java source code in JSP?


A) Declaration Tag
B) Scriptlet tag
C) Expression tag
D) None of the above
View Answer / Hide Answer

ANSWER: B) Scriptlet tag

9) How many jsp implicit objects are there and these objects are created by the web container that are available to all
the jsp pages?
A) 8
B) 9
C) 10
D) 7
View Answer / Hide Answer

ANSWER: B) 9

10) In JSP page directive which attribute defines the MIME(Multipurpose Internet Mail Extension) type of the HTTP
response?
A) import
B) Content Type
C) Extends
D) Info
View Answer / Hide Answer

ANSWER: B) Content Type

11) The Jsp include directive is used to include the contents of any resource it may be?
A) jsp file
B) html file
C) text file
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above

12) In JSP how many ways are there to perform exception handling?
A) 3
B) 2
C) 4
D) 5
View Answer / Hide Answer

ANSWER: B) 2

13) In JSP Action tags which tags are used for bean development?
A) jsp:useBean
B) jsp:setPoperty
C) jsp:getProperty
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above

14) In JSP Action tags which is used to include the content of another resource it may be jsp, html or servlet?
A) jsp:include
B) jsp:forward
C) jsp:plugin
D) jsp:papam
View Answer / Hide Answer

ANSWER: A) jsp:include

15) A bean encapsulates many objects into one object, so we can access this object from multiple places?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

16) In JSP action tags Which are used for developing web application with Java Bean?
A) jsp:useBean
B) jsp:setProperty
C) jsp:getProperty
D) Both B & C
View Answer / Hide Answer

ANSWER: D) Both B & C

17) Model View Controller in JSP which represents the state of the application i.e. data. It can also have business
logic?
A) Model
B) View
C) Controller
D) None of the above
View Answer / Hide Answer

ANSWER: A) Model

18) Seperation of business logic from JSP this is the advantage of?
A) Custom Tags in JSP
B) JSP Standard Tag Library
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) Custom Tags in JSP

19) In which Architecture of a JSP Application JSP plays a key role and it is responsible for processing the request
made by client?
A) Model1 Architecture
B) Model2 Architecture
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) Model1 Architecture

20) Which Error Handling in Java handles runtime errors with exceptions, If an exception is not caught in your JSP or
Servlet,Resin will use a special error page to send results back to the browser,Resin uses a default error page unless
you explicitly provide an error page yourself?
A) Client Request Time Processing Errors
B) Compilation Time Processing Errors
C) JSP Translation Time Processing Errors
D) None of the above
View Answer / Hide Answer

ANSWER: A) Client Request Time Processing Errors

21) JSPs eventually are compiled into Java servlets, you can do as much with JSPs as you can do with Java
servlets?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

22) Which is the Microsoft solution for providing dynamic Web content?
A) ASP
B) JSP
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) ASP

23) In which attribute specifies a JSP page that should process any exceptions thrown but not caught in the current
page?
A) The ErrorPage Attribute
B) The IsErrorPage Attribute
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) The ErrorPage Attribute

24) In JSP which is an exception that is typically a user error or a problem that cannot be foreseen by the
programmer?
A) Checked exceptions
B) Runtime exceptions
C) Errors
D) None of the above
View Answer / Hide Answer

ANSWER: A) Checked exceptions

25) The authentication mechanism in the servlet specification uses a technique called?
A) Role Based Authentication
B) Form Based Authentication
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) Role Based Authentication

26) JSPs provide better facilities for separation of page code and template data by mean of Java beans, EJBs and
custom tag libraries?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

27) The ASP and JSP technologies are quite similar in the way they support the creation of Dynamic pages, using
HTML templates, scripting code and components for business logic?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

RMI - Advanced Java Test


1) RMI allows an object to invoke methods on an object running in another JVM?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

2) RMI uses which objects for the communication with the remote object?
A) Stub
B) Skeleton
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: C) Both A & B

3) Which is an object, acts as a gateway for the client side, all the outgoing requests are routed through it, and it
resides at the client side and represents the remote object?
A) Stub
B) Skeleton
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) Stub

4) When the skeleton receives the incoming request, it does the following tasks?
A) It reads the parameter for the remote method
B) It waits for the result
C) It writes and transmits (marshals) the result to the caller

D) It reads (unmarshals) the return value or exception


E) Both A & C
View Answer / Hide Answer

ANSWER: E) Both A & C

5) In RMI Architecture which layer Intercepts method calls made by the client/redirects these calls to a remote RMI
service?
A) Stub & Skeleton Layer
B) Application Layer
C) Remote Reference Layer
D) Transport Layer
View Answer / Hide Answer

ANSWER: A) Stub & Skeleton Layer

6) RMI has which of these protocols implementations?


A) Java Remote Method Protocol (JRMP)
B) Internet Inter-ORB Protocol (IIOP)
C) Jinni Extensible Remote Invocation (JERI)
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above

7) In RMI which layer defines and supports the invocation semantics of the RMI connection, this layer maintains the
session during the method call?
A) The Stub & Skeleton Layer
B) The Application Layer
C) The Remote Reference Layer
D) The Transport Layer
View Answer / Hide Answer

ANSWER: C) The Remote Reference Layer

8) RMI uses which protocol on top of TCP/IP (an analogy is HTTP over TCP/IP)?

A) Java Remote Method Protocol (JRMP)


B) Internet Inter-ORB Protocol (IIOP)
C) Jinni Extensible Remote Invocation (JERI)
D) All mentioned above
View Answer / Hide Answer

ANSWER: A) Java Remote Method Protocol (JRMP)

9) Which method of the Naming class (found in java.rmi) is used to update the RMI registry on the server machine?
A) rebind ()
B) lookup()
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) rebind ()

10) 1099 is the default port used by RMI Registry?


A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

11) In Naming class which method specifies name to a remote object?


A) bind(string name)
B) rebind(string name)
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) bind(string name)

12) Abbreviate the term DGC?

A) Digital Garbage Collection


B) Distributed Garbage Collection
C) Distributed Garbage Connection
D) None of the above
View Answer / Hide Answer

ANSWER: B) Distributed Garbage Collection

13) In RMI the objects are passed by Value or Reference?


A) Objects are passed by value
B) Objects are passed by Reference
B) Objects are passed by value and reference
D) None of the above
View Answer / Hide Answer

ANSWER: A) Objects are passed by value

14) The UnicastRemoteObject class provides support for point-to-point active object references using TCP streams?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

15) In a RMI Client Program, what are the exceptions which might have to handled?
A) RemoteException
B) NotBoundException
C) MalFormedURLException
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above

16) Which is a one-way communication only between the client and the server and it is not a reliable and there is no
confirmation regarding reaching the message to the destination?

A) TCP/IP
B) UDP
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: B) UDP

17) RMI Architecture consists of how many layers?


A) 5
B) 3
C) 4
D) 2
View Answer / Hide Answer

ANSWER: C) 4

18) An RMI Server is responsible for,


A) Creating an instance of the remote object
B) Exporting the remote object
C) Binding the instance of the remote object to the RMI registry
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above

19) In RMI Distributed object applications need to do?


A) Locate remote objects
B) Communicate with remote objects
C) Load class definitions for objects that are passed around
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above

20) In RMI applications which program obtains a remote reference to one or more remote objects on a server and

then invokes methods on them?


A) Server
B) Client
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: B) Client

21) In RMI program the following example shows the,


import java.rmi.*;
public interface Adder extends Remote{
public int add(int x,int y)throws RemoteException;
}
A) Create and start the remote application
B) Create and start the client application
C) Create the remote interface
D) Provide the implementation of the remote interface
View Answer / Hide Answer

ANSWER: C) Create the remote interface

22) In RMI program the following two steps are used to,
Either extend the UnicastRemoteObject class,
the exportObject() method of the UnicastRemoteObject class,
A) Provide the Implementation of the remote interface
B) Create the remote interface
C) Create and start the remote application
D) Compile the implementation class and create the stub and skeleton objects using the rmic tool
View Answer / Hide Answer

ANSWER: A) Provide the Implementation of the remote interface

23) Which package is used for Remote Method Invocation (RMI)?


A) java.lang.rmi
B) java.lang.reflect
C) java.applet
D) java.rmi
View Answer / Hide Answer

ANSWER: D) java.rmi

24) Java supports RMI, RMI Stands for?


A) Random Method Invocation
B) Remote Memory Interface
C) Remote Method Invocation
D) Random Method Invocation
View Answer / Hide Answer

ANSWER: C) Remote Method Invocation

25) RMI uses a layered architecture; each of the layers could be enhanced or replaced without affecting the rest of
the system?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

26) RMI is a server-side component; It is not required to be deployed on the server?


A) True
B) False
View Answer / Hide Answer

ANSWER: B) False

27) Which is built on the top of socket programming?


A) EJB
B) RMI
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: B) RMI

28) RMI and EJB, provides services to access an object running in another JVM (known as remote object)?
A) True
B) False
View Answer / Hide Answer

ANSWER: A) True

Ejb remaining
http://www.careerride.com/view.aspx?id=15890

Вам также может понравиться