The questions in this last quiz on Java are on the topics covered in the Swing & RMI section of the site. The table below lists the
lessons, a description of the lesson content and the the quiz question number range.
Click on a lesson in the table to go to that lesson for a refresher on the topics for that lesson.
|Beginning Java Lessons
|Lesson 1 - GUI Concepts||In our first lesson on Swing we look at GUI concepts and the MVC paradigm and how this pattern can help in removing some of the complexity from the disparate parts of a user application.||1 - 5|
|Lesson 2 - AWT/Swing Overview||In this lesson we introduce the Abstract Windowing Toolkit (AWT) and Swing libraries with an overview of those parts of these libraries we are interested in to create our own GUIs within java.||6 - 9|
|Lesson 3 - Swing Containers||In this lesson we look at the |
javax.swing.JFrame top-level container class, adding depth to frames using panes and the
javax.swing.JPanel background container class.
|10 - 15|
|Lesson 4 - Swing Components||In our second lesson on the Collections hierarchy we look at the List interface and three of its concrete implementations.||16 - 20|
|Lesson 5 - Layout Managers||In our final lesson on the Collections hierarchy we look at the Queue interface and its concrete implementation.||21 - 28|
|Lesson 6 - Event Handling||In this lesson we look at how we can intercept user events and action them, which is known as event handling.||29 - 36|
|Lesson 7 - Dialogs||In our final lesson on Swing we look at dialogs and how and when to use them.||37 - 42|
|Lesson 8 - RMI||In our final lesson of the section we look at Remote Method Invocation (RMI) and how we can use it to access methods remotely.||43 - 49|
The quiz below tests your knowledge of the material learnt in the Swing & RMI section of the site.
Question 1 : What is the purpose of the MVC pattern?
- The MVC pattern reduces complexity by separating development into three distinct areas of concern.
Question 2 : In a three tier architecture which tier maps to the Controller area of the MVC pattern?
- In a three tier architecture the Application tier maps to the Controller area of the MVC pattern.
Question 3 : Which part of the MVC pattern maps to the Data tier in a three tier architecture?
- In a three tier architecture the Model maps to the Data tier.
Question 4 : What informs the View of changes in state?
- The Model informs the View of changes in state.
Question 5 : Where are user actions processed?
- User actions are processed by the Controller.
Question 6 : What is the base class for all Swing components except top-level containers?
- The <code>JComponent</code> class is the base class for all Swing components except top-level containers.
Question 7 : Java look and feel files are platform independent?
- Only java <code>look and feel</code> files prefixed with <code>javax.swing.plaf</code> are platform independent, the rest are vendor specific.
Question 8 : The immediate superclass of
- Containers are component that have the capability to contain other components which allows us to group related components together and is the reason why the
JComponent class is derived from
Question 9 : When using Swing we can put any component within another component?
- We do not put top-level containers such as <code>JFrame</code> into other components.
Question 10 : How do we add depth to our frames?
- We add depth to our frames by using panes.
Question 11 : When using panes the layeredPane is mandatory?
- When using panes the layeredPane is used for the menu bar and is optional.
Question 12 : What type is a glassPane?
- A glassPane is of type <code>Component</code>.
Question 13 : It is valid to add panels to other panels?
- It is perfectly valid to add panels to other panels.
Question 14 : What pane would we add a drop-down menu to?
- We would add a drop-down menu to a glassPane.
Question 15 : A frame is always visible when an application starts?
- A frame is hidden when an application starts and we make it visible using <code>setVisible(true)</code>.
Question 16 : What letter are all Swing component classes prefixed with?
- All Swing components classes are prefixed with the letter J.
Question 17 : We can add components directly to the content pane of our frames?
- We can add components directly to the content pane of our frames, via a reference to another pane, or to a panel that is added to the frame.
Question 18 : Which of the following Swing component classes be can set up to accept input?
- The <code>JComboBox</code> class be can set up to accept input which is added to the drop-down list.
Question 19 : The
JTable component should be attached directly to a background component?
- You can attach a <code>JTable</code> directly to a background component but you will lose the table headings so you should always attach the <code>JTable</code>
to a <code>JScrollPane</code> and attach this to the background component.
Question 20 : When would we use a
-We would we use a <code>JRadioButton</code> when we only want to select one of a number of options.
Question 21 : What is the default layout manager for a
- The default layout manager for a <code>JPanel</code> component is <code>FlowLayout</code>.
Question 22 : How many regions does the
BorderLayout layout manager have?
- The <code>BorderLayout</code> layout manager has five regions: NORTH, SOUTH, WEST, EAST and CENTER.
Question 23 : When using the
FlowLayout layout manager components are placed within successive columns within the container?
- When using the <code>FlowLayout</code> layout manager components are placed within successive rows within the container, not columns.
Question 24 : The
GridBagLayout layout manager forces all components to be the same size?
- When using the <code>GridBagLayout</code> layout manager components can vary in size, unlike <code>GridLayout</code> where all components are forced to be the same size.
Question 25 : What is the default layout manager for a
- The default layout manager for a <code>JFrame</code> is <code>BorderLayout</code>.
Question 26 : The layout manager of choice for arranging components vertically and one-per-line is
- The <code>BoxLayout</code> layout manager is the best choice for aranging components vertically and one-per-line.
Question 27 : Which layout manager has a separate constraints object giving us complete control of component positioning?
- The <code>GridBagLayout</code> layout manager has a <code>GridBagConstraints</code> object for component positioning.
Question 28 : Components using the
BorderLayout layout manager generally get their preferred size?
- Components using the <em>BorderLayout</em> layout manager don't generally get their preferred size.
Question 29 : How are events passed to the JVM?
- Events are initially intercepted by the operating system which then passes them to the JVM.
Question 30 : How can we tell when a user event happens?
- We can tell when a <em>user event</em> happens by setting an appropriate listener on the component in question.
Question 31 : Which class do all GUI related events derive from?
- All GUI related events derive from the <code>AWTEvent</code> class.
Question 32 : Which of these components would we register with
- We would register the <code>JScrollBar</code> component with <code>addAdjustmentListener</code>.
Question 33 : What type of listener interface would we use for menu type components?
- We would use the <code>ItemListener</code> listener interface for menu type components.
Question 34 : What gets invoked when we add a listener to a component and the event is invoked?
- When we add a listener to a component (register it) and the event is triggered, the implemented method of the registered class is invoked.
Question 35 : We can only add one listener interface of each type per class?
- Yes we can only add one listener interface of each type per class as we need to implement the listener methods and we can not have duplicate methods in the same class or the compile fails.
Question 36 : If we have several action type components within a class then only one of these can have listeners?
- All the action type components can have listeners but it will be the same listener for all of them unless you make several listeners using inner classes.
Question 37 : Which type of dialog restricts access to other parts of an application until actioned?
- Modal dialogs restrict access to other parts of an application until actioned.
Question 38 : Which type of dialog should we use when we want the user to input something?
- When we want the user to input something we should use a modal dialog.
Question 39 : We can switch between non-modal and modal dialog modes after a dialog has been created?
- Yes we can switch between non-modal and modal dialog modes by using the <code>setModal()</code> method.
Question 40 : All
JContentPane dialogs are modal?
- yes, all <code>JContentPane</code> dialogs are modal.
Question 41 : When using
JContentPane dialogs a parent frame has to exist to anchor and position our dialog to?
- We can set the parent frame to <code>null</code> if one doesn't exist and in this case the dialog will be anchored amd positioned centrally.
Question 42 : We can call a dialog from another dialog?
- A dialog can have a dialog as a parent so we can call a dialog from a dialog.
Question 43 : Which mechanism within Java do we use to compact data for transferral. ?
- Within Java the mechanism we use to compact data for transferral is known as Serialization.
Question 44 : What happens with references to other objects, within objects being serialized?
- Other objects, within objects being serialized also get serialized to create a complete object graph.
Question 45 : All members of a class get serialized?
- Non-static and transient members of a class are not serialized.
Question 46 : How is remote object communication achieved in RMI?
- Remote object communication is achieved in RMI using object stubs.
Question 47 : Which transfer protocol is used to pass data across the network when we are doing Java-to-Java communication?
- We use the RMI-JRMP transfer protocol to pass data across the network when we are doing Java-to-Java communication.
Question 48 : On which side of the network do we have to use the
- We have to use the
rmic tool on the server side of the network to create a stub of our implementation class. On the client side the stub is created automatically in java and newer.
Question 49 : What do we need to start in RMI to store and retrieve remote object references?
- We use the registry to store and retrieve remote object references in RMI.
Quiz Progress Bar Please select an answer
That's it for the Java Quizzes; in the next quiz we test knowledge learned in the HTML Basics lessons.