MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR

Similar documents
INSTRUCTION: This section consists of FOUR (4) questions. Answer ALL questions. ARAHAN: Bahagian ini mengandungi EMPAT (4) soalan. Jawab SEMUA soalan.

INSTRUCTION: This section consists of TWO (2) structured questions. Answer ALL questions.

INSTRUCTION: This section consists of TWO (2) structured questions. Answer ALL questions.

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR

UNIVERSITI MALAYSIA PERLIS. DNT 126 Basic Computer Programming [Asas Pengaturcaraan Komputer]

Pengenalan Sistem Maklumat Dalam Pendidikan

UNIVERSITI SAINS MALAYSIA

UNIVERSITI SAINS MALAYSIA. Peperiksaan Semester Pertama Sidang Akademik 2003/2004. September/Oktober 2003

UNIVERSITI SAINS MALAYSIA. CPT111/CPM111 Principles of Programming [Prinsip Pengaturcaraan]

INSTRUCTION: This section consists of TWO (2) structured questions. Answer ALL questions.

PART A SULIT (EKT 221) BAHAGIAN A. Answer ALL questions. Question 1. a) Briefly explain the concept of Clock Gating.

MAT 181 Programming For Scientific Applications [Pengaturcaraan Untuk Penggunaan Sains]

UNIVERSITI SAINS MALAYSIA. CPT101 Prinsip-Prinsip Pengaturcaraan

COMBINING TABLES. Akademi Audit Negara. CAATs ASAS ACL / 1

EEE 428 SISTEM KOMPUTER

MICROSOFT EXCEL. Membina Hamparan Elektronik Fungsi Hamparan Elektronik

INSTRUCTION: This section consists of TWO (2) structured questions. Answer ALL questions.

UNIVERSITI SAINS MALAYSIA. CMT322/CMM323 Web Engineering & Technologies [Kejuruteraan & Teknologi Web]

MAT 181 Programming For Scientific Applications [Pengaturcaraan Untuk Penggunaan Sains]

UNIVERSITI SAINS MALAYSIA. CPT344 Computer Vision & Image Processing [Penglihatan Komputer & Pemprosesan Imej]

Pengguna akan diberikan Username dan Password oleh Administrator untuk login sebagai admin/conference Manager bagi conference yang akan diadakan.

MAT181 Programming For Scientific Applications [Pengaturcaraan Untuk Penggunaan Sains]

ssk 2023 asas komunikasi dan rangkaian TOPIK 4.0 PENGALAMATAN RANGKAIAN Minggu 11

INSTRUCTION: This section consists of FOUR (4) structured questions. Answer ALL questions.

Lab 4 : Sorting Techniques

EEE 348 PENGANTAR REKABENTUK LITAR BERSEPADU

INSTRUCTION: This section consists of TEN (10) structured questions. Answer ALL questions.

UNIVERSITI SAINS MALAYSIA. CPT211-CPM313 Programming Language Concepts & Paradigm [Konsep & Paradigma Bahasa Pengaturcaraan]

INSTRUCTION: This section consists of TWO (2) short answer and structured essay questions. Answer ALL questions.

INSTRUCTION: This section consists of FOUR (4) structured questions. Answer ALL questions.

MANAGE COURSE RESOURCES LABEL TEXT PAGE URL BOOK FILE FOLDER IMS CONTENT PACKAGE

INSTRUCTION: This section consists of TWO (2) questions. Answer ALL questions. ARAHAN: Bahagian ini mengandungi DUA (2) soalan. Jawab SEMUA soalan.

PANDUAN PENGGUNA (PENTADBIR SYSTEM/SYSTEM ADMINISTRATOR) (INFOTECH, BPPF DAN POLIS

MSS 318 Discrete Mathematics [Matematik Diskret]

TEKNOLOGI, GADJET & KEIBUBAPAAN

INSTRUCTION: This section consists of TWO (2)short answers and TWO (2) structured essays. Answer ALL questions.

...a- JEE ELEKTRONIK DIGIT II. UNlVERSlTl SAINS MALAYSIA. Peperiksaan Semester Kedua Sidang Akademik FebruarVMac 2003.

UNIVERSITI SAINS MALAYSIA. CPT111 Principles of Programming [Prinsip Pengaturcaraan]

LAB 5: WORKING WITH DATA

MAT 181 Programming for Scientific Applications [Pengaturcaraan untuk Penggunaan Sains]

UNIVERSITI SAINS MALAYSIA. CPT113 Programming Methodology & Data Structures [Metodologi Pengaturcaraan & Struktur Data]

UNIVERSITI SAINS MALAYSIA. CST331 Principles of Parallel & Distributed Programming [Prinsip Pengaturcaraan Selari & Teragih]

UNIVERSITI SAINS MALAYSIA. CST131 Computer Organisation [Organisasi Komputer]

CPT211/CPM313 Programming Language Concepts & Paradigms [Konsep & Paradigma Bahasa Pengaturcaraan]

CPT212 Design & Analysis of Algorithms [Reka Bentuk & Analisis Algoritma]

INSTRUCTION: This section consists of TWO (2) questions. Answer ALL questions. ARAHAN: Bahagian ini mengandungi DUA (2) soalan. Jawab SEMUA soalan.

INSTRUCTION: This section consists of TWO (2)structured questions.answer ALL questions.

PANDUAN PENGGUNA (PENSYARAH)

UNIVERSITI SAINS MALAYSIA. CST232 Operating Systems [Sistem Pengendalian]

UNIVERSITI SAINS MALAYSIA. CPT103/ CPM211 Struktur Data & Paradigma Pengaturcaraan

Panduan Pengguna Autodesk Education Community

UNIVERSITI SAINS MALAYSIA. CPT103/CPM211 Struktur Data & Paradigma Pengaturcaraan

UNIVERSITI SAINS MALAYSIA. CCS522 Advanced Data Communication & Computer Networks [Rangkaian Komputer & Komunikasi Data Lanjutan]

MAT 181 Programming For Scientific Applications [Pengaturcaraan Untuk Penggunaan Sains]

UNIVERSITI SAINS MALAYSIA. CST131 Computer Organisation [Organisasi Komputer]

CPT111/CPM111 Principles of Programming [Prinsip Pengaturcaraan]

UNIVERSITI SAINS MALAYSIA. CCS522 Advanced Data Communication and Computer Networks [Rangkaian Komputer dan Komunikasi Data Lanjutan]

INSTRUCTION: This section consists of TWO (2) structured questions. Answer ALL questions.

PANDUAN PENGGUNA (SUPPLIER) MAINTAIN CERTIFICATES/SUPPLIER DETAILS SUPPLIER RELATIONSHIP MANAGEMENT SUPPLY CHAIN MANAGEMENT SYSTEM (SCMS)

PANDUAN PENGGUNA (SUPPLIER) MAINTAIN CERTIFICATES/SUPPLIER DETAILS SUPPLIER RELATIONSHIP MANAGEMENT SUPPLY CHAIN MANAGEMENT SYSTEM (SCMS)

Persekitaran Pengaturcaraan Arduino

INSTRUCTION: This section consists of TWO (2) structured questions. Answer ALL questions.

UNIVERSITI SAINS MALAYSIA. CPT101 Prinsip-Prinsip Pengaturcaraan

Semasa buku ini ditulis XAMPP mengandungi empat versi:

KOLEJ MULTIMEDIA JALAN GURNEY KIRI KUALA LUMPUR

Panduan Menggunakan Autoresponder FreeAutobot.com

UNIVERSITI SAINS MALAYSIA. CST333 Distributed & Grid Computing [Perkomputeran Teragih & Grid]

EEE348 INTRODUCTION TO INTEGRATED CIRCUIT DESIGN (PENGANTAR REKABENTUK LITAR BERSEPADU)

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR

UNIVERSITI MALAYSIA SARAWAK KOTA SAMARAHAN SARAWAK

UNIVERSITI SAINS MALAYSIA. CPT103 Struktur Data & Paradigma Pengaturcaraan

Modul Asas JavaServer Pages

UNIVERSITI SAINS MALAYSIA. CST332 Internet Protocols. Architecture & Routing [Protokol, Seni Bina & Penghalaan Internet]

UNIVERSITI SAINS MALAYSIA. CPT101 Prinsip-Prinsip Pengaturcaraan

Panduan Guru Maker UNO/ Arduino

UNIVERSITI SAINS MALAYSIA. CST331 Principles of Parallel & Distributed Programming [Prinsip Pengaturcaraan Selari & Teragih]

UNIVERSITI MALAYSIA PERLIS. EKT 120 Pengaturcaraan Komputer [Computer Programming]

UNIVERSITI SAINS MALAYSIA. CMT422 Multimedia Information Systems & Management [Sistem & Pengurusan Maklumat Multimedia]

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR

MSS 317 Coding Theory [Teori Pengekodan]

[40 marks] [40 marks] Answer all questions. Jawab semua soalan.

Manual Pengguna. PCN Online Service Fulfillment System

PANDUAN PENGGUNA (SUPPLIER) e-purchase ORDER FOR SERVICES

UNIVERSITI SAINS MALAYSIA. CCS521 Advanced Distributed Systems Concepts and Design [Konsep dan Reka Bentuk Sistem Teragih Maju]

UNIVERSITI SAINS MALAYSIA. CST131 Computer Organisation [Organisasi Komputer]

UNIVERSITI SAINS MALAYSIA. CCS513 Computer Vision and Image Analysis [Penglihatan Komputer dan Analisis Imej]

INSTRUCTION: This section consists of FOUR (4) structured questions. Answer ALL questions.

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR

M2U MANUAL PENGGUNA USER MANUAL M2UNHJ. 0 P a g e BAHAGIAN SIMPANAN DAN PENGELUARAN JABATAN KHIDMAT PENDEPOSIT DAN OPERASI LEMBAGA TABUNG HAJI

UNIVERSITI SAINS MALAYSIA. CST231/CSM331 Data Communications & Networks [Komunikasi Data & Rangkaian]

ISOGEOMETRIC ANALYSIS OF PLANE STRESS STRUCTURE CHUM ZHI XIAN

TS2963 : Pangkalan Data. Nota Makmal. Makmal 4

Visitor Management System

INSTRUCTION: This section consists of FOUR (4) structured questions. Answer ALL questions.

Bahagian A. Jawab semua soalan. Tulis jawapan anda di ruang yang disediakan pada Helaian Jawapan. Setiap jawapan diperuntukkan satu markah.

UNIVERSITI SAINS MALAYSIA. CMT224/CMM221 Multimedia Systems [Sistem Multimedia]

UNIVERSITI SAINS MALAYSIA. CIT502 Pengaturcaraan dan Kejuruteraan Perisian Berorientasi Objek

Analysis SPM of year 2007, 2008, 2009, 2010, 2011, 2012, 2013 (Section B & C)

UNIVERSITI SAINS MALAYSIA. CPT212 Design & Analysis of Algorithms [Reka Bentuk & Analisis Algoritma]

Transcription:

STUDENT IDENTIFICATION NO MULTIMEDIA COLLEGE JALAN GURNEY KIRI 54100 KUALA LUMPUR FIRST TRIMESTER FINAL EXAMINATION, 2013 SESSION PSD2133 INTRODUCTION TO PROGRAMMING 1 DSEW-E-F-1/13, DMTW-E-F-1/12 24 SEPTEMBER 2013 2.00 p.m 5.00 p.m (3 Hours) INSTRUCTION TO STUDENT 1. This Examination paper has TWENTY THREE (23) printed pages. 2. This question paper consists of FOUR (4) sections. Section A : Answer ALL questions. Section B : Answer ALL questions. Section C : Answer ALL questions. Section D : Answer ONE (1) questions ONLY. 3. Please write all your answers in the Answer Booklet provided.

SECTION A : OBJECTIVE QUESTIONS (20 MARKS) BAHAGIAN A : SOALAN OBJEKTIF (20 MARKAH) INSTRUCTION : Answer ALL questions. ARAHAN : Jawab SEMUA soalan. 1. Which of the following reasons are BEST to explain why we should produce good program? Antara sebab-sebab berikut manakah yang TERBAIK untuk menjelaskan mengapa kita perlu menghasilkan program yang baik? I. To make sure that the program is easy to understand Untuk memastikan program adalah mudah untuk difahami. II. It is easy for the programmer to do enhancement or maintenance Memudahkan pengaturcara untuk melakukan peningkatan atau penyenggaraan. III. To make sure that the program is running efficiently on any platform, Untuk memastikan bahawa program berjalan dengan cekap pada mana-mana platform. IV. To make sure that the program is not penetrated by the hackers. Untuk memastikan bahawa program itu tidak ditembusi oleh penggodam. A. I and II B. I, II and III C. I, II, III and IV D. None of the above SFCS Page 2 of 23

2. is a sequence of a finite number of steps arranged in a specific logical order which, when executed, produces the solution for a problem. adalah satu urutan langkah yang disusun dalam susunan logik yang tertentu, apabila dilaksanakan, menghasilkan penyelesaian bagi masalah. A. algorithm B. pseudocode C. flowchart D. program 3. The following diagram is a. Gambarajah yang berikut adalah. Begin Enter a number result = number + 2 Display the result End A. pseudocode B. flowchart C. data flow diagram D. algorithm. SFCS Page 3 of 23

4. Which of the following identifiers are VALID? Manakah antara berikut merupakan pengecam yang SAH? I. 100days II. III. IV. mysalaryinrm statename SalaryRM1010.90 A. I and II B. II and III C. I, II and III D. All of the above 5. Given the following declarations of variable first and second as follow: Diberikan pengisytiharan bagi pembolehubah first dan second seperti berikut: int first = 20; int second = 23; second = second % first 5; The value of variables first and second after the above statement executed respectively are: Nilai bagi pembolehubah first dan second selepas pernyataan di atas dilaksanakan adalah: A. 20 and 23 B. 15 and -2 C. 20 and -2 D. 20 and 8 SFCS Page 4 of 23

6. Which of the following is NOT a reserved word in C? Manakah antara berikut BUKAN merupakan perkataan simpanan dalam C? A. int B. char C. tree D. double 7. What is the value of variable x after the following statement execute? Apakah nilai bagi pembolehubah x selepas pernyataan dibawah dilaksanakan? double n = 6.5, x; int m = 12; x = m % 5 + n; A. 8.5 B. 1.04 C. 8.9 D. 9 8. Suppose that age and day are int variables. Which of the following is a valid input statement? Andaikan bahawa age dan day adalah pembolehubah int. Antara berikut yang manakah adalah pernyataan input yang sah? A. scanf(age,day); B. scanf( %d%d, age, day); C. scanf( %d%d,&age,&day); D. printf( %d%d, age, day); SFCS Page 5 of 23

9. Given the following variables declaration and initialization: Diberikan pengisytiharan pembolehubah dan pengawalan berikut: int i = 3; int j = 13; int k = 30; int test = 0; What is the value of the following condition? Apakah nilai bagi keadaan di bawah? ( i!= j ) && ( ( ( i > 5) (j < 10)) && test ) A. 0 B. 1 C. 2 D. invalid expression 10. By using the variable declarations below, which of the following Boolean expressions is FALSE? Dengan menggunakan pengisytiharan pembolehubah di bawah, yang mana satu ungkapan Boolean berikut adalah SALAH? int y = 2, x = - 4, z = 300, w = 2; A. y > x &&!( y >= z ) B. z > 100 z < w C. (y * 100 - x + 100) < z D. (y == w && z > x)! (x < 10) SFCS Page 6 of 23

11. By default, C statements are executed, from top to bottom, in the order they appear in the program. What is this default control structure called? Secara umumnya, pernyataan C dilaksanakan dari atas ke bawah mengikut susunan yang terdapat didalam program. Apakah struktur kawalan awam ini dipanggil? A. conditional B. function call / return C. repetitive D. sequential 12. What is the output of the following C program segment? Apakah hasil paparan bagi segmen program C berikut? int x=5; int y=8; if(y == 8) if(x == 5) printf("testing l\n"); else { printf("testing 2\n"); printf("testing 3\n"); } printf("testing 4\n"); A. Testing 1 B. Testing 1 Testing 4 C. Testing 2 Testing 3 D. Testing 4 SFCS Page 7 of 23

13. What is the output for the following program segment? Apakah hasil paparan bagi program segmen yang berikut? int num = 24; if ( num % 2 == 0 ) printf( TWO ); if ( num % 3 == 0 ) printf( THREE ); if ( num % 4 == 0 ) printf( FOUR ); A. TWOTHREEFOUR B. FOUR C. THREE D. TWO 14. What is wrong with this for loop? Apakah yang salah bagi gegelung di bawah? for (int k = 2, k <=12, k++) A. the increment should always be ++k B. the variable must always be the letter i when using a for loop C. there should be a semicolon at the end of the statement D. the commas should be semicolons SFCS Page 8 of 23

15. How many times will the following loop be executed? Berapa kali gelung berikut akan dilaksanakan? int x = 3; int a = 12; while ( x <= a) { x += 4; a++; } A. 0 B. 2 C. 3 D. 4 16. The function prototype for function Example() is as given below: Prototaip fungsi bagi fungsi Example() adalah seperti yang diberikan di bawah: void Example (int x,int y,float z); Which of the following function call is VALID? Manakah antara panggilan fungsi berikut adalah SAH? A. Example(int x,int y,float z) ; B. Example( x, y, z) ; C. A = Example(int x,int y,float z); D. A = Example(x, y, z); SFCS Page 9 of 23

17. What is the return type of the following function prototype: Apakah jenis pulangan prototaip fungsi berikut: int function (char a, float v, double t); A. char B. int C. float D. double 18. Which of the following function prototypes with two integer parameters can be used for a void function named CalculateBalance? Manakah antara berikut prototaip fungsi dengan dua parameter integer yang boleh digunakan bagi fungsi void bernama CalculateBalance? A. void CalculateBalance (int); B. int CalculateBalance (void); C. void CalculateBalance (int, int); D. int CalculateBalance (int, int); 19. The items listed in the function header are called. Perkara yang disenaraikan dalam pengepala fungsi dipanggil. A. actual parameters B. formal parameters C. reference parameters D. value parameters SFCS Page 10 of 23

20. Which of the following can happen when the program has a logic error? Antara berikut yang manakah boleh berlaku apabila program ini mempunyai ralat logik? I. Compile and run normally. II. Compile incorrectly. III. Give incorrect output. IV. The program execution will crash. A. II only B. I and III C. I and IV D. II and IV SFCS Page 11 of 23

SECTION B : TRUE OR FALSE QUESTIONS (10 MARKS) BAHAGIAN B : SOALAN BETUL ATAU SALAH (10 MARKAH) INSTRUCTION : Answer ALL questions. ARAHAN : Jawab SEMUA soalan. 1. float and double variables are exactly the same. Those two variable declarations can be used interchangeably. float dan pembolehubah double adalah sama. Kedua-dua pengisytiharan pembolehubah boleh digunakan silih berganti. 2. Comments are instructions that cause some action to be implemented. Komen adalah arahan yang menyebabkan beberapa tindakan akan dilaksanakan. 3. A conditional expression is a question that will evaluate to either true or false. Ungkapan bersyarat adalah soalan yang akan menilai sama ada benar ataupun salah. 4. Function printf always begins printing at the beginning of a new line. Fungsi printf sentiasa memulakan cetakan pada permulaan baris yang baru. 5. The expression (x > y && a < b) is true if either x > y is true or a < b is true. Ungkapan (x > y && a < b) adalah benar jika sama ada x > y benar atau a < b adalah benar. SFCS Page 12 of 23

Please indicate whether the following logic equation is true or false if the value of a = 5, b = 10 and c = 15 included in the following equation: Sila nyatakan persamaan logik berikut sama ada benar atau salah jika nilai a = 5, b = 10, dan c = 15 dimasukkan ke dalam persamaan berikut: 6. c == a + b!c < 20 7. a!= 7 && b <= 10 c >= 6 8.!(b <= 12) && a % 2 == 0 9.!(a > 5 c < a + b) 10.!a > 5 c < a + b SFCS Page 13 of 23

SECTION C : STRUCTURE QUESTIONS (50 MARKS) BAHAGIAN C : SOALAN STRUKTUR (50 MARKAH) INSTRUCTION : Answer ALL questions. ARAHAN : Jawab SEMUA soalan. Question / Soalan 1 a) Bagi setiap pengecam berikut, nyatakan sama ada ianya sah atau tidak sah? For each of the following identifiers, state whether they are legal or illegal? i. Last Minute ii. Int iii. _booksales iv. 3rdBirthday v. _Guest3 (5 marks / markah) b) Evaluate each the following C expression based on the following declarations: Nilaikan setiap ungkapan C berikut berdasarkan pengisytiharan berikut: const double pie = 3.142; int num = 3, m = 5; i. 3 * pie + num / m ii. 4 * num % m + pie iii. 1 - (num / 2) * 3 (3 marks / markah) SFCS Page 14 of 23

Question / Soalan 2 Fill in the blanks in each of the following: Isikan tempat kosong bagi setiap yang berikut: flowchart counter sentinel semicolon break void return main compound if..else counter-controlled pseudocode 1. Every C program begins execution at the function. Setiap program C mula dilaksanakan pada fungsi. 2. Every statement ends with a. Setiap pernyataan berakhir dengan. 3. is a graphical representation of an algorithm. adalah paparan grafik mengenai algoritma. 4. Several statements grouped together in braces ({ and }) are called a(n) statement. Beberapa pernyataan yang dikumpulkan bersama dalam pendakap ({ dan }) dipanggil pernyataan. 5. The selection statement is used to execute one action when a condition is true and another action when that condition is false. Pernyataan pilihan digunakan untuk melaksanakan satu tindakan apabila keadaan adalah benar dan tindakan lain apabila keadaan itu adalah palsu. 6. Repetition of a set of instructions a specific number of times are called repetition. Pengulangan set arahan tertentu beberapa kali dipanggil ulangan. SFCS Page 15 of 23

7. When it s not known in advance how many times a set of statements will be repeated, a value can be used to terminate the repetition. Apabila tidak diketahui terlebih dahulu berapa kali satu set penyataan akan berulang, satu nilai boleh digunakan untuk menamatkan pengulangan itu. 8. In counter-controlled repetition, a is used to count the number of times a group of instructions should be repeated. Dalam pengulangan kaunter terkawal, satu digunakan untuk mengira bilangan kali kumpulan arahan perlu diulangi. 9. Keyword is used in a function header to indicate that a function does not return a value or to indicate that a function contains no parameters. Kata kunci digunakan dalam pengepala fungsi untuk menunjukkan bahawa fungsi tidak memulangkan nilai atau untuk menunjukkan bahawa fungsi tidak mengandungi parameter. 10. The statement in a called function is used to pass the value of an expression back to the calling function. Pernyataan pada fungsi panggilan digunakan untuk menghantar nilai ungkapan kembali kepada fungsi yang memanggil. (10 marks / markah) SFCS Page 16 of 23

Question / Soalan 3 a) List and define the first THREE (3) steps in the Software Development Method (SDM). Senarai dan terangkan THREE (3) langkah pertama dalam Kaedah Pembangunan Perisian (SDM). (3 marks / markah) b) List THREE (3) rules of naming an identifier and give ONE (1) example for each. Senaraikan TIGA (3) kaedah-kaedah penamaan pengecam dan berikan SATU (1) contoh bagi setiap satu. (3 marks / markah) SFCS Page 17 of 23

Question / Soalan 4 a) Air Pollution Index (API) is used to determine the level of air pollution. The relationship between API and air pollution level is shown in the following table. Indeks Pencemaran Udara (API) digunakan untuk menentukan tahap pencemaran udara. Hubungan antara API dan tahap pencemaran udara ditunjukkan dalam jadual berikut. API range Level 0-50 Good 51-100 Moderate 101-200 Unhealthy 201-300 Very Unhealthy >300 Hazardous Draw the flowchart that accepts the API value and determines the air pollution level from the table above. Lukiskan carta aliran yang menerima nilai API dan kenalpasti tahap pencemaran udara dari jadual di atas. (10 marks / markah) SFCS Page 18 of 23

Question / Soalan 4 a) List THREE (3) elements to control a looping structure. Senaraikan TIGA (3) elemen untuk mengawal struktur gelung. (3 marks / markah) b) Given the following program: Diberikan aturcara berikut: #include <stdio.h> int main() { int data = 0, sum = 0; while(data!= -1) { sum = sum + data; scanf("%d", &data); } printf("sum = %d \n", sum); return 0; } What is the output if the user enters the following data? Please show your tracing. Apakah output jika pengguna memasukkan data berikut? Sila tunjukkan kerja surihan anda. 9 8 5 7 3-1 (3 marks / markah) SFCS Page 19 of 23

Question / Soalan 5 a) List TWO (2) types function. Senaraikan DUA (2) jenis fungsi (4 marks / markah) b) Write the function definition for function boxvolume ( ) that receives the length, width and height of a box through its parameters. This function then calculates and returns the volume of box using the formula: Tulis satu definisi fungsi bagi fungsi boxvolume( )yang menerima length, width and height sebuah kotak sebagai parameter. Fungsi ini akan mengira dan memulangkan isipadu sebuah kotak menggunakan formula: volume = length x width x height (6 marks / markah) SFCS Page 20 of 23

SECTION D : APPLICATION QUESTIONS (20 MARKS) BAHAGIAN D : SOALAN APLIKASI (20 MARKAH) INSTRUCTION : Answer ONE (1) question only. ARAHAN : Jawab ONE (1) soalan sahaja. Question / Soalan 1 Write a complete C program that will ask an input from user and display different text depending on the selected option. If wrong option is selected, an error message will be shown. The options and text to be displayed are as follows. Tulis sebuah aturcara C lengkap yang akan meminta pengguna memasukkan input dan memaparkan teks yang berbeza bergantung pada pilihan yang dipilih. Jika pilihan yang salah dipilih, mesej ralat akan dipaparkan. Pilihan dan teks yang akan dipaparkan adalah seperti berikut. Options Text to output A: Killing Paper Please help me Madam!! B: Above expectation Got extra marks? C: Can Pass Hope to maintain my CGPA 3.0 D: Confident I love programming E: Peanut Very Easy I am ready for my IT career... Can open business already... Other inputs Wrong input... (20 marks / markah) SFCS Page 21 of 23

Question / Soalan 2 Suppose that temperature is an int variable representing the temperature of an oven. Write a sequence of multiple if/else statements that output the phrases below based on temperature input from user. Andaikan bahawa suhu adalah pembolehubah int mewakili suhu oven. Tulis satu turutan beberapa pernyataan if/else yang akan memaparkan frasa di bawah berdasarkan kepada suhu yang dimasukkan oleh pengguna. Value of temperature / Nilai Suhu Not over 200 Over 200 but not over 350 Over 350 but not over 425 Over 425 but not over 500 Over 500 Phrase to print / Frasa untuk dipaparkan Too cold to cook Oven is preheating Put in the apple pie Time to cook pizza Call the fire department (20 marks / markah) SFCS Page 22 of 23

Soalan / Question 3 The prices of all shoes at Pay More Shoe Store have a basic price RM50 per pair. There is an extra charge of RM10 per pair if the shoes size over size 10. Women s shoes are also marked up an additional 20%. Using this information, write C code needed to calculate and print shoe prices. Harga bagi semua kasut di Pay More Shoe Store mempunyai harga asas RM 50 sepasang. Harga tambahan RM10 sepasang akan dikenakan jika saiz melebihi saiz 10. Kasut wanita juga dinaikkan sebanyak 20%. Menggunakan maklumat tersebut, tuliskan aturcara C yang perlu untuk mengira dan mencetak harga kasut-kasut tersebut. // variable declaration char customer_gender = F ; float shoe_size; float shoe_price = 50.00; // prompt user for shoe purchase information // calculate final price for all sizes/types of shoes // print out final price (20 marks / markah) End of Page. SFCS Page 23 of 23