Professional Documents
Culture Documents
Exam DIS&JAN 2014
Exam DIS&JAN 2014
Exam DIS&JAN 2014
UNIVERSITI
crU* KEBANGSAAN
06 MALAYSIA
4
The National University
of Malaysia
PEPERIKSAAN AKHIR
SEMESTER I SESI AKADEMIK 2013-2014
IJAZAH SARJANAMUDA DENGAN ICEPUJIAN
Kertas soalan ini mengandungi 9 muka surat bercetak, tidak termasuk muka surat ini
(5 marks)
1
TTTK2934
ii. Explain how the method vault ( string ) relates to object creation.
(2 marks)
Figure 1
2
TTTK2934
}
Referring to the class definition, state whether each of the following
statements is true or false. Give an explanation if it is false.
i. An inheritance relationship exists between classes MyApplet and
JApplet.
ii. The statement at Line 4 is valid if the Car class is a descendant of the
Vehicle class.
iii. The instance variable current at Line 16 contains a reference to a
C ar object.
iv. After a MyApplet object executes the init method, its instance
variable current contains a reference to a Vehicle object.
v. The start method in the class definition overrides one of the methods
inherited from JApplet.
vi. The MyApplet class has no constructors.
(8 marks)
3
TTTK2934
Define one relevant attribute for every class listed above based on the
description of a photo journal given earlier.
(2 marks)
4
TTTK2934
class PhotoJournal f
private static int maxPages = 20;
private Page[] pages = new Page[maxPages];
(3 marks)
3. a. Name a Java Swing component that best fits each of the following
description:
i. A component that looks like a button and that, when pressed, brings up
a menu of items for the user to choose from.
ii. A component that displays text, but that does not react to user clicks.
iii. A component that allow user to select a value from a range of values.
(3 marks)
b. Name the most suitable layout manager to display the following interfaces.
i.
r
t451 L. ,K;zZi
2 3
1 3
5
TTTK2934
} Layout
2 3
ggioreigeweelerearseenetrassasemexamenerammore
(2 marks)
i. A group of three radio buttons with the label rain, sunshine and
rainbow.
ii. A JList component with items PCC, Imagine Cup, Robot Soccer,
Media Creative and CESMED.
(5 marks)
TITLE
Subtitle
Large Box
Figure 2
(5 marks)
6
TTTK2934
Course Registration
Millillialli - t MEMO'
Fakulti Teknologi dan Sains Maklumat
Bachelor of Computer Science Programme
TK1114 Computer Programming TR1333 Discrete Mathematics TR1713 Statistics and Probability
TT1064 Database TK2324 Object Oriented Programming TT2013 System Thinking and Philoso...
TT3013 Computer, Ethics and Social TK3043 Algonthm Design and Analysis TK4086 Project
Figure 3
(10 marks)
4. a. Name suitable Java Swing components that can be used with each of the
following Listener class:
(4 marks)
7
TTTK2934
b. Event handling has three main components namely events, event source and
listeners. Describe how events are handled in Java programs.
(4 marks)
Draw Something consists of two section which is the drawing section and the
word guessing section. Figure 4 below shows the word guessing section. The
picture to guess is shown on the upper part of the interface (Box A). At the
lower part of the interface (Box B), the guesser is given a number of blank
spaces representing the number of letters in the word, and a selection of
scrambled letters, which include all the letters of the word plus some more
letters which are not in the word. The guesser gets unlimited tries and time to
use these letters and attempt enter the guess word.
W DrawSomething,
B
1353121
El NI1311113
Figure 4
i. Define all the Java Swing components most suitable used in Box B.
(7 marks)
8
TTTK2934
d. Extend the program in (c) to handle the user interaction. When the
guesser choosed a correct letter, the letter will be deleted and
displayed in the correct blank space. When all letters are correctly
guessed, your program should display the message "CORRECT"
as in Figure 5.
(10 marks)
Figure 5