Jvdesktop3
Java I/O and Swing Components Quiz
Test your knowledge on Java I/O Streams and Swing components through this comprehensive quiz! It covers various topics related to input/output operations, GUI components, layouts, and design principles.
Whether you're a beginner wanting to learn Java or an experienced developer looking to refresh your skills, this quiz is for you. Key features include:
- 52 thought-provoking questions
- Diverse topics within Java programming
- Immediate feedback on your answers
An I/O Stream represents an input source or an output destination. A stream can represent...
A disk file.
A string of characters.
Data from network.
All of the other choices.
Another program
The java.io.ObjectInputStream class is a subclass of the ...class.
Java.io.Stream
Java.io.InputStream
Java.io.Object
Java.io.ObjectInput
Java.io.ByteSream
Select a correct statement.
DataInputStream, DataOutputStream are binary streams.
PrintWriter, BufferedReader are not binary streams.
ObjectInputStream, ObjectOutputStream are not text streams.
All of the others.
When reading objects from an object stream,
We usually use an explicit casting.
The compiler automatically identifies the class of the object.
The compiler will automatically use a conversion.
No casting is needed.
Select correct statement(s). (1) All byte stream classes are descended from the InputStream and OutputStream classes . (2) All character stream classes are descended from the Reader and Writer classes . (3) All byte stream classes are descended from the Reader and Writer classes . (4) All character stream classes are descended from the InputStream and OutputStream classes .
1, 4
1, 2
2, 3
None of the others.
To read data from a text file using the line-by-line accessing. The right order of object creations is:
File – BufferedReader
File – FileInputStream
File – BufferedReader - FileReader
File – FileReader - BufferedReader
File – FileReader
To write objects to an object file. The right order of object creations is:
FileOutputStream- ObjectOutputStream
File – ObjectOutputStream – FileOutputStream
File - ObjectOutputStream- Writer
FileReader – ObjectOutputStream
None of the others
Which method do you use to enable or disable components such as JButtons?
Enable()
Disable()
Editable()
SetEditable()
None of the others
A component that lets the user pick a color.
JColorPicker
JColorChooser
JColorSelector
JColorMaker
JColorMixer
The container has one component that should take up as much space as possible. Which layouts that easily deal with this situation should be selected?
FlowLayout
CardLayout
Null Layout
GridLayout
GridBagLayout
Which component can display an image, but cannot get focus?
JLabel
JTextField
JButton
JListBox
JPasswordField
Select correct statement(s). (1) Swing is part of the Java Foundation Classes and provides a rich set of GUI components. (2) Before you think about what your GUI will look like , it’s important to think about what it will.
1
2
1, 2
None of the others.
Select correct statement(s). (1) The Swing's list component (JList) can display text only. (2) The Swing’s button (JButton) can not contain an image. (3) The Swing’s label (JLabel) can present an image.
2, 3
3
1, 3
1
None of the others
Which of the following layout manager will present components with the same size.
Java.awt.GridLayout
Java.awt.FlowLayout
Java.awt.CardLayout
Java.awt.BorderLayout
None of the others
Select correct statement(s). (1) 12 buttons can not be added to a container which is assigned to a grid layout 2x5. (2) If 2 components are added to the center region of a border-layout container, they will be seen by user as side-by-side components.
1
2
2, 1
None of the others.
Which is four-step approach to help you organize your GUI thinking. (Choose one.)
Identify needed components. Isolate regions of behavior. Sketch the GUI. Choose layout managers
Choose layout managers. Identify needed components. Isolate regions of behavior. Sketch the GUI.
Identify needed components. Choose layout managers. Isolate regions of behavior. Sketch the GUI.
None of the others
The Swing component classes can be found in the ________________ package
Javax.swing
Java.swing
Javax.swings
Javax.Swing
A _____ dialog prevents user input to other windows in the application unitl the dialog is closed.
Non-Modal
Unmodel
Modal
None of the others.
The border layout resizes the ______ components to fill the remaining centre space.
West
South
Center
East
Middle
The container can display three completely different components at different times, depending perhaps on user input or program state. Even if the components’ sizes differ, switching from one component to the next shouldn’t change the amount of space devoted to the component.
GridLayout
FlowLayout
GridBagLayout
CardLayout
Select incorrect statement about FlowLayout. (choose 1)
The Flow layout manager always honors a component’s preferred size.
The Flow layout manager arranges components in horizontal rows.
It is the default layout manager type for JFrame.
The Flow layout manager fits as many components as possible into the top row and spills the remainder into a second row. The components always appear, left to right, in the order they were added to their container.
In a complex GUI containing a lot of components and user must be select some data in a group of specific data, the component should be used is .......
Combo box
A panel containing some checkboxes.
A list box
A panel containing some radio-buttons.
One of the others.
We can replace a card layout of a container with ..........
Tabbed pane
Flow layout
Border layout
Grid layout
Select an incorrect statement.
A node on a javax.swing.JTree object can be a view of an arbitrary object.
A cell in a javax.swing.JTable object can be a view of an arbitrary object.
We should wrap some radiobuttons in a button group.
A combobox can contain strings only.
In Swing, what is the role of the component’s model?
It is responsible for the region of the screen dedicated to show something to the user
It is responsible for the data that the component presents to the users.
It is responsible for taking in user request and then modifies those requests.
It is a model component that we can base on that to create a similar component.
Suppose that we have a combobox that contains a list of data. The combobox can only display to the user one item at a time. In term of Model-View-Controller, which of the following statement is correct?
The list of data of the combobox can be considered as a representative of the View.
The list of data of the combobox can be considered as a representative of the Model.
The list of data of the combobox can be considered as a representative of the Controller.
Which of the following statements is correct about Flow layout?
The Flow layout arranges frames in horizontal rows.
The Flow layout arranges frames in vertical columns.
The Flow layout arranges components in horizontal rows.
The Flow layout arranges components in vertical columns.
Which of the following statement is correct about Card layout?
Card layout arranges each component as a card.
Card layout arranges component by dividing frame into spaces called card.
Card layout arranges components in squares.
Card layout arranges components in time rather than in space.
Which method do you use to enable and disable components such as JButton s?
SetEnable
Enable
Activate
SetActive
None of the others.
A component that lets the user pick a color.
V
Color chooser
Color selector
Color dialog
The container has one component that should take up as much space as possible. Which layouts that easily deal with this situation should be selected?
GridLayout
BorderLayout
FlowLayout
BorderLayout or GridLayout
CardLayout
The container has a row of components that should all be displayed at the same size, filling the container’s entire area. Which layout is the best choice for this purpose?
CardLayout
GridLayout
FlowLayout
BorderLayout
A component that displays an icon, but that doesn’t react to user clicks
Label
Button
Textfield
Listbox
Combobox
In JTree control, which of the following classes represents for one node?
DefaultTreeNode
DefaultMutableNode
MutableTreeNode
DefaultMutableTreeNode
Which of the following layout managers will make all its components the same size?
GridLayout
CardLayout
BorderLayout
GridBagLayout
You are required to build a GUI application. The application has a main window which displays: - A tool bar at the top - A status bar at the bottom - A menu on the left - An information table on the right - A news board at the middle of the window Which of the following layout managers would you choose to achieve the above tasks?
CardLayout
BorderLayout
GridLayout
FlowLayout
Suppose that the layout of the frame f is BorderLayout. Study the following statement: g.getContentPane().add ( new JButton(“B”)); The button B will be let at the …. Region of the frame.
East
West
North
South
None of the others.
Suppose you are building an application that connects to the database to store and retreive data. Your application is built based on Model-View-Controller pattern. Which of the following components is responsible for connecting to the database?
Model.
View.
Controller.
None of the others.
Which of the following options is a method that you need to override when implementing the ActionListener interface?
Action()
PerformAction()
Perform()
ActionPerformed()
You are building a table model class that extends the AbstractTableModel class. Which of the following methods is not required to re-implement?
GetRowCount()
GetColumnCount()
GetColumnName()
GetValueAt()
Which of the following statements is not correct about JTree control?
Every tree has a root node from which all nodes descend.
Leaf nodes are those that can have children.
Branch nodes are those that can have children.
Which method do you use to force the prompt to a textfield ?
Textfield.requestFocus()
Textfield.setEnable(true)
Textfield.setActive(true)
Textfield.activate()
None of the others.
A swing container that groups some common components in a complex GUI.
JFrame
JTable
JPanel
JSliptPane
To make the background color of a label different with the color of its container, we need to use the ….. Method of the JLabel class first.
SetBackground(color)
SetFloating(…)
SetDifferent(…)
SetOpaque(true)
The default layout manager used by JPanel is:
BorderLayout
GridLayout
None of the others
FlowLayout
Which of the following layout classes is in java.awt package?
Flow Layout
Grid Layout
Border Layout
All of the others
Which of the following layout managers arranges components in horizontal rows (left to right in the order they were added to their container), starting new rows if necessary?
Flow Layout
Grid Layout
Border Layout
Gridbag Layout
Which of the following layout managers subdivides its territory into a matrix of rows and columns?
Grid Layout
Flow Layout
Border Layout
Gridbag Layout
RMI applications often comprise two separate programs, a server and a client and they...
Can run in two separate virtual machines
Must run in two separate computers
Must run in the same virtual machine
In RMI implementations, all methods, declared in the remote interface, must throw the ...exception.
Java.lang.Exception
java.rmi.NetworkException
Java.rmi.RmiException
Java.rmi.RemoteException
None of the others.
{"name":"Jvdesktop3", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Test your knowledge on Java I\/O Streams and Swing components through this comprehensive quiz! It covers various topics related to input\/output operations, GUI components, layouts, and design principles.Whether you're a beginner wanting to learn Java or an experienced developer looking to refresh your skills, this quiz is for you. Key features include:52 thought-provoking questionsDiverse topics within Java programmingImmediate feedback on your answers","img":"https:/images/course6.png"}