Questions On AWT
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
13.
2) Applet runs inside the browser and works at client side?
A) True
B) False
View Answer / Hide Answer
14.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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
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
ANSWER: A) True
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
ANSWER: C) java.awt.Graphics
ANSWER: A) True
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
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
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
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
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
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
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: B) 4
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
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
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()
ANSWER: A) True
ANSWER: B) root
}
}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
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
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
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: B) False
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
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
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
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
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
A) JDBC 2.0
B) JDBC 1.0
C) JDBC 3.0
D) JDBC 4.0
View Answer / Hide Answer
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
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
ANSWER: C) Protocol
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
ANSWER: A) JVM
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
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
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
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: A) True
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
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
ANSWER: B) No
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: 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
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
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
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
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
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
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: A) True
ANSWER: A) True
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
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
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
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
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
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
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?
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
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
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
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
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) Robust
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: 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
ANSWER: B) POST
10) The web container maintains the life cycle of a servlet instance,give the lifecycle of a servlet?
A) Servlet class is loaded
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: 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
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
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
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
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
ANSWER: B) False
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
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
28) Web server is used for loading the init() method of servlet?
A) True
B) False
View Answer / Hide Answer
ANSWER: A) True
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
8) RMI uses which protocol on top of TCP/IP (an analogy is HTTP over TCP/IP)?
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 ()
ANSWER: A) True
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
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
ANSWER: C) 4
20) In RMI applications which program obtains a remote reference to one or more remote objects on a server and
ANSWER: B) Client
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: D) java.rmi
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
ANSWER: B) False
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