Advance Java MCQ
Q . _______ generates action events when an item is double-clicked, generate action events when an item is selected or deselected.
a. List
b. Check box
c. Menu item
d. Text box
Ans b
Q. A label is a simple control which is used to display_____________ on the window:
a. Text(non-editable)
b. Text(editable)
c. Both a & b
d. None of these
Ans a.
Q. A label is a simple control which is used to display_____________ on the window:
a. Text(non-editable)
b. Text(editable)
c. Both a & b
d. None of these
Ans a.
Q_____________ is a superclass of TextField and TextArea classes that is used to create single-line or multiline textfields respectively:
a. TextBox
b. CheckBox
c. TextComponent
d. Choice
Ans c
Q. What is the default Layout Manager for the Window and Window subclasses (Frame,Dialog)?
a) BorderLayout() b) FlowLayout c) GridLayout() d) CardLayout()
Ans
Q. What is the default Layout Manager for the the Panel and the Applet classes?
a) BorderLayout() b) FlowLayout c) GridLayout() d) CardLayout()
Ans
Q. Swing uses for running GUI application?
a)Applet b)JApplet and Applet c)JApplet d) None of these.
Ans c
Q. The AWT classes can be roughly categorized into the following groups:
a. GUI Components
b. Layouts
c. Graphics Tools
d. Event Handlers
e. All of these
Ans e
Q. Arranges the components horizontally
a. BorderLayout
b. CardLayout
c. GridLayout
d. FlowLayout
Ans a
Q. Arranges the componemnts into grid
a. BorderLayout
b. CardLayout
c. GridLayout
d. FlowLayout
Ans c
Q. Which of the following classes are derived from the Component class.
A. Container
B. Window
C. List
D. MenuItem
Ans a
Q. The constructor which the Text Event class defines.
a. TextEvent(Object source, int event_type)
b. textevent (Object source, int event_type)
c. textevent (object Source, float event_type)
d. textevent (Object source, string event_type)
Ans a
Q. Which of these events generated when a button is pressed
a) ActionEvent b) WindowEvent c) ItemEvent d) KeyEvent
Ans a
a. TextEvent(Object source, int event_type)
b. textevent (Object source, int event_type)
c. textevent (object Source, float event_type)
d. textevent (Object source, string event_type)
Ans a
Q. Which of these events generated when a button is pressed
a) ActionEvent b) WindowEvent c) ItemEvent d) KeyEvent
Ans a
Q. The text field and text area controls create a _________________ area respectively
a) Single-line text b) Multi-line text
c) Both a & b d) None of these
Ans c
Q. A label is a simple control which is used to display_____________ on the window:
a) Text(non-editable) b) Text(editable) c) Both a & b d) None of these
Ans a
Q. 21 Which package is imported for swing components
a) java.awt.*;
b) java.util.*;
c) javax.swing.*;
d) javax.awt.swing.*;
Ans c
Q. Which are passive controls that do not support any interaction with the user?
A. Choice
B. List
C. Labels
D. Checkbox
Ans c
Q. 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
Ans a
Q. 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
Ans b
Q. These four methods commonly used in?
1)public void add(Component c)
2)public void setSize(intwidth,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
Ans a
Q. The classes and interfaces defined in AWT are contained within the ______ package.
a) java.awt.*; b) java.sql.*; c) java.io.*; d) java.int*;
Ans a
Q. A checkbox is a control that consists of a
a) Combination of a small box
b) A label
c) Combination of a large box and a label
d) Both a & b
Ans d
Q. Swing components that don’t rely on Native GUI are referred to as __________
a) Ligthweight component b) Heavy weight component
c) GUI component d) Non GUI component
Ans a
Q. What layout manager should You use so that every component occupies the same size in
the container?
a) Flow Layout b) Grid Layout c) Border Layout d) any Layout
Ans
Q. A GUI _
a) Uses buttons, menus, and icons b) should be easy for a user to manipulate
c) Stands for Graphic Use Interaction d) Both (a) and (b)
Ans d
Q. The various controls supported by AWT are:
a) Labels, push buttons b) Checkboxes, choice list
c) Scroll bars, text fields, text area d) All of these
Ans d
Q. Name the class used to represent a GUI application window, which is optionally resizable and can have a title bar, an icon, and menus.
A. Window
B. Panel
C. Dialog
D. Frame
Q. The Swing Component classes that are used in Encapsulates a mutually exclusive set of buttons?
A. AbstractButton
B. ButtonGroup
C. JButton
D. ImageIcon
Ans c
Positions the components into five regions: east, west, north, south, center
a) BorderLayout b) CardLayout c) GridLayout d) FlowLayout
Ans a
Q. Arranges the components as a deck of cards such that only one component is visible at a time
a) BorderLayout b) CardLayoutc) GridLayout d) FlowLayo
Ans c
Q. __________ arranges the components horizontally.
a) BorderLayout b) CardLayout c) GridLayout d) FlowLayout
Ans d
Q. Which of these events generated when a button is pressed
a) ActionEvent b) WindowEvent c) ItemEvent d) KeyEvent
Ans: a
0 comments:
Post a Comment