290 likes | 422 Vues
Test Postmortem. Dennis Burford dburford@cs.uct.ac.za. Question 1a. Draw a component hierarchy for the following Java application. [5]. Question 1a. JFrame (with its own content pane). J Panel. J Panel. J Panel. J Button. J Panel. J Panel. J Button. J Button. JLabel. JTextField.
E N D
Test Postmortem Dennis Burford dburford@cs.uct.ac.za
Question 1a • Draw a component hierarchy for the following Java application. [5]
Question 1a JFrame (with its own content pane) JPanel JPanel JPanel JButton JPanel JPanel JButton JButton JLabel JTextField JLabel JTextField
Question 1b • Name any three of the Layout Managers in Java. [3]
Question 1b • Name any three of the Layout Managers in Java. [3] BorderLayout GridLayout FlowLayout GridBagLayout BoxLayout
Question 1c • Give a statement in Java to set the Layout of myPanel to any Layout Manager. [2] JPanel myPanel = new JPanel();
Question 1c • Give a statement in Java to set the Layout of myPanel to any Layout Manager. [2] JPanel myPanel = new JPanel(); myPanel.setLayout( new BorderLayout() );
Question 2a • You are writing a Swing application and want the program to print out the message “Ouch!” every time you press a button. Show how you would do this for the following button: [4] JButton button = new JButton(“Press Me”);
Question 2a button.addActionListener( new ActionListener() { public void actionPerformed( ActionEvent e ) { System.out.println(“Ouch!”); } } );
Question 2b • Indicate what type of Listener is used for each of the following components: [2] i. JTextfield ii. JSlider
Question 2b • Indicate what type of Listener is used for each of the following components: [2] i. JTextfield ActionListener ii. JSlider ChangeListener
Question 2c • What is the difference between a Listener and an Adapter in Java? [2]
Question 2c • What is the difference between a Listener and an Adapter in Java? [2] A Listener is an interface (have to implement methods). An Adapter implements a Listener interface using empty methods.
Question 3a • Name the five stages of the traditional Software Lifecycle. [5]
Question 3a • Name the five stages of the traditional Software Lifecycle. [5] 1. Specification 2. Design 3. Implementation 4. Testing 5. Maintenance
Question 3b • Give two constraints you would consider when planning a software project. [2]
Question 3b • Give two constraints you would consider when planning a software project. [2] Time, Money, Equipment, People,….
Question 4a • What is the difference between a Milestone and a Deliverable? [2]
Question 4a • What is the difference between a Milestone and a Deliverable? [2] A Milestone is the end of a distinct stage. A deliverable is a milestone with tangible results that are delivered to the client.
Question 4b • Name two commonly used techniques for documenting/illustrating a project schedule. [2]
Question 4b • Name two commonly used techniques for documenting/illustrating a project schedule. [2] 1. Table of Tasks 2. Gantt Chart
Question 4c • Give an example of a common project pitfall (be sure to say what the problem is, rather than just giving a name). [1]
Question 4c • Give an example of a common project pitfall (be sure to say what the problem is, rather than just giving a name). [1] One person taking all the responsibility for the project and doing all the work. (many others….)
Question 5a • What are the two forms that an IP address can take? Give an example of each (they do not have to be real addresses). [2]
Question 5a • What are the two forms that an IP address can take? Give an example of each (they do not have to be real addresses). [2] 1. DNS Form: casper2.cs.uct.ac.za 2. Dotted Quad Form: 137.158.128.58
Question 5b • What two things together identify a program offering a service on a machine? [2]
Question 5b • What two things together identify a program offering a service on a machine? [2] 1. IP Address 2. Port Number
Question 5c • Give an example of a type of Internet application that uses the Client-Server model. [1]
Question 5c • Give an example of a type of Internet application that uses the Client-Server model. [1] email, web browser, irc, telnet, ftp, ….