Ajp Ut-1 2 3 QB
Ajp Ut-1 2 3 QB
Ajp Ut-1 2 3 QB
2. Which of these operators can be used to get run time information about an object?
a) getInfo
b) Info
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. Import, Package, Class
b. Class, Import, Package
c. Package, Import, Class
d. Random order
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. 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?
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
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
22. Which of the following methods can be used to remove a java.awt.Component object from the
display?
a)hide()
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
26. The java.applet.Applet class 4 life cycle methods and java.awt.Component class provides how
many life cycle methods for an applet?
a)1 c)3
b)2 d)4
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()
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
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?
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 c) 1
b) 3 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?
a) public void play()
b) public void loop()
c) public void stop()
d) None of the above
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
47. The Java Foundation Classes (JFC) is a set of GUI components which simplify the development of
desktop applications?
a) True
b) False
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
51. Which is a mechanism in which one object acquires all the properties and behaviors of parent
object?
a) Inheritance c) None of the above
b) Encapsulation d) Polymorphism
52. The following Syntax is used for?
class Subclass-name extends Superclass-name
{
//methods and fields
}
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?
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) Compile time polymorphism
b) Runtime polymorphism
c) Static polymorphism
d) Both A & C
a) Method overloading
b) Method overriding
c) Constructor overloading
d) None of the above
59. Which method cannot be overridden?
a) Final Method
b) Final class
c) Final Variable
d) Both A & C
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
66. An interface is a blueprint of a class. It has static constants and abstract methods?
a) True
b) False
75. Window class is base class for two window classes 1)_____2)____.
a)Panel and Frame
b)Component and Frame
c)Window and Panel
d) Component and Panel
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)
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
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
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
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
105. Memory allocation for static variable happens only once when the class is loaded in the
memory.
a)True
b)False
109. “ this” keyword is a ______ variable that refers to the current object.
a)Private
b)Local
c)reference
d)Static
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
117. The TextField used for taking passwords, should be defined by calling_____.
a)setEchoChar()
b) EchoCharset()
c)setPassword()
d) passwordSet()
Q.3 Swing is not a part of JFC (Java Foundation Classes) that is used to create GUI application.
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.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.9 In swing class hierarchy the class present at the root is ______.
a) Component b) Window
c) Container d) Object
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);
} }
}
Q.12 The component used to display following image are _______.
Q.16 To generate following output the components that are used are _______.
Q.18 The swing component classes that are used in Encapsulates a mutually exclusive set of
buttons?
a) AbstractButton b) ButtonGroup
c) JButton d) ImageIcon
Q.19 Select the correct output generated by following code
import java.awt.*;
import java,applet.*;
/*<applet code=Test.class height=200 width=200>
</applet>*/Public class Test extends Applet
{
Public void init()
{
List l=new List(2,true);
l.add(“Java”);
l.add(“C++”);
l.add(“Python”);
add(l);
}
}
a) b)
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.33 ______ represents enterprise data and the business rules that gives access to enterprise data.
a) Model b) View
c) Controller d) None of these
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.50 Which component is used for creating a GUI for downloading or transferring of file.
a) JLable b) JButton
c) JProgressBar d) JProgressbar
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.59 JTree has a 'root node' at the top most which is a parent for all nodes in the tree.
a) True b) False
Q9. Which of these package contains all the event handling interfaces?
a) Java.lang
b) Java.awt
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
Q17. For which class this constant belongs to BLOCK_DECREMENT and BLOCK_INCREMENT?
a) Scrollbar
b) Menubar
c) Filedialog
d) Actionevent
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
Q22. Which of these events is generated when computer gains or losses input focus?
a) ComponentEvent
b) ContainerEvent
c) FocusEvent
d) InputEvent
Q29. ____ is the abstract super class of all component input event class
a) KeyEvent
b) ItemEvent
c) ActionEvent
d) InputEvent
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()
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()
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
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()
c) getcontainercomponent()
d) getcomponentChild()
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()
d) getEventObject()
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()
Q79. Which of these interfaces handles the event when a component is added to a container?
a) ComponentListener
b) containerListener
c) FocusListener
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
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
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)
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
Q107. What method is used to distinguish b/w single, double, triple mouse clicks?
a) getButton( )
b) getPoint( )
c) getClickCount( )
d) getX( )
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.
Q111. Consider following code and fill up the correct event listener method
/*
<applet code=”checkgroup” width=300 height=300>
</applet>
*/
Public class checkgroup extends Applet implements ItemListener
{
String msg=” “;
CheckboxGroup gr=new CheckboxGroup();
Checkbox box1=new Checkbox(“Candy”,gr,true);
Checkbox box2=new Checkbox(“Ice-cream”,gr,false);
Checkbox box3=new Checkbox(“Juice”,gr,false);
Public void init()
{
Add(box1);
Add(box2);
Add(box3);
Box1.addItemListener(this);
Box2.addItemListener(this);
Box3.addItemListener(this);
}
Public void________
{
Repaint();
}
Public void paint(Graphics g)
{
Msg=”I like”;
Msg+ =gr.getSelectedCheckbox().getLable();
g.drawString(msg,10,100);
}
}
a) actionPerformed(ActionEvent e)
b) itemStateChanged(ItemEvent e)
c) action(Event e,Object o)
d) textValueChanged(TextEvent e);