Вы находитесь на странице: 1из 11

SULIT Arahan : Sila jawab EMPAT (4) soalan daripada ENAM (6) soalan.

Instruction: Answer FOUR (4) questions from SIX (6) questions.

F5105

SOALAN 1 a. Berikan tiga(3) perbezaan di antara Applet dan Application. b. Lengkapkan gambarajah kitar hayat applet di bawah : (6 markah) (4 markah)

init()

i)

start()

Applet Starts ii) iii)

start() Applet Destroyed iv)

c. Diberi dua(2) fail iaitu AppletQue.java dan fail html baginya iaitu AppletQue.html. Terangkan 2 kaedah untuk memaparkan applet di atas dan arahan yang perlu ditaip. (4 markah) d. Tuliskan satu aturcara applet yang boleh memaparkan output pada kedudukan yang diberi seperti di bawah :
0,0 20 40 60 80

(11 markah)

20

40

60

80

SULIT

F5105

QUESTION 1

a. Give three(3) differences between Applet and Application b. Complete the life cycle of an applet diagram below :

(6 marks) (4 marks)

init()

i)

start()

Applet Starts ii) iii)

start() Applet Destroyed iv)

c. Given two(2) files which are AppletQue.java and its html file, AppletQue.html. Describe 2 methods to display the above applet and write down the instructions. (4 marks) a) Write a program to display an applet with the following output at the given location:
0,0 20 40 60 80

(11 marks)

20

40

60

80

SULIT SOALAN 2

F5105

a. Bezakan dua(2) jenis applet di bawah : i. Local applet ii. Remote applet

(3 markah)

b. Hasilkan satu atucara applet mudah yang boleh memaparkan hasiltambah dan hasiltolak 2 nilai integer seperti di bawah : (8 markah)

c. Nyatakan makna bagi akronim AWT.

(1 Markah)

d. Terangkan tiga(3) komponen AWT di bawah : i. Container ii. Interface Component iii. Window Construction

(6 markah)

e. Tuliskan aturcara yang memaparkan tetingkap frame dengan ciri-ciri di bawah: i. Set tajuk kepada Soalan 2 ii. Set saiz kepada 200 x 400 iii. Set visible kepada benar (7 Markah)

SULIT QUESTION 2 a. Differentiate two(2) types of applet below i. Local applet ii. Remote applet

F5105

(3 marks)

a) Write a program that display the additional and subtraction of 2 integer values as below : (8 marks)

b. Write the meaning of AWT acronym

(1 Marks)

b) Explain the following three(3) AWT components : (6 marks) i. Container ii. Interface Component iii. Window Construction

c. Write a program that displays a frame with the following criterias : i. Set title to Soalan 2 ii. Set size to 200 x 400 iii. Set visibility to true (7 Marks)

SULIT SOALAN 3 a. Bezakan 3 (tiga) jenis layout di bawah : i. Border Layout ii. Card Layout iii. Grid Layout b. Tuliskan jenis layout yang digunakan secara lalai dalam aturcara java.

F5105

( 6 markah)

( 1 markah)

c. Senaraikan 4 jenis swing control component yang sesuai di letak sebagai antaramuka pengguna untuk menerima 2 nilai integer dan mencetak hasil tambah kedua-dua nilai tersebut. ( 2 markah)

d. Terangkan 3(tiga) langkah yang perlu diikuti dalam merangka antaramuka pengguna.

( 6 markah)

e. Tuliskan aturcara dengan menggunakan layout yang sesuai untuk mendapatkan output seperti diberi di bawah :

( 10 markah)

SULIT

F5105

QUESTION 3 a. Differentiate 3(three) types of layout as stated below: i. Border Layout ii. Card Layout iii. Grid Layout ( 6 marks)

b. Write the type of layout which is used by default in java programming. ( 1 marks)

c. List 4(four) types of swing control component which are suitable to be used as interface to receive 2 integer values and to display the sum of those values.. ( 2 marks)

d. Explain 3(three) steps in drafting user interface..

( 6 marks)

e. Write a program using suitable layout to display an output as shown below

( 10 marks)

SULIT

F5105

SOALAN 4

a. Terangkan secara ringkas berkenaan dengan terma event handling dibawah: i. ii. Event Listener EventHandler (4 markah)

b. Senaraikan tiga(3) contoh event source. (3 markah)

c. Senaraikan tiga(3) kelas Adapter bersama-sama dengan antaramuka Listener kelas tersebut. (3 markah)

d. Tuliskan satu aturcara untuk membangunkan program seperti gambarajah 4.1 di bawah. Apabila butang Calculate ditekan: - sistem akan mengambil input dari pengguna (jejari), - mengira luas permukaan sfera (Formula : ) dan

- memaparkan output pada ruangan teks (Luas permukaan) yang disediakan. Apabila butang Exit ditekan: - program ditamatkan.

Gambarajah 4.1 (15 markah)

SULIT QUESTION 4

F5105

a. Give a brief explanation about term in event handling below: i. ii. Event Listener EventHandler (4 marks)

a. List three(3) examples of event source.. (3 marks)

b. List three(3) Adapter class together with their EventListener Interface. (3 marks)

e. Write full program to develop a system as shown in figure 4.1 below. When Calculate button is clicked: - a system will get input from user (Radius), - calculate an area of sphere (Formula : - display an output in the textfield (Surface Area). When Exit button is clicked: - program terminate ) ) and

Figure 4.1

(15 marks)

SULIT

F5105

SOALAN 5 a. Berikan maksud thread. b. Terangkan tentang kegunaan threads di dalam pengaturcaraan java. (2 Markah)

(4 Markah)

c. Senaraikan tiga(3) metod yang akan menyebabkan sesuatu thread itu akan berhenti seketika. (3Markah)

d. Berikan perbezaan diantara single thread dan multi threads.

(4Markah)

e. Tuliskan satu aturcara yang mempunyai dua threads. Satu thread akan mengira luas sebuah segitiga (formula : x tapak x tinggi). Thread kedua akan mengira luas sebuah bulatan (formula : jejari2 ; =3.142). Paparkan kedua-dua hasil tersebut. (12Markah)

QUESTION 5 a. Define a thread. . b. Explain the uses of threads in java programming. (2 Marks)

(4 Marks)

c. List three(3) methods to blocked a thread. d. Differentiate between single thread and multi threads.

(3Marks)

(4Marks)

e. Write full program to develop two threads. One thread should calculate an area of triangle (formula: x base x height) . the second thread should calculate the area of circle (formula : radius2 ; =3.142). Display both output. . (12Marks) 10

SULIT SOALAN 6

F5105

a. Terangkan secara ringkas kegunaan JDBC di dalam pengaturcaraan java. (2 markah)

b. Jelaskan maksud bagi setiap baris aturcara di bawah: i. Statement st = con.createStatement();


ii. Connection con = DriverManager.getConnection(jdbc:mysql://localhost/DPelajar); iii. Resultset rs= st.executeQuery (select * from Student where name LIKE

%abu%); iv.while (resultSet.next()) System.out.println(rset.getString(name)+ +rset.getString(no_ic)); v. Class.forName(com.mysql.jdbc.Driver); (10 markah)

c. Servlets membolehkan pembangun sistem untuk menambah dynamic content ke dalam pelayan web menggunakan platform Java. Senaraikan empat(4) metod yang digunakan di dalam servlet (4 markah)

d. Huraikan berkenaan terma berikut: i. Servlet Request ii. Servlet Response. (6 markah)

e. Berikan satu(1) contoh tag JSP untuk membuat : i. Description ii. Expression iii. Scriptlet (3 markah)

------------TAMAT-----------------11

SULIT

F5105

QUESTION 6

a. Give brief explanation about JDBC in Java programming. (2 marks) b. Describe each line of code below: i. Statement st = con.createStatement();
ii. Connection con = DriverManager.getConnection(jdbc:mysql://localhost/DPelajar); iii. Resultset rs= st.executeQuery (select * from Student where name LIKE

%abu%); iv.while (resultSet.next()) System.out.println(rset.getString(name)+ +rset.getString(no_ic)); v. Class.forName(com.mysql.jdbc.Driver); (10 marks)

c. Servlets allow a software developer to add dynamic content to a web server using Java platform. List four(4) methods in Servlets. (4 marks) d. Describe about the term below: i. Servlet Request (6 marks)

ii. Servlet Response

e. Give one(1) example for every JSP tag below: i. Description ii. Expression iii. Scriptlet (3 marks)

----------------END--------------------

12

Вам также может понравиться