0% found this document useful (0 votes)
8 views6 pages

Advance Java Programming Practice Test

The document is a practice test for Advance Java Programming, containing multiple-choice questions related to Swing and AWT components, methods, and functionalities. It covers topics such as dialog boxes, layout managers, event handling, and JDBC. The test includes various questions that assess knowledge of Java programming concepts and GUI development.

Uploaded by

ayushshinde450
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views6 pages

Advance Java Programming Practice Test

The document is a practice test for Advance Java Programming, containing multiple-choice questions related to Swing and AWT components, methods, and functionalities. It covers topics such as dialog boxes, layout managers, event handling, and JDBC. The test includes various questions that assess knowledge of Java programming concepts and GUI development.

Uploaded by

ayushshinde450
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

MSBTE PRACTICE TEST NO- 01

ADVANCE JAVA PROGRAMMING

9. Which of the following is not a swing class?


1. ___________ method is used to lock the textField a) JComboBox c) JFrame
Component. b) JComponent d) Canvas
a) getText() c) getSelectedText()
b) setText() d) setEditable(false) [Link] of characters can be disabled as they are
typed by using ___________
a) echoChar() c) isEchoChar()
2. Which of the following are passed as an argument b) setEchoChar() d) echoCharIsSet()
to the paint() method?
a) A Canvas object c) An Image object [Link] components are preceded by the letter
b) A Graphics object d) A paint object a) S b) A c) X d) J

3. Which of the following methods can be used to [Link] many types of control does AWT support?
change the size of [Link] object? a) 7 b) 6 c) 5 d) 8
(A) setDimensions()
(B) setSize() [Link] the abbreviation of AWT?
(C) size() a) Applet Windowing Toolkit
b) Abstract Windowing Toolkit
a) (A), (B), (C) and (D) c) (B), (C) and (D) c) Absolute Windowing Toolkit
b) (A), (B) and (D) d) (B) and (D) d) None of these

4. Superclass of TextField and TextArea classes that [Link] box does not have minimize and maximize
is used to create single Line or Multiple textfields button
are a) True
a) TextBox c) Checkbox b) False
b) TextComponent d) Choice
[Link] is a component in AWT that can contain
another component like buttons, textfields, labels
5. When a ___________ Dialog box is active, it etc?
blocks user input to all other windows in the a) Window c) Panel
program. b) Container d) Frame
a) modal c) file
b) modeless d) none of the above [Link] class provides many methods for graphics
programming?
6. The getButton() method returns a) [Link] c) [Link]
a) returns int value that represents the button that b) [Link] d) None of these
caused the event.
b) returns boolean value that represents the button [Link] is
that caused the event. a) Class c) Variable
c) returns void and generates events b) Method d) Interface
d) returns object and generates events
[Link] applet is
7. The getButton() method returns a) .applet file c) .java file
a) button that caused the event. b) java html d) .class file
b) returns boolean value that represents the button
that caused the event
c) returns void and generates events. [Link] method executes only once?
d) returns object and generates events. a) start() c) init()
b) stop() d) destroy()
8. To implement swings which package is to be
imported from the following options: [Link] can be embedded in
a) [Link] b) [Link] a) HTML document c) gif file
b) word document d) rtf file
c) [Link] d) javaxswing
MSBTE PRACTICE TEST NO- 01
ADVANCE JAVA PROGRAMMING

[Link] is the container that doesn’t contain the [Link] are the variables defined in Dimension?
title bar and MenuBars. It can have other a) length and width c) height and width
components like button, textfield. b) height and length d) None of these
a) Window c) Panel
b) Frame d) Container
[Link] AWT component is not editable?
[Link] is a passive AWT control that does not a) Button c) FlowLayout
generate any event? b) TextField d) Label
a) Button c) GridLayout
b) RadioButton d) Label [Link] method places a Menu m into the MenuBar
mb.
[Link] default layout manager of Frame is a) [Link](m) c) [Link](m)
a) FlowLayout c) GridLayout b) [Link](m) d) None of these
b) BorderLayout d) CardLayout
[Link] many ways can we align the label in a
[Link] method is used to check the status of container?
checkbox? a) 1 b) 2 c) 3 d) 4
a) getStatus() c) isChecked()
b) getState() d) getChecked() [Link] title of the frame can be set in AWT using which
of the following method?
a) setHeading c) CreateTitle
[Link] default layout manager of Applet is b) setTitle d) Settitle
a) FlowLayout c) GridLayout
b) BorderLayout d) CardLayout [Link] of these classes can be added to any
container class, using the add method defined in
[Link] of the method is use to output a string in container class?
applet? a) Button c) Menu
a) display() c) drawString() b) CheckboxMenuItem d) MenuBar
b) print() d) transient()
[Link] of the following methods can be used to
change the size of a [Link] object?
[Link] of the following method is used to set a a) dimension() c) area()
TextComponent to read-only mode? b) setSize() d) size()
a) Editable() c) setEchoChar()
b) nonEditable() d) setEditable() [Link] most commonly used layout managers are?
a) FlowLayout c) GridLayout
[Link] of the following generates action events b) BorderLayout d) All of these
when an item is double-clicked.
a) List c) MenuItem
b) Checkbox d) TextField [Link] two ways are used to create a Frame
a) By creating the object of Frame class
[Link] of the following does have its default (association)
layout as BorderLayout. b) By extending Frame class (inheritance)
a) Frame c) JApplet a) True
b) Dialog d) All of Above b) False

[Link] are passive controls that do not support


[Link] of the following statement about GUI any interaction with the user?
component is wrong? a) Choice c) Labels
a) Swing exists since the version 1.2 of the JDK b) List d) Settitle
b) AWT stands for Abstract Window Toolkit
c) You cannot place AWT component on swing [Link] abstract class is super class of all the menu
container related class?
d) The AWT classes are deprecated. a) MenuComponent c) MenuItem
b) MenuBar d) CheckboxMenuItem
[Link] of the following package is used for
Graphical User Interface?
a) [Link] c) [Link]
b) [Link] d) [Link]
MSBTE PRACTICE TEST NO- 01
ADVANCE JAVA PROGRAMMING

[Link] which method we can set or change the text in [Link] AWT controls are subclass of which class?
a Label in AWT? a) Component c) Container
a) setText() c) addText() b) AWT Control d)Window
b) getText() d) all of these

[Link] are the type of dialog box


[Link] layout manager for subclasses of window a) Modal Dialog box
is b) Modal and Modeless Dialogbox
a) CardLayout c) Frame c) Model
b) BorderLayout d) BorderLayout d) None of these

[Link] immediate super class of TextArea is


[Link] menu is associated with a list of menu items: a) TextField b) TextBox
a) Checkbox c) Choice d)Component d) TextComponent
b) Drop-down d) None of these

[Link] is the immediate super class of Applet? [Link] immediate super class of TextArea is
a) Container c) Frame a) TextField c) TextBox
b) Component d) Panel b)TextComponent d) Component

[Link] is the immediate super class of Applet?


[Link] object can be constructed to show any
a) Container c) Frame number of choices in the visible window?
b) Component d) Panel
a) Choice c) Menu
b) List d) Checkbox
48. Which class encapsulates a blank window upon [Link] is the container that doesn’t contain title bar
which we can draw? and menu bars. It can have other components like
a) Window c) Frame button, text field etc?

b)Canvas d) Applet a) Window c) Frame


b) Panal d) Container

[Link] class can create object of it using which of the


[Link] which method we can set or change the text in a
following color values?
label in AWT?
a) RGB b) RYB c) CMY d) HSB
a) setText() c) getText()
b) all of these d)addText
[Link] which side applet always executed?
[Link] of the following style is not supported by a) Server side b) Client side
Font class?
a) Font UNDERLINE b) Font ITAL
d) Font BOLD c) Font PLAIN [Link] setBackground() method is a part of which of
the following class [Link] package?
a) Component c) Applet
51.A class displays a dialog window from which a user b)Graphic d) Object
can select a file.

a) Dialog c) File
[Link] of the following is true about applet?
b) FileDialog d) None of these a) Applets do not have a main() method.
b) Applets must run under applet viewer or web
browser
52.A checkbox is a control that consist of a c) The user I/O is not performed using java’s stream
a) Combination of a small box I/O class
b) A label d) All of these
c) Combination of a large box and a label
d) Both a & b
MSBTE PRACTICE TEST NO- 01
ADVANCE JAVA PROGRAMMING

[Link] class is used to represent a single line of text [Link] JDBC driver types can be used either in
with password character facility applet or servlet code?
a) TextField c) TextArea a) Both type 1 and Type 2
b) Checkbox d) Label b) Both Type 1 and Type 3
c) Both Type 3 and Type 4
d) Type 4 only
[Link] applet are used to create which applications
a) Graphical c) User interactive
b)Both a & b d) None of the above [Link] of the following is NOT the method of
CardLayout class
a) public void next(Container parent)
b) public void display(Container parent)
[Link] of these functions is called to display the c) public void first(Container parent)
output of an applet? d) public void previous(Container parent)
a) Display() c) paint()
b) displayApplet() d) show()

[Link] is the correct syntax for creating Cookies


Object c.
[Link] of these methods is a part of Abstract a) Cookie c = new Cookie("MyCookie", data);
Window Toolkit (AWT)? b) Cookie c = new Cookie(MyCookie, data);
a) Display() c) Paint() c) cookie c = new cookie("MyCookie", data);
b)Show() d) All of these d) Cookie c = new Cookie(data, "MyCookie");

[Link] correct hierarchy for panel is [Link] one is the correct syntax for creating a
a) Component – Container – Window – Panel Statement?
b) Component – Container – Applet – Panel a) Statement stmt = [Link]();
c) Component – Container – Panel b) Statement stmt = [Link]();
d) Container – Component – Panel c) Statement stmt = [Link]();
d) Statement stmt = [Link]();

[Link] component of AWT provides compact


multichoice, scrolling component [Link] component cannot be added to a container?
a) JPanel c) JButton
a) List c) Panel
b) Choice d) TextArea b) Japplet d) JFrame

69.n the given constructor what third parameter [Link]() method returns ______ of the cookies
indicates: Scrollbar s = new Scrollbar(10, 20, 0, 0, in this request
100)? a) String b) enum c) object d) array
a) size of thumb b) minimum value
c) maximum value d) Initial value

[Link] part of JDBC URL string NOT contains


a) Protocol c) Username and password
[Link] method returns currently selected item in b) Port number d) Database name
choice
a) getSelectedItem() c)getSelectedIndex [Link] code below draws a line. What is the color of
b)getSelectedElement() d) getItem() the line created?

Color c = new Color(255, 0, 0);


[Link] method is used to perform DML statement [Link](c);
in JDBC
a) Execute() b) executeQuery() [Link](0, 0, 100, 100);
c) executeUpdate() d) executResult()
a) Green c) Yellow
b) Red d) Cyan
MSBTE PRACTICE TEST NO- 01
ADVANCE JAVA PROGRAMMING

[Link] API converts ________ into the ________ [Link] of the following method of applet class
used by DBMS. displays the result of applet code on screen?
a) JDBC API, Native API calls a) paint() c) drawString()
b) JDBC API, network protocol b) run() d) update()
c) JDBC API, User call
d) JDBC API, ODBC API calls
[Link] of ResultSet throw ______ exception.
a) SQLException c) MethodNotFoundException
[Link] is the output of following statements b) IOException d) ResultSetException

URL url = new URL("[Link] [Link] one is not a constructor for cookie?
a) Cookie() only
[Link]([Link]()); b) Cookie(String name) only
c) a and b
a) https c) null d) Cookie(String name, String value)
b) -1 d) [Link]

[Link] some applications, it is necessary to ______ so [Link] exception will occur if specified port number
that information can be collected from several is not available for DatagramSocket?
interactions between a browser and a server. a) UnknownException c) UnknownSocketException
a) save date and time information b) SocketException d) UnknownPortException
b) save site information
c) save creation of session [Link] constructor used to create client socket using
d) save objects a preexisting InetAddress object and a port.

a) Socket(String hostname, int port)


b) Socket(InetAddress ipAdd, int port)
83._______________ identifies a servlet to process c) Socket(InetAddress ipAdd, String Hostname)
HTTP GET request d) Socket(int port, InetAddress ipAdd)
a) session c) request
b) cookie d) URL

[Link] of the Following is NOT true for Two Tier


Architecture
[Link] of the following method is used to set the a) There is no intermediate between client and server
maximum age of the cookie in seconds? b) A 2 tiered application will run faster.
a) public void setmaxage(int secs) c) In two tier architecture the server can respond
b) public void Setmaxage(String secs) multiple The direct communication takes place
c) public void setMaxAge(int secs) between client and server.
d) public void setMaxAge(String secs) d) request same time

[Link] object is to be created to show any number [Link] method is used to establish the connection
of choices in the visible window? with the specified url in a Driver Manager class?
a) JLabel c) JCheckBox a) public static void registerDriver(Driver driver)
b) JButton d) JList b) public static void deregisterDriver(Driver driver)
c) public static Connection getConnection(String url)
d) None of the above
[Link] the adapter class from the given options
a) WindowAdapter c) interface
b) class d) inheritance [Link] method moves the cursor to the beginning of
the resultset that is before first row?
[Link] of the following Drivers require native a) beforeFirst() c) first()
library files to be installed and configured on client b) afterLast() d) last()
systems?
a) Type 1 Driver c) Type 3 Driver
b) Type 4 Driver d) Type 2 Driver
97.__________ is the super class of all event classes.
[Link] of ResultSet throw ______ exception. a) Event c) EventObject
a) SQLException c) MethodNotFoundException b) Object d) EventClass
b) IOException d) ResultSetException
MSBTE PRACTICE TEST NO- 01
ADVANCE JAVA PROGRAMMING

[Link] the following program. What should be


the correction done in the program to get correct
output?

import [Link].*;

public class DataBase {

public static void main(String[] args) {

[Link]("[Link]");

...

a) Insert try and catch(FileNotFoundException’e)


b) Insert try(Exception e)
c) Insert try and catch(Exception e)
d) Insert catch(Exception e)

[Link] method is used to establish the connection


with the specified url in a Driver Manager class?

a) public static void registerDriver(Driver driver)


b) public static void deregisterDriver(Driver driver)
c) public static Connection getConnection(String url)
d) None of the above

100. Which of the following methods belong to in


HttpSession interface.
a) String getId()
b) void invalidate()
c) long getLastAccessedTime()
d) All of the ab

You might also like