Ajp Imp
Ajp Imp
--------------------------------------------------------------------------------------------------
CHAPTER-1 (Abstract Windowing Toolkit (AWT)) (CO1 And CO2)
a) display()
b) print()
c) drawString()
d) transient()
2. Which of these operators can be used to get run time information about an object?
a) getInfo
b) Info
PRACTICALKIDA.COM
c) instanceof
d) getinfoof
3. Which of these package is used for handling security related issues in a program?
a) java.security
b) java.lang.security
c) java.awt.image
d) java.io.security
4. The order of the three top level elements of the java source file are___.
a. Abstraction
b. Polymorphism
c. Encapsulation
d. Global variables
a. Platform-dependent
b. Interpreter-dependent
c. Platform-independent
d. Interpreter-independent
8. Java language has support for which of the following types of comment?
PRACTICALKIDA.COM
d. single, multiple and quote
a. javac
b. java
c. run
d. execute
10. ______ is a mechanism for naming and visibility control of a class and its content.
a. Object
b. Packages
c. Interfaces
d. None of the Mentioned
a. creates executable
b. translates java source code to byte code
c. creates classes
d. produces java Interpreter
12. Where are the following four methods commonly used?
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
13. Which is the container that doesn't contain title bar and MenuBars but it can have other
components like button, textfield etc?
a. Window
b. Frame
c. Panel
d. Container
14. Which is used to store data and partial results, as well as to perform dynamic linking, return
values for methods, and dispatch exceptions?
PRACTICALKIDA.COM
a. Window
b. Panel
c. Frame
d. Container
15. AWT has more powerful components like tables, lists, scroll panes, color chooser, tabbed
pane etc.
a. True
b. False
16. Which are passive controls that do not support any interaction with the user?
a. Choice
b. List
c. Labels
d. Checkbox
a) BorderLayout
b)FlowLayout
c)GridLayout
d)GridBagLayout
18. The SecurityManager object is responsible for implementing the security policies for applets.
a)True
b)False
19. Applets loaded from the same computer where they are executing have the same restrictions
as applets loaded from the network.
a)True
b)False
20. One of the popular uses of applets involves making connections to the host they came from.
a)True
b)False
a)True
b)False
22. Which of the following methods can be used to remove a java.awt.Component object from
the display?
a)hide()
PRACTICALKIDA.COM
b)delete()
c)disappear()
d)move()
23. The setBackground() method is part of the following class in java.awt package:
a)Graphics
b)Container
c)Component
d)Applet
a)True
b)False
a)1
b)2
c)3
d)4
PRACTICALKIDA.COM
d) Public void init()
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
a) By html file
b) By AppletViewer tool(for testing purpose)
c) Both A & B
d) None of the above
31. Java Plug-in software is not responsible to manage the lifecycle of an Applet?
a) True
b) False
32. 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
33. 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()
34. 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()
35. This method is used to suspend threads that don’t need to run when the applet is not visible?
a) destroy()
b) paint()
PRACTICALKIDA.COM
c) stop()
d) start()
36. Which method is called only once during the run time of your applet?
a) stop()
b) paint()
c) init()
d) destroy()
37) The APPLET tag is used to start an applet from both an HTML document and from an applet
viewer?
A) True
B) False
38) Which is a required attribute that gives the name of the file containing your applet’s
compiled .class file?
a) CODE
b) CODEBASE
c) ALT
d) NAME
39) Applet works at client side so less response time?
a) True
b) False
40) Applet runs inside the browser and does not works at client side?
a) True
b) False
42) Which Invoked immediately after the start() method, and also any time the applet needs to
repaint itself in the browser?
PRACTICALKIDA.COM
a) stop()
b) init()
c) paint()
d) destroy()
43) 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
44) 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?
45. Applets cannot make network connection exception to the server host from which it
originated?
a) True
b) False
46. 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
Ans : b
47. The Java Foundation Classes (JFC) is a set of GUI components which simplify the
development of desktop applications?
a) True
b) False
a) Single inheritance
b) Hybrid inheritance
c) Multilevel inheritance
PRACTICALKIDA.COM
d) Java supports all of the above
49. Which is a mechanism in which one object acquires all the properties and behaviors of parent
object?
a) Inheritance
b) Encapsulation
c) Polymorphism
d) None of the above
A) Single inheritance
B) Hybrid inheritance
C) Multilevel inheritance
D) Java supports all of the above
51. Which is a mechanism in which one object acquires all the properties and behaviors of parent
object?
a) Inheritance
b) Encapsulation
c) Polymorphism
d) None of the above
52. The following Syntax is used for?
a) Polymorphism
b) Encapsulation
c) Inheritance
d) None of the above
53. If subclass (child class) has the same method as declared in the parent class, it is known as?
a) Method overriding
b) Method overloading
c) Constructor overloading
d) None of the above
54. In Method overriding a subclass in a different package can only override the non-final
methods declared public or protected?
PRACTICALKIDA.COM
a) True
b) False
55. Which allows you define one interface and have multiple implementations?
a) Encapsulation
b) Inheritance
c) Polymorphism
d) None of the above
56. Which type of polymorphism is nothing but the method overloading in java?
a) Method overloading
b) Method overriding
c) Constructor overloading
d) None of the above
58) The following two rules are defined by?
1. The parameters may differ in their type or number, or in both.
2. They may have the same or different return types.
a) Method overloading
b) Method overriding
c) Constructor overloading
d) None of the above
a) Final Method
b) Final class
c) Final Variable
d) Both A & C
a) True
b) False
PRACTICALKIDA.COM
61. A class which cannot be instantiated is known as?
a) Abstract Class
b) Abstract Method
c) Both A & B
d) None of the above
62. An abstract class has no use until unless it is extended by some other class?
a) True
b) False
63. Multiple inheritances is not supported in case of class but it is supported in case of interface?
a) True
b) False
a) True
b) False
66. An interface is a blueprint of a class. It has static constants and abstract methods?
a) True
b) False
a) Throwable
b) Exception
c) RuntimeException
d) IOException
PRACTICALKIDA.COM
d) voidsetLayout(LayoutManager Im)
a) CheckboxGroup
b) Checkbox
c) Choice
d) List
a) setState()
b) getState()
c) setLabel()
d) getLabel()
a)BorderLayout
b)FlowLayout
c)GridLayout
d)CardLayout
a)True
b)False
a)True
b)False
75. Window class is base class for two window classes 1)_____2)____.
PRACTICALKIDA.COM
76. We cannot place any component object into Window
a)True
b)False
a)new TextArea(80,10)
b)new TextArea(10,80)
c)New TextArea(10,80)
d)new Textarea(80,10)
a)True
b)False
a)Component
b)Container
c)Object
d)None of the above
a)Component
b)object
c) Container
d) None of the above
a)Repaint
b)Graphic
c)Paint
d)Canvas
PRACTICALKIDA.COM
83. Which of the following creates a List with 5 visible items and multiple selection enabled?
a)new List(5,true)
b) new List(true,5)
c) new List(5,false)
d) new List(false,5)
a)show()
b)display()
c)displayFrame()
d)setVisible()
a)True
b)False
a)True
b)False
87. Which is the Default Layout Manager for Window and window subclasses(Frame,Dialog)?
a) CardLayout
b)FlowLayout
c)BorderLayout
d)GridLayout
89. Which method is the method to set the Layout of the Container?
a)startLayout()
b)intLayout()
c)layoutContainer()
d)setLayout()
90. Which Layout is for organizing the componets in the tabular form?
a) CardLayout
b)FlowLayout
c)BorderLayout
d)GridLayout
a)CheckboxMenuItem
PRACTICALKIDA.COM
b)MenuItem
c)MenuItemCheckbox
d)None of the above
a)True
b)False
93. Window is the Container that have no borders and manu bars.
a)True
b)False
94. Java Plug-in software is responsible to manage the life cycle of an applet ?
a)True
b)False
95. The classes which directly inherit Throwable class except RuntimeException and Error are
known as checked exceptions .
a)True
b)False
96. The classes which inherit RuntimeException are known as unchecked exceptions.
a)True
b)False
a)catch
b) throws
c) throw
d)finally
98. _______is used to place important code, it will be executed whether exception is handled or
not.
a) Finalize
b) Final
c) Finally
d)None of the above
PRACTICALKIDA.COM
a)True
b)False
a)True
b)False
a)True
b)False
101. The Java Runtime Environment is a set of software tools which are used for developing
Java applications.
a)True
b)False
102. The Java Development Kit (JDK) is a software development environment which is used to
develop Java applications and applets.
a)True
b)False
103.JDK contains JRE + development tools.
a)True
b)False
a)True
b)False
105. Memory allocation for static variable happens only once when the class is loaded in the
memory.
a)True
b)False
a)True
b)False
PRACTICALKIDA.COM
107. A constructor must have a return type.
a)True
b)False
a)True
b)False
109. “ this” keyword is a ______ variable that refers to the current object.
a)Private
b)Local
c) reference
d)Static
a)True
b)False
111. The _____ class is the parent class of all the classes in java by default.
a) Object
b) Container
c)Component
d)None of the above
112. _____package provides for system input and output through data streams, serialization and
the file system.
a) java.swing
b) java.awt
c) java.lang
d)java.io
113. Java.lang package in Java Provides classes that are fundamental to the design of the Java
programming language.
a) True
b) False
a) Vector
PRACTICALKIDA.COM
b) Array
c)Both a) and b)
d)None of the above
a) True
b) False
117. The TextField used for taking passwords, should be defined by calling_____.
a)setEchoChar()
b) EchoCharset()
c)setPassword()
d) passwordSet()
118.TextArea is a multiline TextField.
a)True
b)False
a)True
b)False
Q.1 Pluggable look and feel and lightweight components are the features supported by ____.
a) Swing b) AWT
c) Core Java d) None of these
Q.2 Swing is based on ________ architecture.
a) Client server b) model view controller
c) Layered d) None of these
Q.3 Swing is not a part of JFC (Java Foundation Classes) that is used to create GUI application.
PRACTICALKIDA.COM
a) True b) False
Q.4 The Java Foundation Classes (JFC) is a set of GUI components which simplify the
development
of desktop applications
a) True b) False
Q.5 Following letter used as a prefix to swing component.
a) A b) S
c) G d) J
Q.6 _______ is one of the features of object oriented programming that allows creation of
hierarchical classifications.
a) Polymorphism b) Class
c) Inheritance d) Object
Q.7 In swing JButton class is derived from ______.
a) Abstract Button b) JToggleButton
c) JComponent d) None of these
PRACTICALKIDA.COM
a) b)
public class AppletDemo extends public class AppletDemo extends
JApplet JApplet
{ {
public void paint(Graphics g) public void paint(Graphics g)
{ {
g.string(“WELCOME TO SWING g.drawString(“WELCOME TO
PROGRAM ”,20,40); SWING PROGRAM ”,20,40);
} }
} }
c) d)
public class AppletDemo public class AppletDemo extends
{ JApplet
public void paint(Graphics g) {
{ public void paint(Graphics g)
g.drawString(“WELCOME TO {
SWING PROGRAM ”,20,40); g.display(“WELCOME TO
} SWING PROGRAM ”,20,40);
} }
}
PRACTICALKIDA.COM
a) b)
PRACTICALKIDA.COM
c) d)
Q.20 Which method of the component class is used to set the position and size of a component.
a) setPosition b) setBounds
c) setSize d) None of these
Q.21 Select the correct option
I. Canvas is a component
PRACTICALKIDA.COM
II. ScrollPane is a container
a) I is true and II is false
c) I and II both are false
b) I is false and II is true
d) I and II both are true
Q.22 The difference between Scrollbar and Scrollpane is
a) Scrollbar is component and Scrollpane is container
b) Scrollbar is container and Scrollpane is component
c) Scrollbar and Scrollpane both are components and not containers
d) Scrollbar and Scrollpane both are containers and not components
PRACTICALKIDA.COM
}
}
a) Error in statement in which JTable is created.
b) Error in statement in which JScrollPane is created
c) Error in statement in which applet tag is declared
d) None of these
Q.27 JPanel and Applet use _______ as their Default Layout.
a) FlowLayout b) GridLayout
c) BorderLayout d) GridBagLayout
Q.28 Which components are used to generate following output?
PRACTICALKIDA.COM
c) JMenuBar d) None of these
Q.35 We can use ______ pane to add component to container
a) contentpane b) rootpane
c) glasspane d) all
Q.36 In swing, the content pane can be obtained via method ______.
a) getContentPane b) addContentPane
c) both a&b d) None of these
Q.37 In a swing ____ is a component that display rows and columns of data.
a) table b) card
c) both a&b d) None of these
Q.38 In a swing, tables are implemented by the ______ class.
a) JPanel b) JTable
c) JTree d) None of these
Q.39 To use the swing components _____ package is imported.
a) java.awt b) java.swing
c) javax.swing d) None of these
Q.40 _____ is base class for all swing components.
a) Object b) JComponent
c) Container d) None of these
Q.41 The ______ is a fundamental swing class.
a) JApplet b)JFrame
c) JPanel d) None of these
Q.42 The JTextField is extended from _____ class.
a) JApplet b) JComponent
c) JFrame d) All of these
Q.43 JTextField has ____number of constructors.
a) 5 b) 4
c) 3 d) 2
Q.44 JCheckBox is implementation of _____ class.
a) JButton b) AbstractButton
c) JCheckBox d) None of these
Q.45 JCheckBox has _____ number of constructors.
a) 5 b) 2
c) 4 d) 3
Q.46 ______ is a component which contains group of folders.
a) TabbedPane b) JTabbedPane
c) both a&b d) None of these
Q.47 JTabbedPane class is extended by ______ class.
a) JComponent b) JApplet
c) JFrame d) None of these
Q.48 Which constructor is JComboBox class?
a) JComboBox() b) JcomboBox()
c) Both a&b d) JCombobox()
Q.49 Which method is used for add items in JComboBox?
a) add() b) addItem()
c) Both a&b d) None of these
PRACTICALKIDA.COM
Q.50 Which component is used for creating a GUI for downloading or transferring of file.
a) JLable b) JButton
c) JProgressBar d) JProgressbar
Q.51 Which panes are support to JApplet ?
a) Root Panes b) Glass Panes
c) Content Panes d) All of these
Q.52 All Swing components names start with J.
a) True b) False
Q.53 JProgressBar has _______ numbers of methods.
a) 3 b) 2
c) 4 d) 1
Q.54 You can create a tool tip for _________with setToolTipText() method.
a) JProgressBar b) JApplet
c) any JComponent d) None of these
Q.55 Which class is provide a general purpose component for implementing divider lines?
a) JProgressBar b) JComponent
c) JTable d) JSeparator
Q.56 Swing components are platform dependent.
a) False b) True
Q.57 Features of Java Foundation Classes (JFC) is:
a) Swing GUI components b) Look and Feel support
c) Java 2D d) All of these
Q.58 How many methods for ImageIcon?
a) 5 b) 1
c) 3 d) 2
Q.59 JTree has a 'root node' at the top most which is a parent for all nodes in the tree.
a) True b) False
Q.60 How many constructor for JTable?
a) 2 b) 1
c) 4 d) 5
PRACTICALKIDA.COM
Q2. Method use to change the location of event?
a) getPoint()
b) translatePoint()
c) getClickCount()
d) isPopupTrigger()
Q9. Which of these package contains all the event handling interfaces?
a) Java.lang
b) Java.awt
PRACTICALKIDA.COM
c) Java.awt.event
d) Java.event
Q13. Which of these constant value will change when the button at the end of scrollbar was
clicked to increase its value?
a) BLOCK_DECREMENT
b) BLOCK_INCREMENT
c) UNIT_DECREMENT
d) UNIT_INCREMENT
Q14. Which constant of window Event class makes a request for closing window?
a) WINDOW_CLOSED
b) WINDOW_CLOSING
c) WINDOW_ACTIVATED
d) WINDOW_DEACTIVATED
PRACTICALKIDA.COM
c) ActionListener
d) ComponentListener
Q19. Which of these events is generated when the size of component is changed?
a) ComponentEvent
b) ContainerEvent
c) FocusEvent
d) InputEvent
Q20. Which of these events is generated when the component is added or removed?
a) ComponentEvent
b) ContainerEvent
c) FocusEvent
d) InputEvent
Q21. Which of these are integer constants of ComponentEvent class?
a) COMPONENT_HIDDEN
b) COMPONENT_MOVED
c) COMPONENT_RESIZE
d) All of These
Q22. Which of these events is generated when computer gains or losses input focus?
a) ComponentEvent
b) ContainerEvent
c) FocusEvent
d) InputEvent
PRACTICALKIDA.COM
c) KeyEvent
d) MouseEvent
Q25. Which is the class responsible for handling key press activity?
a) KeyEvent
b) WindowEvent
c) ActionEvent
d) mouseEvent
Q29. ____ is the abstract super class of all component input event class
a) KeyEvent
b) ItemEvent
c) ActionEvent
d) InputEvent
PRACTICALKIDA.COM
Q32. Event class is defined in which of these libraries
a) java.io
b) java.lang
c) java.net
d) java.util
Q33. Which of these method are used to register a keyboard event listener?
a) KeyListener()
b) ADDKeyListener()
c) addKeyListener()
d) eventKeyboardListener()
Q34. Which of these method can be used to obtain the command name for invoking actionEvent
object?
a) getCommand()
b) getActionCommand()
c) getActionEvent()
d) getActionEventCommand()
Q37. Which of these method can be used to determine the type of event?
a) getID()
b) getSource()
c) getEvent()
d) getEventObject()
PRACTICALKIDA.COM
d) ItemEvent
Q39. Which of these method can be used to know the degree of adjustment made by the user?
a) getValue()
b) getAdjustmentType()
c) getAdjustmentValue()
d) getAdjustmentAmount()
Q40. Which of these methods can be used to determine the type of adjustment event?
a) getType()
b) getEventType()
c) getAdjustmentType()
d) getObjectEventType()
Q41. Which of these methods can be used to obtain the reference to the container that generated
a containerEvent?
a) getContainer()
b) getContainerCommand()
c) getActionEvent()
d) getContainerEvent()
Q42. Which of these constant value will change when the button at the end of scrollbar was
clicked to increase its value?
a) BLOCK_DECREMENT
b) BLOCK_INCREMENT
c) UNIT_DECREMENT
d) UNIT_INCREMENT
Q43. Which of these methods can be used to know which key is pressed?
a) getKey()
b) getModifier()
c) getActionKey()
d) getActionEvent()
Q44. Which of these methods can be used to obtain the coordinates of a mouse?
a) getPoint()
b) getCoordinates()
c) GetMouseXY()
d) getMouseCoordinates()
PRACTICALKIDA.COM
c) ItemEvent
d) InputEvent
Q46. Which of these events is generated when computer gains or loses input focus?
a) ComponentEvent
b) ContainerEvent
c) FocusEvent
d) InputEvent
Q47. Which of these methods will respond when you click any button by mouse?
a) mouseClicked()
b) mouseReleased()
c) mousePressed()
d) All of these
PRACTICALKIDA.COM
d) ItemEvent
Q57. When the component is added or removed, which of these events is generated.
a) ComponentEvent
b) containerEvent
c) FocusEvent
d) InputEvent
Q58. ____method can be used to obtain the reference to the container that generated a container.
a) getContainer()
b) getcontainerCommand()
c) getActionEvent()
d) getContainerEvent()
Q58. which of the following method can be used to get reference to a component that was
affected by the container?
a) getcomponent()
b) getChild()
PRACTICALKIDA.COM
c) getcontainercomponent()
d) getcomponentChild()
PRACTICALKIDA.COM
Q66. ___method is used to get X coordinates of the mouse.
a) getX()
b) getXCoordinate()
c) getCoordinateX()
d) getPointX()
Q70. Which methods will respond when you click any button by mouse?
a) mouseClicked()
b) mouseEntered()
c) mousePressed()
d) All of these
Q71. Which of these packages contains all the classes and methods required for even handling in
Java?
a) java.applet
b) java.awt
c) java.event
d) java.awt.event
Q72. Which of these methods can be used to determine the type of event?
a) getID()
b) getSource()
c) getEvent()
PRACTICALKIDA.COM
d) getEventObject()
Ans:A
Q73. Which of these events will be notified if scroll bar is manipulated?
a) ActionEvent
b) ComponentEvent
c) AdjustmentEvent
d) WindowEvent
Q76. Which of these methods can be used to obtain the command name for invoking
ActionEvent object?
a) getCommand()
b) getActionCommand()
c) getActionEvent()
d) getActionEventCommand()
Q78. Which of these packages contains all the event handling interfaces?
a) java.lang
b) java.awt
c) java.awt.event
d) java.event
Q79. Which of these interfaces handles the event when a component is added to a container?
a) ComponentListener
b) containerListener
c) FocusListener
PRACTICALKIDA.COM
d) InputListener
Q84. Which of these methods can be used to know the degree of adjustment made by the user?
a) getValue()
b) getAdjustmentType()
c) getAdjustmentValue()
d) getAdjustmentAmount()
Q85. Which of these events is generated when the size of an event is changed?
a) ComponentEvent
b) ContainerEvent
c) FocusEvent
d) InputEvent
Q86. Which of these events is generated when the component is added or removed?
a) ComponentEvent
b) ContainerEvent
c) FocusEvent
PRACTICALKIDA.COM
d) InputEvent
Q87. Which of these methods can be used to get reference to a component that was removed
from a container?
a) getcomponent()
b) getChild()
c) getcontainercomponent()
d) getcomponentChild()
Q89. Which of these events is generatd when computer gains or losses input focus?
a) ComponentEvent
b) ContainerEvent
c) FocusEvent
d) InputEvent
Q93. The Key Event class doen not define _______ integer constant
a) KEY_RELEASED
b) KEY_PRESSED
c) KEY_TYPED
d) KEY_ENTERED
PRACTICALKIDA.COM
Q94. _____ is the abstract super class of all component input event class.
a) FocusEvent
b) InputEvent
c) ComponentEvent
d) Containerevent
Q96. If a class extends ActionListener interface, it must contain a method called ______
a) actionPerformed
b) itemStateChanged
c) both a and b
d) None of these
Q98. Which of the following statements registers a panel object p as a listener for a button
variable jbt?
a) addActionListener(p)
b) jbt.addActionListener(p)
c) jbt.addEventActionListener(p)
d) jbt.EventListener(p)
PRACTICALKIDA.COM
d) All of these
Q101. Which of these methods can be used to determine the type of event?
a) getID()
b) getSource()
c) getEvent()
d) getEventObject()
Q102. Which of the following is not one of the seven methods for handling window events?
a) windowOpening
b) WindowActivated
c) WindowIconified
d) WindowClosed
Q103. Which of these method will respond when you click any button by mouse?
a) mouseDragged()
b) mousePressed()
c) mouseEntered()
d) All of these
PRACTICALKIDA.COM
setBackground(Color.yellow);
else
setBackground(Color.red);
}
Public void actionPerformed(ActionEvent e)
{
String str=e.getActionCommand();
If(str.equals(“change the color”))
{
Flag=flag;
//toggle the flag values on every click of button
Repaint();
}
}
}
a) ActionListener
b) ItemListener
c) MouseListener
d) None of these
Q107. What method is used to distinguish b/w single, double, triple mouse clicks?
a) getButton( )
b) getPoint( )
c) getClickCount( )
d) getX( )
Q108. The getNewState( ) method belongs to______.
a) TextEvent Class
b) MouseEvent Class
c) WindowEvent Class
d) KeyEvent Class
Q109. Which of the following is the highest class in the event-delegation model?
a) Java.until.EventListener
b) Java.until.EventObject
c) Java.awt.AWTEvent
d) Java.awt.event.AWTEvent
Q110. When two or moreobjects are added as listeners for the same event, which listener is first
invoked to handle the event?
a) The first object that was added as listener
b) The last object that was added as listener
c) There is no way to determine which listener will be invoked first
d) It is impossible to have more than one listener for a given event.
/* PRACTICALKIDA.COM
Q111. Consider following code and fill up the correct event listener method
PRACTICALKIDA.COM
.
PRACTICALKIDA.COM
IMP SET 2
Program : - Computer Engineering Group Program Code:- CM/IF
Course Title: -Advanced Java Programming Semester: - Fifth
-----------------------------------------------------------------------------------------------
PRACTICALKIDA.COM
Q. 3 A _______is a program providing services to the _____ program.
(a) Server, Client (b) Client, Server
(d) Host, Client (c) Server, Server
Q. 4 _................server can process multiple requests at a time.
(a) An iterative
(b) A concurrent
(c) A concurrent or an iterative
(d) None of these
PRACTICALKIDA.COM
(d) 79 (c) 25
Q. 13 java.net package consist of interface __ .
(a) ContentHandler Factory.
(b) SocketImplfactory
(c) SocketOption
(d) All of above
Q.14 __ is a protocol for breaking and sending packets to an
address across a network?
(a) TCIPIIP
(c) Socket
Q.15 Full form ofDNS is
(a) Data Network Service
(b) Data Name Service
(c) Domain Network Service
(d) Domain Name System
Q. 16 TCP is -------- oriented protocol.
(a) stream (b) message
(c) block (d) segment
Q.17 What is the output of this program?
1. importjava.net.*;
2. class networking {
3. publicstaticvoid main(String[]args)throwsUnknownHostException{
4. InetAddress obj1 =InetAddress.getByName("sanfoundary.com");
5. InetAddress obj2 =InetAddress.getByName("sanfoundary.com");
6. boolean x = obj1.equals(obj2);
7. System.out.print(x);
8. }
9. }
a) 0
b) 1
c) true
d) false
1. importjava.net.*;
PRACTICALKIDA.COM
2. class networking {
3. publicstaticvoid main(String[]args)throwsUnknownHostException{
4. InetAddress obj1 =InetAddress.getByName("cisco.com");
5. InetAddress obj2 =InetAddress.getByName("sanfoundary.com");
6. boolean x = obj1.equals(obj2);
7. System.out.print(x);
8. }
9. }
a) 0
b) 1
c) true
d) false
1. Import java.net.*;
2. class networking {
3. public static void main(String[]args) throwsUnknownHostException{
4. InetAddress obj1 =InetAddress.getByName("cisco.com");
5. System.out.print(obj1.getHostName());
6. }
7. }
a) cisco
b) cisco.com
c) www.cisco.com
d) None of the mentioned
1. importjava.net.*;
2. class networking {
3. publicstaticvoid main(String[]args)throwsException{
4. URLobj=newURL("http://www.sanfoundry.com/javamcq");
5. URLConnection obj1 =obj.openConnection();
6. System.out.print(obj1.getContentType());
7. }
PRACTICALKIDA.COM
8. }
1. importjava.net.*;
2. class networking {
3. publicstaticvoid main(String[]args)throwsMalformedURLException{
4. URLobj=newURL("http://www.sanfoundry.com/javamcq");
5. System.out.print(obj.toExternalForm());
6. }
7. }
a) sanfoundry
b) sanfoundry.com
c) www.sanfoundry.com
d) http://www.sanfoundry.com/javamcq
1. importjava.net.*;
2. class networking {
3. publicstaticvoid main(String[]args)throwsMalformedURLException{
4. URLobj=newURL("http://www.sanfoundry.com/javamcq");
5. System.out.print(obj.getProtocol());
6. }
7. }
a) http
b) https
c) www
d) com
PRACTICALKIDA.COM
Q.23. What is the output of this program?
1. importjava.net.*;
2. class networking {
3. publicstaticvoid main(String[]args)throwsMalformedURLException{
4. URLobj=newURL("http://www.sanfoundry.com/javamcq");
5. System.out.print(obj.getPort());
6. }
7. }
a) 1
b) 0
c) -1
d) garbage value
PRACTICALKIDA.COM
Q. 29 Which class have only one instance?
(a) Adaptor Class (b) Singleton Class
•
(c) Factory class ·.1(d) Proxy Class
Q. 30 A __ variable is shared by all instances of the class. It
exists even before an object is created.
(a) abstract (b) instance
(c) interface (d) static
Q. 31 __ is wrapper around everything associated with a
reply from an http server?
(a) HTTP (b) HttpResponse
(c) Httpserver (d) httpserver
Q. 32 __ is a bundle of information passed between machines.
(a) Protocol (b) Cache
(c) Datagrams (d) Segment
Q. 33 __ class is necessary to implement datagrams.
(a) DatagramPacket (b) DatagramSocket
(c) Datagram d) Both (a) and (b)
PRACTICALKIDA.COM
in a program ?
(a) java.security (b) java.lang.security
(c) java.awt.image (d) java.io.security
Q. 39 Class which allows us to get real time data about private
and protected member of a class is __ .
(a) java.io.security
(b) java.GetInformation
(c) ReflectPermission
(d) MembersPermission
Q. 40 The packages contain classes and interfaces used for input
and output operations of a program is __ .
(a) java.util (b) java.lang
(c) java.io (d) java.file.io
Q. 41 __ class is not a member class of java.io package.
(a) File (b) StringReader
(c) Writer (d) String
1.
2.
PRACTICALKIDA.COM
importjava.net.*;
class networking {
3. publicstaticvoid main(String[]args)throwsMalformedURLException{
4. URLobj=newURL("http://www.sanfoundry.com/javamcq");
5. System.out.print(obj.getHost());
6. }
7. }
a) sanfoundry
b) sanfoundry.com
c) www.sanfoundry.com
d) http://www.sanfoundry.com/javamcq
1. importjava.net.*;
2. class networking {
3. publicstaticvoid main(String[]args)throwsMalformedURLException{
4. URLobj=newURL(“http://www.sanfoundry.com/javamcq”);
5. System.out.print(obj.toExternalForm());
6. }
7. }
a) sanfoundry
b) sanfoundry.com
c) www.sanfoundry.com
d) http://www.sanfoundry.com/javamcq
Q55. A remote object is an object whose method can be invoked from another virtual
environment.
a) True
b) False
PRACTICALKIDA.COM
Q56. A typical _________ program creates some remote objects, makes references to these
objects accessible, and waits for clients to invoke methods on these objects.
a) Server
b) Client
c) Thread
d) Concurrent
Q57. A typical __________ 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) Thread
d) Concurrent
Q58. The ___________ layer, which provides the interface that client and server application
objects use to interact with each other.
a) Increasing
b) Count
c) Bit
d) Stub/skeleton
PRACTICALKIDA.COM
b) stub
c) remote
d) server
Q63. RMI uses stub and skeleton for communication with the ________ object.
a) client
b) remote
c) server
d) any
Q64. Which of these interface abstracts the output of messages from httpd?
a) LogMessage
b) LogResponse
c) Httpdserver
d) httpdResponse
Q65. Which of these class is used to create servers that listen for either local or remote client
programs?
a) httpServer
b) ServerSockets
c) MimeHeader
d) HttpResponse
Q66. Which of these is a standard for communicating multimedia content over email?
a) http
b) https
c) Mime
d) httpd
Q67. Which of these methods is used to make raw MIME formatted string?
a) parse()
b) toString()
PRACTICALKIDA.COM
c) getString()
d) parseString()
Q68. Which of these class is used for operating on request from the client to the server?
a) http
b) httpDecoder
c) httpConnection
d) httpd
Q69. Which of these method of MimeHeader is used to return the string equivalent of the values
stores on MimeHeader?
a) string()
b) toString()
c) convertString()
d) getString()
Q71. Which of these methods of httpd class is used to read data from the stream?
a) getDta()
b) GetResponse()
c) getStream()
d) getRawRequest()
Q72. Which of these method of httpd class is used to get report on each hit to HTTP server?
a) log()
b) logEntry()
c) logHttpd()
d) logResponse()
Q73. Which of these methods are used to find a URL from the cache of httpd?
a) findfromCache()
b) findFromCache()
c) serveFromCache()
PRACTICALKIDA.COM
d) getFromCache()
Q74. Which of these variables stores the number of hits that are successfully served out of
cache?
a) hits
b) hitstocache
c) hits_to_cache
d) hits.to.cache
Q75. Which of these method of httpd class is used to write UrlCacheEntry object into local disk?
a) writeDiskCache()
b) writetoDisk()
c) writeCache()
d) writeDiskEntry()
PRACTICALKIDA.COM
a) host()
b) getHost()
c) GetHost()
d) gethost()
Q81. Which of these methods is used to know the full URL of an URL object?
a) fullHost()
b) getHost()
c) ExternalForm()
d) toExternalForm()
Q82. Which of these class is used to access actual bits or content information of a URL?
a) URL
b) URLDecoder
c) URLConnection
d) All of the mentioned
Q83. Which of these is a wrapper around everything associated with a reply from an http server?
a) HTTP
b) HttpResponse
c) HttpRequest
d) httpserver
Q84. Which of these transfer protocol must be used so that URL can be accessed by
URLConnection class object?
a) http
b) https
c) Any Protocol can be used
d) None of the mentioned
Q85. Which of these methods is used to know when was the URL last modified?
a) LastModified()
b) getLastModified()
c) GetLastModified()
d) getlastModified()
Q86. Which of these methods is used to know the type of content used in the URL?
a) ContentType()
b) contentType()
PRACTICALKIDA.COM
c) getContentType()
d) GetContentType()
Q87. Which of these data member of HttpResponse class is used to store the response from an
http server?
a) status
b) address
c) statusResponse
d) statusCode
Q90. Which of these method of DatagramPacket is used to find the port number?
a) port()
b) getPort()
c) findPort()
d) recievePort()
Q91. Which of these method of DatagramPacket is used to obtain the byte array of data
contained in a datagram?
a) getData()
b) getBytes()
c) getArray()
d) recieveBytes()
Q92. Which of these methods of DatagramPacket is used to find the length of byte array?
a) getnumber()
b) length()
PRACTICALKIDA.COM
c) Length()
d) getLength()
Q93. Which of these class must be used to send a datagram packets over a connection?
a) InetAdress
b) DatagramPacket
c) DatagramSocket
d) All of the mentioned
Q94. Which of these method of DatagramPacket class is used to find the destination address?
a) findAddress()
b) getAddress()
c) Address()
d) whois()
Q98. In CGI, process starts with each request and will initiate OS level process.
a) True
b) False
PRACTICALKIDA.COM
b) ServerSocket
c) Server
d) ServerReader
Q100. What happens if ServerSocket is not able to listen on the specified port?
a) The system exits gracefully with appropriate message
b) The system will wait till port is free
c) IOException is thrown when opening the socket
d) PortOccupiedException is thrown
PRACTICALKIDA.COM
d) Temporary IP Address is assigned
(a) JDBC is an API to connect to relational-, object and XML data sources.
(b) JDBC stands for Java DataBase connectivity.
(c) JDBC is an API to access relational databases, spreadsheets and flat files.
(d) JDBC is an API to bridge the object-relational mismatch between OO programs and
relational databases.
Q.4 JDBC technology-based drivers generally fit into how many categories?
(a) 4 (b) 3
(c) 2 (d) 5
PRACTICALKIDA.COM
Q.5 Which type of driver provides JDBC access via one or more ODBC drivers?
(a) Type 1 driver (b) Type 2 driver
(c) Type 3 driver (d) Type 4 driver
Q.6 Which type of driver converts JDBC calls into the network protocol used by the database
management system directly?
Q.9 Which driver is efficient and always preferable for using JDBC applications?
(a) Type 1 driver (b) Type 2 driver
(c) Type 3 driver (d) Type 4 driver
PRACTICALKIDA.COM
(b) Type 4 drivers are 100 % Java compatible
(c) Type 4 drivers uses socket class to connect to the database.
(d) Type 4 drivers can not be used with Netscape.
Q.14 Which of the following JDBC drivers is known as a partially java driver ?
(a) The JDBC driver manager (b) The JDBC driver test suite
(c) The JDBC-ODBC bridge (d) All of these
Q.16 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 of these.
Q.17 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
(a) A DataSource is the basic service for managing a set of JDBC drivers.
(b) A DataSource is the Java representation of a physical data source.
(c) A DataSource is a registry point for JNDI- services.
(d) A DataSource is a factory of connections to a physical data source.
Q.19 Which of the following describes the correct sequence of the steps involved in making
connection with a database.
Q.20 Which of the following methods are needed for loading a database driver in JDBC?
PRACTICALKIDA.COM
(a) registerDriver() method (b) Class.forName0
(c) Both a and b (d) getConnection()
Q.23 Which of the following encapsulates an SQL statement which is passed to the database to
be parsed, compiled, planned and executed?
(a) The row you are positioned on is deleted from the ResultSet, but not from
the database.
(b) The row you are positioned on is deleted from the ResultSet and from the database.
(c) The result depends on whether the property synchronizeWithDataSource is set to true or
false.
(d) You will get a compile error : The method does not exist because you can not delete rows
from a ResultSet.
Q.26 The JDBC-ODBC bridge supports multiple concurrent open statements per connection?
Q.27 All raw data types (for instance-data for images) should be read and uploaded to the
database as an array of_____.
PRACTICALKIDA.COM
(a) Yes, they compiled
(b) No, they are bound by the JDBC driver
Q.31 ______ is an open source DBMS product that runs in window as well as Linux.
Q.34 The ResultSet.next method is used to move to the next row of the ResultSet, making it the
current row.
Q.37 JDBC is a Java API that is used to connect and execute query to the database.
PRACTICALKIDA.COM
(a) True (b) False
(a) Class.forName(sun.jdbc.odbc.JdbcOdbcDriver)
(b) Class.forName("sun.jdbc.odbc.JdbcOdbcDriver")
(c) Class.loadClass(sun.jdbc.odbc.JdbcOdbcDriver)
(d) Class.loadClass("sun.jdbc.odbc.JdbcOdbcDriver")
Q.40 To execute a SELECT statement "select * from Address" on a Statement object stmt, use
(a) By invoking the method get( .. , String type)on the ResultSet, where type is the database type
(b) By invoking the method get(…, Type type)on the ResultSet, where Type is an object which
represents a database type
(c) By invoking the method getValue( .. ), and cast the result to the desired Java type.
(d) By invoking the special getter methods on the ResultSet : getString( .. ), getBoolean( .. ),
getClob(. .. ), ..
(a) Yes, but only if you call the method openCursorO on the ResultSet, and if the driver and
database support this option
(b) Yes, but only if you indicate a concurrency strategy when executing the statement, and if the
driver and database support this option
PRACTICALKIDA.COM
(c) Yes, but only if the ResultSet is an object of class UpdateableResultSet, and if the driver and
database support this option
(d) No, ResultSets are never updateable. You must explicitly execute DML statements (i.e.
insert, delete and update) to change the data in the underlying
database.
Q. 44 What is JDBC ?
Q. 45 JDBC is a ______ interface, which means that it is used to invoke SQL commands
directly
Q. 46 Kind of driver converts JDBC calls on the client API for Oracle, Sybase, Informix, DB2,
or other DBMS is known as, _____ .
PRACTICALKIDA.COM
(a) Data Source Name
(c) Data source
(b) Domain Name
(d) Source name
Q. 54 Which of the following translates the socket information in call format required by the
DBMS?
Q. 56 Which of the following model is java applet or application directly Communicates with
data source?
Q. 58 Connection interface helps by providing the different methods for--------- and -----
PRACTICALKIDA.COM
(c) Error handling , Connection (d) None of the above
Q. 61 Every driver must provide a class that should implement the Driver interface.
Q.65 What is the return value from stmt.executeUpdate("insert into T values (100, ‘Smith')")
(a) void
(b) an int value indicating how many rows are effected from the invocation
(c) a value indicating whether the SQL statement has been executed successfully
(d) an object that contains the status of the execution
PRACTICALKIDA.COM
(d) preparedStatement.setString(1, ‘John');
Q.67 How do you know in your Java program that a SQL warning is generated as a result of
executing a SQL statement in the database?
a) You must catch the checked SQLException which is thrown by the method which executes
the statement
b) You must catch the unchecked SQLWarningException which is thrown by the method which
executes the statement
c) You must invoke the getWarnings() method on the Statement object (or a sub interface
thereof)
d) You must query the ResultSet object about possible warnings generated by the database
(a) DDL statements are treated as normal SQL statements, and are executed by calling the
execute() method on a Statement (or a sub interface thereof) object
(b) To execute DDL statements, you have to install additional support files
(c) DDL statements can not be executed by making use of JDBC, you should use the native
database tools for this.
(d) Support for DDL statements will be a feature of a future release of JDBC
PRACTICALKIDA.COM
Q.74 Which of the following is not interface?
(a)1 (b)2
(c)4 (d)3
(a)boolean (b)integer
(c)ResultSet Object (d) String
(a)boolean (b)integer
(c)ResultSet Object (d) String
Q.79 executeQuery() method returns _____ value.
(a)boolean (b)integer
(c)ResultSet Object (d) String
Q.80
(a)boolean (b)integer
(c)ResultSet Object (d) String
Q.82 JDBC is useful for both application developers and JDBC driver vendors.
True (b)False
Q.83 Any third party vendor cannot design their own JDBC drivers.
PRACTICALKIDA.COM
Q.84 The JDBC specification is prepared by Sun Microsystems.
Q.85 JDBC API supports both two-tier and three-tier processing model.
Q.86 JDBC is an API that cannot access data stored in a Relational Database.
(a) JDBC driver is an interface enabling a Java application to interact with a database.
(b) The JDBC driver gives out the connection to the database and implements the protocol for
transferring the query and result between client and database.
(c)Both of the above
(d) None of the above
Q.88 How many Result sets available with the JDBC 2.0 core API?
(a) 2 (b) 3
(c) 4 (d) 5
Q.89 The performance of the application will be faster if you use PreparedStatement interface
because query is compiled only once.
Q.90 Which model does a Java applet or application talks directly to the data source?
PRACTICALKIDA.COM
3. What is the difference between servlets and applets?
i.Servlets execute on Server; Applets execute on browser
ii.Servlets have no GUI; Applet has GUI
iii.Servlets creates static web pages; Applets creates dynamic web pages
iv.Servlets can handle only a single request; Applet can handle multiple requests
a) i,ii,iii are correct
b) i,ii are correct
c) i,iii are correct
d) i,ii,iii,iv are correct
4. Which of the following code is used to get an attribute in a HTTP Session object in servlets?
a) session.getAttribute(String name)
b) session.alterAttribute(String name)
c) session.updateAttribute(String name)
d) session.setAttribute(String name)
5. Which method is used to get three-letter abbreviation for locale’s country in servlets?
a) Request.getISO3Country()
b) Locale.getISO3Country()
c) Response.getISO3Country()
d) Local.retrieveISO3Country()
6. Which of the following code retrieves the body of the request as binary data?
a) DataInputStream data = new InputStream()
b) DataInputStream data = response.getInputStream()
c) DataInputStream data = request.getInputStream()
d) DataInputStream data = request.fetchInputStream()
9. How is the dynamic interception of requests and responses to transform the information done?
a) servlet container
b) servlet config
c) servlet context
PRACTICALKIDA.COM
d) servlet filter
11. Connection Pooling Class manages no of user requests for connections to improve the
performance.
a. True
b. False
12. Which object of HttpSession can be used to view and manipulate information about a
session?
a. session identifier
b. creation time
c. last accessed time
d. All mentioned above
a. True
b. False
14. 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
PRACTICALKIDA.COM
response to another resource, it may be servlet, jsp or html file.
a. True
b. False
a. RMI Communication
b. HTTP Communication
c. Socket Communication
d. All mentioned above
17. 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
18. 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
a. Genereic Servlets
b. HttpServlets
c. All of the above
d. None of the above
20.Which cookie it is valid for single session only and it is removed each time when the user
closes the browser?
a. Persistent cookie
b. Non-persistent cookie
c. All the above
d. None of the above
Ans:- b
21. Sessions is a part of the SessionTracking and it is for maintaining the client state at server
PRACTICALKIDA.COM
side.
a. True
b. False
22. Web server is used for loading the init() method of servlet.
a. True
b. False
a. True
b. False
24. Which method is used to send the same request and response objects to another servlet in
RequestDispacher ?
a. forward()
b. sendRedirect()
c. Both A & B
d. None of the above
25. 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
26. Which class can handle any type of request so that it is protocol-independent?
a. GenericServlet
b. HttpServlet
c. Both A & B
d. None of the above
a. GET
b. POST
c. BOTH A & B
PRACTICALKIDA.COM
d. None of the above
28. Which object 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
30. Which method in session tracking 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
31. In HTTP Request what asks for the loopback of the request message, for testing or for
troubleshooting?
a. PUT
b. OPTIONS
c. DELETE
d. TRACE
32. Which one of the following scopes does the attribute in servlet is an object that can be
set, get or removed?
a. session scope
b. request scope
c. application scope
d. All mentioned above
PRACTICALKIDA.COM
a. Apache
b. Tomcat
c. JBoss
d. Weblogic
e. Both C & D
a. 4
b. 3
c. 2
d. 5
35. In HTTP Request method Get request is secured because data is exposed in URL bar
a. True
b. False
a. True
b. False
38. What technique is used for the authentication mechanism in the servlet specification?
a. Role Based Authentication
b. Form Based Authentication
c. Both A & B
d. None of the above
PRACTICALKIDA.COM
40. What is the storage capacity of single cookie?
a) 2048 MB
b) 2048 bytes
c) 4095 bytes
d) 4095 MB
42. Which component can be used for sending messages from one application to another?
a) server
b) client
c) mq
d) webapp
45. How can we take input text from user in HTML page?
a) input tag
b) inoutBufferedReader tag
c) meta tag
d) scanner tag
PRACTICALKIDA.COM
47. Which of the below can be used to debug front end of a web application ?
a) Junit
b) Fitnesse
c) Firebug
d) Mockito
49. The Java specification defines an application interface for communication between the
web server and the application program
a) servlet
b) randomise
c) applet
d) script
50. Which method is used to specify before any lines that uses the PintWriter?
a) setPageType()
b) setContextType0
c) setContentType()
d) setResponseType()
54. Web server is used for loading the init() method of servlet.
a) True
b) false
PRACTICALKIDA.COM
55. Which packages represent interfaces and classes for servlet API?
a) javax.servlet
b) javax.servlet.http
c) Both a and b
d) None of these
60. The doGet() method extracts values of the parameter's types and number by using
a) response.getAttribute()
b) response.getParameter()
c) request.getParameter()
d) request.setParameter()
PRACTICALKIDA.COM
d) None
66.Sessions is a part of the SesionTracking and it is for maintaining the client state at server side.
a) True
b) False
67. Which cookie it is valid for single session only and it is removed each time when the user
closes the browser?
a) Persistent cookie
b) Non-persistent cookie
c) None of these
d) All of these
68. Which method in session tracking 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
PRACTICALKIDA.COM
71. Which of the following is an approach for state maintenance in Web applications?
(a) Hidden Form Field (b) URL Rewriting
(c) Cookies (d) HTTP Session
(e) All of the above.
72. Which method of the request object is used to extract values of the input fields in a form
when it is submitted?
(a) getParameter (b) getParameterNames
(c) getValues (d) putValues
(e) getParameters.
76. Java servlets are efficient and powerful solution for creating __ for the web.
(a) dynamic content (b) static content
(c) hardware (d) both (a) and (b)
77. __ is the first phase of the servlet life cycle.
(a) Initialization (b) Service
(c) Destruction (d) Both (a) and (b)
78. The service phase of the servlet life cycle represents a interactions with requests until the
servlet is __ o
(a) created (b) running
PRACTICALKIDA.COM
(c) initiated (d) destroyed
80. If your request is not time-sensitive, such as finding the address of a student in the database,
use the __________ method to speed up the performance.
a) GET
b) POST
c) DELETE
d) UPDATE
83. Why use RequestDispatcher to forward a request to another resource, instead of using a
sendRedirect?
a) Redirects are no longer supported in the current servlet API.
b) Redirects are not a cross-platform portable mechanism.
c) The RequestDispatcher does not use the reflection API.
d) The RequestDispatcher does not require a round trip to the client, and thus is more
efficient and allows the server to maintain request state.
84. What is the difference between doing an include or a forward with a RequestDispatcher?
a) The forward method transfers control to the designated resource, while the include
method invokes the designated resource, substitutes its
output dynamically in the display, and returns control to the calling page.
b) The two methods provide the same functionality, but with different levels of
persistence.
c) The forward method is deprecated as of JSP 1.1 and the include method should be used
in order to substitute portions of a dynamic display at
runtime.
PRACTICALKIDA.COM
d) The include method transfers control to a dynamic resource, while the forward method
allows for dynamic substitution of another JPS pages
output, returning control to the calling resource.
86. Which of the scripting of JSP not putting content into service method of the converted
servlet?
a) Declarations
b) Scriptlets
c) Expressions
d) None of the above
PRACTICALKIDA.COM
.
PRACTICALKIDA.COM