Docsity

Swing GUI Components in Java, Cheat Sheet of Computer science

Toggle sidebar
bg1
Unit 2 : Swing
Total no. of Questions – 100
1.
Pluggable look and feel and lightweight components are the features
supported by
a.
Swing
b.
AWT
c.
Core java
d.
None of these
2.
Swing is based on architecture
a.
Client server
b.
Model view controller
c.
layered
d.
None of these
3.
Swing is not a part of JFC that is used to create GUI application.
a.
True
b.
False
4.
The java foundation classes ( JFC ) is a set of GUI components which
simplify the development of desktop applications.
a.
True
b.
False
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Swing GUI Components in Java and more Cheat Sheet Computer science in PDF only on Docsity!

Unit 2 : Swing

Total no. of Questions – 100

  1. Pluggable look and feel and lightweight components are the features supported by

a. Swing b. AWT c. Core java d. None of these

  1. Swing is based on architecture

a. Client server b. Model view controller c. layered d. None of these

  1. Swing is not a part of JFC that is used to create GUI application.

a. True b. False

  1. The java foundation classes ( JFC ) is a set of GUI components which simplify the development of desktop applications.

a. True b. False

  1. Following letter used a prefix to swing component.

a. A b. S c. G d. J

  1. is one of the features of object oriented programming that allows the creation of hierarchical classifications.

a. Polymorphism b. Class c. Inheritance d. Object

  1. In swing JButton class is derived from

a. AbstractButton b. JToggleButton c. JComponent d. None of these

  1. The JTextComponent derives two components JTextField and

a. JComboBox b. JTextArea c. JSlider d. All of the above

  1. In swing class hierarchy the class present at the root is

a. Component b. Window c. Container

c. JButton d. ImageIcon

  1. 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

  1. select the correct option
    1. canvas is a component
    2. scrollpane is a container

a. 1 is true and 2 is false b. 1 is false and 2 is true c. I & 2 both are false d. 1 & 2 both are true

  1. 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

  1. Frame class extends window

a. True b. False

  1. Which is the container class?

a. Window b. Frame c. Dialog d. All of the above

  1. Following is uneditable control

a. Button b. Textfield c. Label d. List

  1. Jpanel and Applet use as their default layout.

a. Flowlayout b. Gridlayout c. Border layout d. Gridbag layout

  1. MVC stands for

a. Model version control b. Model view controller c. Mini view controller d. Major view controller

  1. MVC architecture is used by swing

a. True b. False

  1. In swing _ gives the visual representation of the component.

a. Model b. View

a. Table b. Tabbed pane c. Both a & b d. None of these

  1. Double-buffering built in, tool tips, dockable tool bars, keyboard accelerators, custom cursors, etc. are new features of

Ans – Swing

  1. for using Swing control one must import package.

Ans - import javax.swing.*

  1. getContentPane() method of which class

Ans – Japplet

  1. How To Apply Image To Button?

a. ImageInsert Class b. ImageIcon class c. PutImage class d. None of these

  1. In FlowLayout manager the default space between each component is

Ans – 5 pixels

  1. In Swing, tables are implemented by the class

a. Table b. JTable c. YTable d. All of these

  1. Items are added in JComboBox using method......

a. addItem() b. getItem() c. both a & b d. none of these

  1. JApplet class is Derived form

Ans – Applet

  1. JRadioButton is a subclass of _.

a. AbstractButton b. RadioButton c. CheckBoxItem d. None of these

  1. In which package JTabbedPane class is present?

a. Java.awt b. Java.swing c. Javax.swing d. None of these

  1. In which package JTree class is present?

a. Java.awt b. Java.swing c. Javax.swing d. None of these

  1. Which method is used for getting the language in internationalization?

a. getDisplayLanguage()

b. GetdisplayLanguage()

c. GetDisplayLanguage()

a. SwingFrame b. Frame c. Window d. None of these

  1. What is the name of the Swing class that is used for frames?

a. SwingFrame b. Frame c. Window d. JFrame

  1. Plugable Look & Feel is the feature of

Ans – Swing

  1. setBorder() method is used to set a border for

Ans – Jcomponent

  1. Swing components are

a. Light weight b. Platform independent c. Both a & b d. None of these

  1. In each component renders itself using the drawing primitives of the Graphics object.

a. AWT b. Swing c. Both a & b d. None of these

  1. There is a debugging support for rendering of created swing components.

a. True b. False

  1. Choose the correct statement.

a. AWT supports limited number of GUI components b. The AWT component is converted by the native code of the operating system. c. Swings components can have tooltip placed over them. d. All of these

  1. The swing is a light weight component because

Ans – it is the responsibility of JVM to invoke the native methods.

  1. JRadioButton is a sub-class of _

a. JCheckBox b. JToggleButton c. Both a & b d. None of these

  1. In swing how many ways to define a frame.

a. 3 b. 1 c. 2 d. 4

  1. The method sets the foreground color to yellow in Jframe.

Ans - f.setForeground (Color.YELLOW)

  1. The method creates a IconImage for file c:\image\us.gif

Ans - new ImageIcon("c:\image\us.gif");

  1. Which component displays information in hierarchical manner with parent- child relationship?

a) JFrame b) JTree c) JComboBox d) JTable

  1. Which component in swing represents data in rows and columns?

a) JFrame b) JTree c) JComboBox d) JTable

  1. Which components are needed to get following shown output

a) Label , TextField b) Label , Checkbox c) Both a & b d) None of these

  1. Which is Controll in swing a combination of a text field and a dropdown list

Ans – JcomboBox

  1. Which is default layout Manager for Japplet?

a) FlowLayout b) BorderLayout c) GridLayout d) CardLayout

  1. Which method is used to add tabs to a JTabbedPane?

a) addTab b) insertTab c) putTab d) none of these

  1. Which method is used to close a swing frame?

a) setDefaultCloseOperation() b) setCloseOperation() c) closeFrame() d) none of these

  1. Which of the following are not swing component?

a) JTree b) JComboBox c) iframe d) JTable

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

a) JMenuBar b) Canvas c) JCheckBox d) JTree

  1. In progress bar which method is used to determine whether the string should be displayed?

a) Void SetStringPainted(Boolean status) b) Void setStringColored(Boolean status) c) Void setValue(int) d) Void setString(string s)

  1. Which type of data is passed as a parameter to SetStringPainted() method?

Ans – Boolean

  1. Which method is used to set the value of the progress bar?

a) Void SetStringPainted(Boolean status) b) Void setStringColored(Boolean status) c) Void setValue(int value) d) Void setString(string s)

  1. In progress bar which method is useful in displaying the data after periodic interval?

Ans – Thread.sleep(1000);

  1. MVC stands for

a) Model view center b) Medium view controller c) Model View Controller d) None of these

  1. In MVC which component manages the state and conducts all transformations on that state?

a) Model b) View

c) Controller d) None of these

  1. In MVC which component manages the visual display of the staterepresented by the model?

a) Model b) View c) Controller d) None of these

  1. In MVC which component managing the user interaction with the model?

a) Model b) View c) Controller d) None of these