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

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

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

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

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

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

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

UNIVERSITI SAINS MALAYSIA. CST232 Operating Systems [Sistem Pengendalian]

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

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

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

MSS 317 Coding Theory [Teori Pengekodan]

UNIVERSITI SAINS MALAYSIA. CST131 Computer Organisation [Organisasi Komputer]

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

CPT111/CPM111 Principles of Programming [Prinsip Pengaturcaraan]

UNIVERSITI SAINS MALAYSIA

UNIVERSITI SAINS MALAYSIA. CST131 Computer Organisation [Organisasi Komputer]

UNIVERSITI SAINS MALAYSIA. CST131 Computer Organisation [Organisasi Komputer]

MSS 318 Discrete Mathematics [Matematik Diskret]

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

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

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

EEE 428 SISTEM KOMPUTER

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

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

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

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.

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

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

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

UNIVERSITI SAINS MALAYSIA. CST334 Network Monitoring & Security [Pengawasan & Keselamatan Rangkaian]

EEE 348 PENGANTAR REKABENTUK LITAR BERSEPADU

UNIVERSITI SAINS MALAYSIA. CMT324 Computer Graphics & Visual Computing [Grafik Komputer & Perkomputeran Visual]

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

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

MAT181 Programming For Scientific Applications [Pengaturcaraan Untuk Penggunaan Sains]

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.

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

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

UNIVERSITI SAINS MALAYSIA. CST234 Network Programming [Pengaturcaraan Rangkaian]

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

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

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

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

UNIVERSITI SAINS MALAYSIA. CCS523 Computer Security & Cryptography [Keselamatan Komputer & Kriptografi]

UNIVERSITI SAINS MALAYSIA. CPT341 Software Design & Architecture [Reka Bentuk & Seni Bina Perisian]

UNIVERSITI SAINS MALAYSIA. CPT101 Prinsip-Prinsip Pengaturcaraan

CST432 Microprocessors & Embedded Systems [Mikropemproses & Sistem Terbenam]

UNIVERSITI SAINS MALAYSIA. CPT101 Prinsip-Prinsip Pengaturcaraan

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

UNIVERSITI SAINS MALAYSIA. CPT103 Struktur Data & Paradigma Pengaturcaraan

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

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

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

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

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 FOUR (4) structured questions. Answer ALL questions.

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

UNIVERSITI SAINS MALAYSIA. CST232 Operating Systems [Sistem Pengendalian]

UNIVERSITI SAINS MALAYSIA. CST432 Microprocessors & Embedded Systems [Mikropemproses & Sistem Terbenam]

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR

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

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

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

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

EEM 312 ROBOTIK & PENGLIHATAN MESIN

CCS592 Advanced Algorithms and Complexity [Algoritma Lanjutan & Kekompleksan]

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

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

UNIVERSITI SAINS MALAYSIA. CIT502 Pengaturcaraan dan Kejuruteraan Perisian Berorientasi Objek

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

EEE 355 ROBOTIC & AUTOMATION [Robotik & Pengautomatan]

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

Pengenalan Sistem Maklumat Dalam Pendidikan

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

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

UNIVERSITI SAINS MALAYSIA EEE 355 ROBOT DAN PENGAUTOMATAN

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR

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

LAB 5: WORKING WITH DATA

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

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR

ISOGEOMETRIC ANALYSIS OF PLANE STRESS STRUCTURE CHUM ZHI XIAN

CST234 Network Programming [Pengaturcaraan Rangkaian]

UNIVERSITI SAINS MALAYSIA. CMT221/CMM222 Database Organisation & Design [Organisasi & Reka Bentuk Pangkalan Data]

BORANG PENCALONAN HADIAH UNIVERSITI NOMINATION FORM FOR UNIVERSITY AWARD

Semasa buku ini ditulis XAMPP mengandungi empat versi:

UNIVERSITI SAINS MALAYSIA. CCS514 - Envisioning Information [Pemelihatan Maklumat]

Lab 4 : Sorting Techniques

Registration of Supplier (ROS) TM Supplier Registration Renewal via SUS Portal (Pembaharuan Pendaftaran Pembekal TM melalui SUS Portal)

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

Pengaturcaraan web ASP.NET. Sinopsis:

UNIVERSITI SAINS MALAYSIA. CPT101 Prinsip-Prinsip Pengaturcaraan

PANDUAN PENGGUNA (SUPPLIER) e-purchase ORDER FOR SERVICES

Panduan Pengguna Autodesk Education Community

UNIVERSITI SAINS MALAYSIA. CST334 Network Monitoring & Security [Pengawasan & Keselamatan Rangkaian]

UNIVERSITI SAINS MALAYSIA. CPT201 Reka Bentuk & Analisis Algoritma

TEKNOLOGI, GADJET & KEIBUBAPAAN

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

Transcription:

UNIVERSITI SAINS MALAYSIA Second Semester Examination 2015/2016 Academic Session June 2016 CPT211-CPM313 Programming Language Concepts & Paradigm [Konsep & Paradigma Bahasa Pengaturcaraan] Duration : 2 hours [Masa : 2 jam] INSTRUCTIONS TO CANDIDATE: [ARAHAN KEPADA CALON:] Please ensure that this examination paper contains FOUR questions in SIX printed pages before you begin the examination. [Sila pastikan bahawa kertas peperiksaan ini mengandungi EMPAT soalan di dalam ENAM muka surat yang bercetak sebelum anda memulakan peperiksaan ini.] Answer ALL questions. [Jawab SEMUA soalan.] You may answer the questions either in English or in Bahasa Malaysia. [Anda dibenarkan menjawab soalan sama ada dalam bahasa Inggeris atau bahasa Malaysia.] In the event of any discrepancies, the English version shall be used. [Sekiranya terdapat sebarang percanggahan pada soalan peperiksaan, versi bahasa Inggeris hendaklah diguna pakai.]...2

- 2-1. (a) State two (2) characteristics of each of the four main programming language paradigms. Nyatakan dua (2) ciri bagi setiap satu daripada empat paradigma utama bahasa pengaturcaraan. (8/100) Given the following BNF Grammar: Diberikan tatabahasa BNF berikut: <assign> -> <id> = <expr> <id> -> A B C <expr> -> <id> + <expr> <id> * <expr> (<expr) <id> Show a parse tree and a leftmost derivation for statement A = A * (B + (C * A)). Tunjukkan pepohon huraian dan terbitan paling kiri untuk kenyataan A = A * (B + (C * A)). (8/100) Write a BNF grammar for the sequence of undergraduate course codes offered by School of Computer Sciences where CST131 and CPT211 are acceptable but CMT521 and CKT321 are not. Note that the year of studies is indicated by the number after the last alphabet, e.g CST131 is a first year course and CPT211 is a second year course. Since the Bachelor of Computer Science program is a four-year program, a code such as CST531 is not acceptable. The code also indicates the specialization offered by the school in which courses with initial codes of CPT, CST and CMT are the full representatives of the specialization offered. The most important note is that all computer science course codes start with letter C. Hence your grammar should be able to generate the acceptable cases and avoid the unacceptable cases. Tuliskan tatabahasa BNF untuk jujukan kod kursus pra-siswazah yang ditawarkan oleh Pusat Pengajian Sains Komputer yang mana CST131 dan CPT211 adalah diterima tetapi CMT521 dan CKT321 tidak diterima. Perhatikan bahawa tahun pengajian ditentukan oleh nombor selepas aksara terakhir, contohnya, CST131 ialah kursus tahun pertama dan CPT211 ialah kursus tahun kedua. Memandangkan program Sarjana Muda Sains Komputer ialah program pengajian empat tahun, kod kursus seperti CST531 adalah tidak diterima. Kod kursus juga menentukan pengkhususan yang ditawarkan oleh Pusat Pengajian yang mana kursus-kursus dengan kod-kod permulaan CPT, CST dan CMT mewakili kesemua pengkhususan yang ditawarkan. Fakta yang paling penting adalah kesemua kod kursus sains komputer bermula dengan huruf C. Justeru itu, tatabahasa anda sepatutnya mampu menjana kes-kes yang diterima dan mengelak kes-kes yang tidak diterima. (6/100)...3

- 3 - (d) Consider the following pseudocode: Pertimbangkan pseudokod berikut: x : integer global procedure set x(n : integer) x := n procedure write integer(x) procedure first set x(3) procedure second x : integer set x(5) set x(1) first() second() set x(7) (i) What does this program print if the language uses static scoping? Apakah yang dicetak jika bahasa ini menggunakan skop statik? (1/100) (ii) What does this program print if the language uses dynamic scoping? Apakah yang dicetak jika bahasa ini menggunakan skop dinamik? (1/100) (iii) Justify your answers for 1(d)(i) and 1(d)(ii). Wajarkan jawapan anda untuk 1(d)(i) dan 1(d)(ii). (4/100) 2. (a) An iterative statement is often called a loop. Describe three (3) variants of loop with example. Kenyataan berulang juga dinamakan sebagai gegelung. Perihalkan tiga (3) variasi gegelung dengan menggunakan contoh. (6/100)...4

- 4 - Given the following program written in C syntax: Diberikan program yang ditulis dalam sintaks C: void swap(int a, int b) { int temp; temp=a; a=b; b=temp; } void main() { int value=1, list[5]={2,4,6,8,10}; swap (value, list[0]); swap(list[0], list[1]); swap (value, list[value]); } For each of the following parameter passing methods, what are the values of the variables value and list after each of the three calls to function swap? Bagi setiap kaedah penghuluran parameter berikut; apakah nilai pemboleh ubah value dan list selepas setiap panggilan fungsi swap? (i) Passed by value. Penghuluran melalui nilai. (2/100) (ii) Passed by reference. Penghuluran melalui rujukan. (2/100) (iii) Justify your answer for 2(i) and 2(ii). Wajarkan jawapan anda untuk 2(i) dan 2(ii). (4/100)...5

- 5 - The basic elements of Prolog are terms, fact and rules. Write a Prolog program to a simple arithmetic problem that calculates a distance travelled by a particular car based on the following basic information: Elemen asas bagi Prolog adalah sebutan, fakta dan peraturan. Tuliskan satu program dalam Prolog untuk permasalahan aritmetik yang mengira jarak yang dilalui oleh sesebuah kereta berdasarkan maklumat berikut: Ford has an average speed of 100 km/h Chevy has an average speed of 105 km/h Volvo has an average speed of 80 km/h Time taken by Ford is 20 minutes Time taken by Chevy is 21 minutes Time taken by Volvo is 24 minutes Distance is defined as the speed of a car multiply by the time taken. In order to ensure that your Prolog program works, a query of distance (Chevy,?) should return 2205. Untuk memastikan bahawa program Prolog anda berjaya, pertanyaan distance (Chevy,?) sepatutnya memulangkan nilai 2205. (8/100) 3. (a) List five (5) new features in HTML5. Senaraikan lima (5) ciri baharu di dalam versi HTML5. Give three (3) differences and two (2) similarities between JavaScript and Java programming language? Berikan tiga (3) perbezaan dan dua (2) persamaan antara JavaScript dan bahasa pengaturcaraan Java? (10/100) List three (3) reasons why XML is commonly used by the internet applications? Senaraikan tiga (3) sebab kenapa XML sering digunakan oleh aplikasi-aplikasi berteraskan internet?...6

- 6-4. (a) Elaborate on the strength, usage and the underlying paradigm for the following programming languages; Java, C++, C#, C and Objective- C. Huraikan kekuatan, penggunaan meluas dan paradigma bahasa-bahasa pengaturcaraan berikut; Java, C++, C#, C and Objective-C. Give three (3) differences and two (2) similarities between ASP.net and PHP. Berikan tiga (3) perbezaan dan dua (2) persamaan antara ASP.net dan PHP. (10/100) Parallel computing is based on shared and distributed memory architecture. Pengkomputeran selari berasaskan seni bina ingatan kongsi dan teragih. (i) Elaborate on shared memory architecture. Give one (1) example of programming language that utilizes such architecture. Huraikan seni bina ingatan kongsi. Berikan satu (1) contoh bahasa pengaturcaraan yang menggunakan seni bina tersebut. (ii) Elaborate on distributed memory architecture. Give one (1) example of programming language that utilizes such architecture. Huraikan seni bina ingatan teragih. Berikan satu (1) contoh bahasa pengaturcaraan yang menggunakan seni bina tersebut. (d) Discuss briefly the programming environment for Android and Intel Galileo. Bincangkan dengan ringkas persekitaran pengaturcaraan untuk Android dan Intel Galileo. - ooooooo -