🎧 New: AI-Generated Podcasts Turn your study notes into engaging audio conversations. Learn more

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Document Details

AdulatoryMeitnerium

Uploaded by AdulatoryMeitnerium

MIT World Peace University

Tags

Java Swing GUI programming computer science

Full Transcript

ASSIGNMENT NO. 2 Course Title: AJP Course Code: 22517 Name: Roll No.: 1. In which package Swing components are defined? a) javax.applet.swing b) javax.swing c) java.javax.swing...

ASSIGNMENT NO. 2 Course Title: AJP Course Code: 22517 Name: Roll No.: 1. In which package Swing components are defined? a) javax.applet.swing b) javax.swing c) java.javax.swing d) javax.java.swing 2. The super class of all swing buttons is – a) Button b) ButtonGroup c) JButton d) AbstractButton 3. Which of the following alignment is not possible for JLabel? a) TOP b) LEFT c) CENTER d) LEADING 4. Alignment constants of JLabel are the part of – a) SwingConstants interface b) SwingConstants class c) Swing class d) Graphics class 5. How will you set icon for the Jlabel? a) Using Icon class directly b) Using setIcon( ) method c) Using makeIcon( ) method d) It is not possible to set icon for JLabel 6. Swing‟s text field is encapsulated by – a) Component class b) JComponent class c) Container class d) JTextComponent class 7. How to give number of columns for JTextField? a) Use setColumns( ) method b) Use the value directly in the constructor c) Using applyColumn( ) method. d) We have to use JTextArea class 8. What is the return type of getText( ) method of JButton class? a) void b) String c) Character array d) There is no such method 9. How will you assign the string and icon both to the JButton? a) It is not possible b) Use the setTextIcon( ) method c) Use the setIconText( ) method d) Intialize them directly in the constructor 10. Which event is generated when a JButton is pushed? a) ItemEvent b) TextEvent c) PushEvent d) ActionEvent 11. Immediate super class of JCheckBox is – a) JComponent b) JApplet c) JCkeckBoxGroup d) JToggleButton 12. The constructor JCheckBox(true, “YES”) suggests that – a) Checkbox is selected and displays the string “YES” on it. b) Checkbox is deselected and displays the string “YES” on it. c) Checkbox is selected and it shows the tick always on it. d) There is no such constructor. 13. When JCheckBox is clicked the event is generated. a) ItemEvent b) ActionEvent c) TextEvent d) MouseEvent 14. How can we create Radio buttons? a) Using ButtonGroup class b) Using JCheckboxGroup class c) Using JRadioButton class d) Using JButton class 15. How to make the group of Radio buttons? a) Using ButtonGroup class b) Using JButtonGroup class c) Using JRadioButton d) Using AbstractButton class 16. How to contents of whole vector into the JComboBox? a) Use the constructor of JComboBox b) Use method addItem( ) c) Use method addVector( ) d) Use method addValues( ) 17. How to prevent the drop-down list of JComboBox? a) It is not possible b) We can use method preventDropMenu( ) method c) Directly give the value „false‟ in the constructor d) Use setList( ) method. 18. Which method is used to define the tabs in the tabbed pane? a) add( ) b) addItem( ) c) addPane( ) d) addTab( ) 19. The scroll bar constants for scroll pane are defined in – a) Scrollbar class b) ScrollPane class c) ScrollPaneConstants class d) Component class 20. Which of the following constants shows scroll bars always? a) HORIZONTAL_SCROLLBAR_ALWAYS b) HORIZONTAL_SCROLLBAR_AS_NEEDED c) HORIZONTAL_SCROLLBARS d) HORIZONTAL_ALWAYS 21. JScrollPane is an immediate sub-class of – a) JContainer b) JApplet c) JComponent d) ScrollPane 22. Is it possible to add array of objects to trees? How? a) Not possible b) Yes, using its one of the forms of constructor c) Yes, using the add( ) method d) Yes, using the addItem( ) method 23. Which items we can‟t directly add to JTree using its constructor? a) Array of objects b) Vector c) Hash table d) Arrays 24. When tree is expanded, which event is generated? a) ExpansionEvent b) TreeExpansionEvent c) ItemEvent d) ActionEvent 25. Which method is used to translate a mouse click on a specific point of the tree to a tree path? a) translatePoint( ) b) getLocation( ) c) getPathForLocation( ) d) getPath( ) 26. The TreeNode is – a) A class b) An interface c) A variable d) Nothing 27. The TreeExpansionEvent class is defined in – a) java.awt package b) javax.swing package c) java.awt.event package d) javax.swing.event package 28. TreeExpansionListener interface provides following method – a) getExpanded( ) b) treeExpanded( ) c) expanded( ) d) None of the above 29. How to create for Vector elements? a) Pass vector as parameter for JTree b) Use method addElements( ) for JTree class. c) Use method addVector( ) method of JComponent class d) It is not possible 30. Which two parameters are required for JTree constructor to create a tree? a) Data array and Row Headings b) Data array and Column Headings c) Single data element and Column heading d) Single data element and Row heading 31. What is default layout for Dialog? a) FlowLayout b) GridLayout c) CardLayout d) BorderLayout 32. Which method is used to count the number of items is the List. a) getItem( ) b) getSelectedItem( ) c) getItemCount( ) d) getCount( ) 33. Which class is used to represent a single line textbox with password character facility? a) TextField b) TextArea c) Label d) Checkbox 34. To set the title to the Frame window method is used. a) void setTitle(String str) b) void setText(String str) c) void settitle(String str) d) None of the above 35. Panel is defined as. a) Panel class is a concrete subclass of container b) A Panel is a window that does not contain a title bar, menu bar or border c) Panel is the superclass of Applet d) All of above 36. The getContentPane() method is of which class? a) JApplet b) JFrame c) JButton d) None of these 37. A is a passive AWT control that do not generate any event? a) Button b) RadioButton c) Choice d) Label 38. Which of the following architecture does the Swing framework use? a) MVC b) MVP c) Layered architecture d) Master-Slave architecture 39. Which language is used in the swing framework? a) JavaScript b) Java c) React d) Python 40. MVC architecture is a) Modelling Visual Controller b) Model View Controller c) Model Viewable Controller d) Many View Controller 41. JTree class belongs to which package? a) java.awt b) java.applet c) java.swing d) javax.swing 42. Which component is swing represents data in row and columns? a) JTextArea b) JTable c) JPanel d) JtabbedPane 43. Which of the following is not constructor of JTree? a) JTree(TreeNode tn) b) JTree(Vector v) c) JTree(int x) d) none of the above 44. class used to create node in tree. a) TreeNode b) DefaultMutableNode c) DefaultMutableTreeNode d) Node 45. What is purpose of JTree? a) To show data in form of parent and child nodes. b) To show data in list view. c) To show data in tabular form. d) To show data in menubar 46. Which of the following component gives a drop-down list of options from which to choose? a) JPanel b) JButton c) ComboBox d) JBox 47. The ____ class serves as the foundation for all Swing components. a) JButton b) JComponent c) JTextField d) JLabel 48. Which is Swing framework component that offers a scroll bar that may be used to scroll content in a container. a) JScrollPanel b) JScrollBox c) JScroll d) JScrollBar 49. Which is a container that provides a viewport for showing a piece of a bigger component. a) JScrollPanel b) B.JScrollBox c) JScroll d) JScrollPane 50. Which is the Swing check box class a) JCheckbox b) JSCheckbox c) JCheckBox d) None 51. Which class encapsulates a mutually exclusive set of buttons. a) MutualButtonGroup b) ButtonGroup c) JButtonGroup d) ButtonsGroup 52. Which class encapsulates a Swing combo box. a) JCombobox b) jCombobox c) JComboBox d) None 53. Super Class For Swing Buttons. a) AbstractButton b) Button c) Jbutton d) None 54. The method used to add components to a Container a) add() b) Insert() c) addComponent d) InsertComponent 55. Which class Encapsulates a scrollable window in Swing a) JScrollableWindow b) JScrolllablewindow c) JscrollableWindow d) JScrollPane 56. Which class encapsulates a tabbed window. a) JTabbedWindow b) JTabbedWindow c) JtabbedWindow d) None 57. Items are added to the JComboBox using which method a) add() b) addItem() c) addOption() d) none 58. For using JTree one has to import javax.swing.tree seperately as only javax.swing.* does not works a) True b) Partially True c) False d) Partially False 59. Class which Encapsulates a table-based control a) JControlTable b) JTable c) JcontrolTable d) JControltable 60. For a JComboBox Constructor which can be the arguments passed a) Array b) Vector c) Both d) None

Use Quizgecko on...
Browser
Browser