Address
:
[go:
up one dir
,
main page
]
Include Form
Remove Scripts
Session Cookies
Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
53 views
28 pages
DFC2013 - Programming Fundamentals-15052019152846
Uploaded by
Deveshwar Thyagarajan
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save DFC2013_-_PROGRAMMING_FUNDAMENTALS-15052019152846 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
53 views
28 pages
DFC2013 - Programming Fundamentals-15052019152846
Uploaded by
Deveshwar Thyagarajan
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save DFC2013_-_PROGRAMMING_FUNDAMENTALS-15052019152846 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 28
Search
Fullscreen
SULIT a POUT SHnil< MALAYSIA BAHAGIAN PEPERIKSAAN DAN PENILAIAN JABATAN PENDIDIKAN POLITEKNIK, KEMENTERIAN PENDIDIKAN MALAYSIA f JABATAN TEKNOLOGI MAKLUMAT DAN KOMUNIKASI PEPERIKSAAN AKHIR SESI DISEMBER 2015 DFC2013: PROGRAMMING FUNDAMENTALS TARIKH ; 07 APRIL 2016 (KHAMIS) MASA + 11,15 AM—-1.15 PM (2 JAM) Kertas ini mengandungi DUA PULUH ENAM (26) halaman bercetak. Bahagian A: Objektif (30 soalan) Bahagian B: Struktur (2 soalan) Dokumen sokongan yang disertakan : Tiada JANGAN BUKA KERTAS SOALAN INI SEHINGGA DIARAHKAN (CLO yang tertera hanya sebagai rujukan) SULITSULIT DFC2013: PROGRAMMING FUNDAMENTALS CLOL cL CLOL cl SECTION A: 4SMARKS BAHAGIAN A: 45MARKAH ———<—<—$ —————————_________f INSTRUCTION: This section consists of THIRTY (30) objective questions. Mark your answers in the OMR_ form provided. ARAHAN: Bahagian ini mengandungi TIGA PULUH (30) soalan objektif. Tandakan jawapan anda di dalam borang OMR yang disediakan. 1, [Error that ocours while program is running; when the program attempts an operation that is impossible to carry out, Ralat yang berlaku semasa program berjalan; apabila program cuba melaksanakan satu operasi yang mustahil untuk dijalankan, Figure Al/Rajah Al Select the CORRECT answer based on the statement in Figure Al. Pilih Jawapan yang BETUL berdasarkan pernyataan dalam Rajah Al A. Compile Error Ralat Susunan B. Logie Error Ralat Logik C. Syntax Error Ralat Sintaks D._ Run-Time Error Ralat Masa Laksana 2, Identify the symbol that must end the C++ code statement. Kenalpasti symbol yang mesti diakhiri pada setiap kod pernyataan C++ comma semicolon colon hash pop 2 SULITSULIT DFC2013: PROGRAMMING FUNDAMENTALS. CLO1 /3. Identify the operator that compares between two variables. cL Kenalpasti operator bagi membandingkan dua pembolehubah A B. c, D, CLOI | 4. Select the identifier based on the following answer. C2 Pilih pencam berdasarkan jawapan bertkut A. Sum_2 B. Sum2 Cc. SU_M2 D. 2SUM CLOL |5. Choose the suitable header file for mathematical function of sqrt(). c2 Pilth kepala fail yang sesuai digunakan untuk. fungsi matematik sqrt(). A. stdlibh B. string. h CC. iomanip.h D. math CLOI }6. Choose the syntax to declare a variable named totalPtr of type double. 3 Pilih sintaks bagi mengisytiharkan pembolehubah totalPtr jenis double. A. double totalPtr; B. double *totalPtr; C. Double totalPir; D. double totPtr = CLO1 |7. _ Identify which is NOT the type of looping control structure, cl Kenalpasti yang manakah BUKAN jenis siruktur kawalan gelung, A. for B. while C. if...else D. do...while suLirCLOL c CLOL c2 cLo2 cl Determine the numbers of ‘do... while” loop which are guaranteed to loop. Tentukan bilangan kali ‘do...while’ dijamin untuk membuat ulangan. A. 0 Bo G22 D. Infinitely If sum is greater or equal to 40 and the average is equal to 25 Figure A2/Rajah A2 ‘The sentence in Figure A2 is the condition statement in a selection control structure. Identify the CORRECT statement to write the condition statement in C++ Ayat dalam Rajah A2 merupakan pernyataan syarat di dalam struktur kawalan pilihan, Kenalpasti pernyataan yang BETUL untuk menulis pernyataan syarat di dalam CH. A. if (sum >=40) || (average B. if (Gum >=40) && (average C._ if (sum > 40) && (average = 25) D. if (sum = 40) || (average = 25) Choose the syntax for an ‘if’ statement. Pilih sintaks untuk satu pernyataan ‘if’ if expression if { expression } if ( expression ) expression if par> 4 suLITcl #include
int main()( for(int h =0; ; } cout<<"Hi Figure A3/Rajah A3 Select the output for the program in Figure A3. Pilih output berdasarkan program dalam Rajah A3. A Hi Hi B. No Ouput Tiada output C. Syntax error Kesalahan sintak D. Hi printed infinites times Hi dicetak sehingga infiniti 5 SULITCLO2 | 12. Cc —————— el Figure A4/Rajah Ad Identify the C++ program that can produce the given output as Figure Ad, Kenalpasti program C++ yang BETUL bagi menghasitkan output yang diberi seperti di Rajah Ad. A int i=l; while (i <= 3) { if(i == 2) break; cout<
Determine the suitable statement for X symbol in int main( ) ( ink i Ti dol cout<< i <<" " itt; ) ut : return 0; } Figure A6/Rajah A6 igure AG that produces output 123. Tentukan pernyataan yang sesuai bagi simbol X dalam Rajah A6 yang menghasilkan output 123 A. while (i<3) B. while (i<4) c. while (i<=4) D-—~ while (i<=2) SULITCLO2 SULIT DFC2013: PROGRAMMING FUNDAMENTALS Cl cLo2 cl Datatype Array_name|size]; Figure A7/Rajah A7 Choose FALSE statement about declaration of one dimensional array in Figure A7. Pilih pernyataan yang SALAH tentang pengisytiharan tatasusunan satu demensi dalam Rajah A7. ‘A. Data type is the specifier that indicates what data type of variable Data_type merujuk kepada jenis data yang disimpan di dalam pemboleh ubah B. Array_name is the name of the declared array. Array name adalah nama bagi tatasususnan yang disytiharkan. C. Amay size defines how many elements the array can contain, Saiz tatasusunan merujuk kepada bilangan elemen di dalam tatasusunan, D. Array size must less than element that contain in array. Saiz talasusunan perlu kurang daripada element di dalam tatasususnan Identify the last and first elements for array number [13]. Kenalpasti elemen terakhir dan pertama dalam nunber[ 13]. A number [13], number [0] B. number [12], number [0] C. number [1], number [13] ) D. number [0], number {13}. 9 SULITSULEE £62013 PROGRAMMING KUNDAMENTALS cxo2 |17 Cc tnt at SHAT A107 3 AT A Ar IO ts OTT cout<
int main( ) { int store[3][2] = { {1,2}, (3,4), {9,8)}¢ cout<< x ; return 0; Figure Al0/Rajah A10 Choose the suitable statement for X that produces an output 9. Pilih pernyataan yang sesuai untuk X yang menghasilkan output 9. A B, G D. cout<
struct planet ( char name[25]; string distant; Mi int main( ) { z = {"Mars", "78,340,000"}; cout<<"Planet :"<
Choose the CORRECT statement to explain recursion, Pilih penerangan yang BETUL untuk menerangkan rekursif. A. Function that returns more than one value Fungsi yang memulangkan lebih dari satu nilai B. Function that calls themselves Fungsi yang memanggil diri sendiri CC. Funetion that passes value Fungsi yang menghantar data D. Function that calculates and receives value Fungsi yang mengira dan menerima nilai Select the INVALID function declaration. Pilih pengisytiharan fungsi yang TIDAK SAH. A. int Sum(int a, int b= 2, int © = 3); B, int Sum(int a = 5, int b); C. int Sum(int a= 0, int b, int D. Both B and C are incorrect. DFC2013: PROGRAMMING FUNDAMENTALS SULITSULIT DFC2013: PROGRAMMING FUNDAMENTALS, CLO2 25. Identify the use of ampersand (&) symbol in funetion, cl Kenalpasti kegunaan simbol “ampersand” (&) dalam fungsi. ‘A. pass by value penghantaran dengan nilai B. pass by reference Penghantaran dengan rujukan C. Pass by statement Penghantaran dengan pernyataan D. Pass by function Penghantaran dengan fungsi CLO2 | 26. Choose declaration prototype for Display function which is not returned any values C2 and receives two float type parameters. Pilih pengisytiharan fungsi prototaip bagi fungsi Display yang tidak memulangkan nilai dan menerima dua parameter berjenis float A. float Display( float); B. void Display (float, float); C. float Display (); D. void Display (); CLO2 }27. Identify the operator represents the address of the pointer variable, cl Kenalpasti operator yang mewakili alamat bagi pembolehubah penunjuk A # Bf Cc & DR! 4 SULITsun DEC2013 PROGRAMMING FUNDAMENTALS CLO2 | 28. Identify the pointer declaration of ptr. Cr Kenalpasti pengisytiharan penunjuk bagi ptr. A. int ptr; B. int *ptr; C. int &ptr; D. int ptr&; ee 29. float Quantity=12.50; Oo float Qptr: Qptr=sQuantity; Figure Al12/Rajah 412 Based on the segment code in Figure A12, choose the statement to display the value of Quantity. Berdasarkan keratan kod dalam Rajah A12, pilih pernyataan untuk memaparkan nilai Quantity. . cout<<&Quantity cout<<*Qptr, 2 Bl > cout<
16 SULITCLO1 cl cLoL foil SULIT DFC2013: PROGRAMMING FUNDAMENTALS SECTION B: SSMARKS | BAHAGIAN B: SSMARKAH INSTRUCTION: This section consists of TWO (2) structured questions. Answer ALL questions. ARAHAN: Bahagian ini mengandungi DUA (2) soalan berstruktur. Jawab semua soalan. QUESTION 1 SOALAN I (a) i, List TWOQ) types of error in c+ programm Senaraikan DUA(2) jenis kesalahan di dalam atureara c++ [2 marks} ”) [2 markah] ii, Define debugging process in program Terangkan proses debugging dalam program [2 marks} [2 markah] {b) i. Define the terms below: Takrifkan item di bawah a) Identifier ; Pengecam > b) Variable Pembolehubah [4 marks] [4 markah} ii, List THREE (3) data types used in programming Senaraikan TIGA (3) jenis data yang digunakan dalam pengaturcaraan [3 marks} (3 markahy 7 SULIT{ sue _rc2013: PROGRAMMING FUNDAMENTALS CLO |e) List TWO (2) types of repetition control structure, Ct Senaraikan DUA (2) jenis struktur kawalan pengulangan. . [2 marks} [2 markah CLO! |d) 3 for(int ico; 8 =; 8 te <<"Number of students :"<< _P_ <
=18.5 && bmi<=24.5) output “Normal weight” D2 Ue net output “Overweight” Figure B2/Rajah B2 [6 marks} [6 markah] 18 SULITcLo2 Cs while’. s DFEI1S: PROGRA: int main() { int i; for (i = 07 i < 5; i++) { cout << "Hello "7 cout << "There"<<"\n"; } return Figure B3/Rajah B3 FUNDAMENTALS £) Based on the program in Figure B3, convert for statement to do-while statement. Berdasarkan program dalam Rajah B3, tukarkan kenyataan ‘for’ kepada kenyataan ‘do- oO [5 marks] [5 markah] SULIT!: PROGRAMMING FUNDAMENTALS SULIT CLO2 |) List down TWO @) types of array. cl Senaraikan DUA (2) jenis tatasusunan. 1 mark] [1 markah] CLO2 |b) Identify the types of array shown in Figure B4 and Figure BS below: 2 Kenalpasti jenis tatasusunan berdasarkan Rajah I dan Rajah 2 di bawah: aft]} 6 ig a B 9 10 11 12. Figure BS/Rajah BS {1 mark] [1 markah] 20 SULITSULIT DFC2013: PROGRAMMING FUNDAMENTALS CLO2 |c) — Write the terminologies in array ‘MyAlphabet’ based on Figure B6 below. Namatan istilah-istilah dalam tatasusunan “MyAlphaber” berdasarkan Rajah B6 di bawah. ii) MyAlphabet. i) {4 B {0} (a) Figure B6/Rajah B6 0 (3 marks] [3 markah] cLo2 | — 4) Based on the array declaration below, write the output. cl Berdasarkan pengisytiharan tatasusunan di bawah, tuliskan output. int number [7] = {1, 2, 4, 7,10,5 }; i. cout<
using namespace std; void one(int x, inté y);} —» i) void two(inté s, int t); int a: |——+ ii) int main() { int u = 1; int v = 2; one(u, v)i << << << v << endl [even "in 0 cout << u << << v << endl; return 0; } void one(int x, ints y) { a xP i x= YF eee yrar } void two(int& s, int t) { int b: |—>+ v) bes-t; sst+b+2; t= 4 * b; } ) Figure B8/Rajah BS Based on the program in Figure BS, determine the element of function labelled i) until v). Berdasarkan program dalam Rajah BB, tentukan elemen di dalam fungsi yang telah dilabel i hingga v. marks] C [5 markah] 2B SULITSULIT DFC2013: PROGRAMMING FUNDAMENTALS CLO2 [hy float Harga( float a, float b) c2 { a=at0.02*b; return a; } Figure B9/Rajah B9 ins below. Based on the function definition in Figure B9, answer the que: Berdasarkan takrifan fungsi dalam Rajah B9, jawab soalan di bawah. i) Identify the types of user define function based on the function definition above. Kenalpasti jenis fungsi takrifan pengguna berdasarkan takrifan fungsi di atas. [1 mark] [} markah] ii) Identify the data type used to return the value of a. Kenalpasti jenis data yang digunakan unutk memulangkan nilai a. [1 mark] [1 markah] Write the call function if the value of a and b are 500.0 and 5.0 respectively. Tuliskan fungsi panggilan jika nilai a dan b adalah 500.0 dan 5.0 [1 mark] [J] markah) iv)Calculate the return value of aif the value of a and b are 500.0 and 5.0 respectively. Kira nilai pulangan a jika nilai a dan b adalah 500.0 dan 5.0. [2 marks] [2 markah] 24 SULITSULIT DFC2013: PROGRAMMING FUNDAMENTALS, CLO2 |i) Identify the terminologies used in memory allocation based on the declaration variable x in Figure B10-belo Kenalpasti istilah yang digunakan pada penempatan memori berdasarkan pengisytiharan pembolehubah dalam Rajah B10 di bawah. 7 1000 1002 1002 1003 1004 1005 noe ia mos | ta |e 0 Os] Han PE as Figure B10/Rajah B10 [3 marks] [3 markah) CLo2 |j) — Writea suitable code segment based on the statement in Figure B11 C2 Tuliskan kod segmen yang bersesuaian berdasarkan pernyataan dalam Rajah B11 int k float p 12.57 Figure B11/Rajah BI] () i) Declare the pointer variable kptr of type integer. Isytiharkan pembolehubah penuding kptr berjenis integer. [1 mark] [1 markah] ii) Assign the address of variable k to pointer variable kptr. Umpukkan alamat pembolehubah k kepada pembolehubah penuding kptr. {1 mark] [I markah] 28 SULITSULIT DFC2013: PROGRAMMING FUNDAMENTALS, iii) Display the value of variable k. Paparkan-nilai pembolehubabe- he {1 mark] [1 markah] iv) Display the address of variable k. Paparkan alamat pembolehubah k. [1 mark] [1 markah] SOALAN TAMAT 26 SULIT
You might also like
Py CP December January 2015
PDF
No ratings yet
Py CP December January 2015
15 pages
Sample Exercises Mat 181: (Answer)
PDF
No ratings yet
Sample Exercises Mat 181: (Answer)
12 pages
DSE 513: Programming Data Structure & Algorithm Mid Semester Assignment
PDF
No ratings yet
DSE 513: Programming Data Structure & Algorithm Mid Semester Assignment
4 pages
Exercise CSC415
PDF
No ratings yet
Exercise CSC415
7 pages
AV Computers Appl 2nd Prelims
PDF
No ratings yet
AV Computers Appl 2nd Prelims
6 pages
Cs201 Quiz 1 File by Vu Topper RM
PDF
No ratings yet
Cs201 Quiz 1 File by Vu Topper RM
45 pages
Py CP June 2014
PDF
No ratings yet
Py CP June 2014
7 pages
Sept14 Tcb2073 Structured Programming and Database System
PDF
100% (1)
Sept14 Tcb2073 Structured Programming and Database System
23 pages
Important Questions For Board Exam
PDF
No ratings yet
Important Questions For Board Exam
11 pages
Question CS
PDF
No ratings yet
Question CS
22 pages
Past Year Question
PDF
No ratings yet
Past Year Question
11 pages
Diwali H.W - Computer (Std-10)
PDF
No ratings yet
Diwali H.W - Computer (Std-10)
11 pages
Cosc101 Practice Questions
PDF
No ratings yet
Cosc101 Practice Questions
7 pages
C++ Final Examination
PDF
No ratings yet
C++ Final Examination
7 pages
Bitg 1113012003
PDF
No ratings yet
Bitg 1113012003
31 pages
Compt 1
PDF
No ratings yet
Compt 1
5 pages
CDCP2103 083
PDF
No ratings yet
CDCP2103 083
14 pages
CSC128 (Dec 2018) Question
PDF
No ratings yet
CSC128 (Dec 2018) Question
11 pages
Contoh2 Soalan Chapter1 and 2 - 1
PDF
No ratings yet
Contoh2 Soalan Chapter1 and 2 - 1
10 pages
Past Year CP
PDF
No ratings yet
Past Year CP
11 pages
Cs201 Midterm Subjective by Adil Alvi
PDF
No ratings yet
Cs201 Midterm Subjective by Adil Alvi
17 pages
L-L/T - l/CSE Date: 17/08/2017: - Section - A Four Three
PDF
No ratings yet
L-L/T - l/CSE Date: 17/08/2017: - Section - A Four Three
6 pages
Materi Uji Tes Seleksi Masuk S2 Informatika: Waktu: 50 Menit Untuk Setiap Test
PDF
No ratings yet
Materi Uji Tes Seleksi Masuk S2 Informatika: Waktu: 50 Menit Untuk Setiap Test
14 pages
Final Paper PF
PDF
No ratings yet
Final Paper PF
6 pages
Terminal Paper (PF SE 2C)
PDF
No ratings yet
Terminal Paper (PF SE 2C)
3 pages
Data Structure
PDF
100% (1)
Data Structure
22 pages
Day 100
PDF
No ratings yet
Day 100
4 pages
TCS-C Paper
PDF
No ratings yet
TCS-C Paper
12 pages
SOALAN Cuti 2009
PDF
No ratings yet
SOALAN Cuti 2009
20 pages
Computer Paper - Annual - XI
PDF
No ratings yet
Computer Paper - Annual - XI
6 pages
CSCE - 1001 - RevisionSheet (2) 2
PDF
No ratings yet
CSCE - 1001 - RevisionSheet (2) 2
50 pages
Midterm1 - Sample Questions
PDF
No ratings yet
Midterm1 - Sample Questions
10 pages
CSC425 - June 2013
PDF
No ratings yet
CSC425 - June 2013
13 pages
CSC425
PDF
No ratings yet
CSC425
12 pages
Second Semester 2014 - 2015 Midterm Exam, Thursday April 2, 2015 Time: 120 Minutes
PDF
No ratings yet
Second Semester 2014 - 2015 Midterm Exam, Thursday April 2, 2015 Time: 120 Minutes
9 pages
C Program Assignement
PDF
No ratings yet
C Program Assignement
4 pages
Tutorial Topic 2
PDF
No ratings yet
Tutorial Topic 2
2 pages
Bitg 1113012004
PDF
No ratings yet
Bitg 1113012004
23 pages
Structured Programming 2015 2016
PDF
No ratings yet
Structured Programming 2015 2016
11 pages
UTS KOnsep Pemrograman 2024
PDF
No ratings yet
UTS KOnsep Pemrograman 2024
4 pages
Ccsb163 Midterm Test - Aug 2006 - Questions
PDF
No ratings yet
Ccsb163 Midterm Test - Aug 2006 - Questions
6 pages
Cbds MCQ
PDF
No ratings yet
Cbds MCQ
4 pages
Clue
PDF
No ratings yet
Clue
4 pages
Isc Semester 2 Examination Sample Paper - 4 Computer Science Paper 1 (Theory)
PDF
No ratings yet
Isc Semester 2 Examination Sample Paper - 4 Computer Science Paper 1 (Theory)
11 pages
CP Btech 08 Mid Sem 19 09 08
PDF
No ratings yet
CP Btech 08 Mid Sem 19 09 08
2 pages
Soalan MidSem-SKEMA
PDF
No ratings yet
Soalan MidSem-SKEMA
6 pages
B.Sc. Electrical Engineering Technology Maximum Marks:: Switch-Case? A Sample Output of The Program Is Given Below
PDF
No ratings yet
B.Sc. Electrical Engineering Technology Maximum Marks:: Switch-Case? A Sample Output of The Program Is Given Below
2 pages
CSC 138 Exercises On Pointer March 2010
PDF
No ratings yet
CSC 138 Exercises On Pointer March 2010
5 pages
Test 1 Question (Dec 2016 - Apr 2017)
PDF
No ratings yet
Test 1 Question (Dec 2016 - Apr 2017)
16 pages
Tugas Pemprograman Komputer
PDF
No ratings yet
Tugas Pemprograman Komputer
12 pages
Institute of Petroleum Technology, Gandhinagar B.Tech 2007-End Semester Exam Computer Programming (161) Roll No. - Batch No.
PDF
No ratings yet
Institute of Petroleum Technology, Gandhinagar B.Tech 2007-End Semester Exam Computer Programming (161) Roll No. - Batch No.
4 pages
Attempt All Questions From This Section
PDF
No ratings yet
Attempt All Questions From This Section
4 pages
CS114 - Assignment1
PDF
No ratings yet
CS114 - Assignment1
2 pages
Final (Sem120132014)
PDF
No ratings yet
Final (Sem120132014)
11 pages
Icse Computer Project Work 2024-2025
PDF
No ratings yet
Icse Computer Project Work 2024-2025
4 pages
Universiti Tenaga Nasional: College of Computing and Informatics
PDF
No ratings yet
Universiti Tenaga Nasional: College of Computing and Informatics
10 pages
C++ Lab Assignment
PDF
No ratings yet
C++ Lab Assignment
13 pages
CSC128 CSC415
PDF
No ratings yet
CSC128 CSC415
11 pages
CSC128
PDF
No ratings yet
CSC128
11 pages