Question
SULIT CONFIDENTIAL Soalan/Question 1 a) Jelaskan secara ringkas tentang tiga (3) jenis struktur ulangan berikut : Define briefly on the following three (3) types of
SULIT CONFIDENTIAL Soalan/Question 1 a) Jelaskan secara ringkas tentang tiga (3) jenis struktur ulangan berikut : Define briefly on the following three (3) types of loop structures: i) for() for() (5 markah/marks) ii) while() while() (5 markah/marks) iii) do-while() do-while) (5 markah/marks) b) Pertimbangkan pengisytiharan berikut: Consider the following declaration: char Faculty [30]; Perwakilan skema bagi tatasusunan adalah berikut: Schematic representation of the array is as follows: Faculty - --- i) Berapa banyak elemen akan digunakan untuk menyimpan nama "Faculty of Science and Technology"? How many elements will be used to store the name of "Faculty of Science and Technology"? (2 markah/marks) SULIT/ CONFIDENTIAL ii) Apakah kandungan bagi Faculty [0], Faculty[4], Faculty [6], dan Faculty [9]? What are the contents of Faculty[0], Faculty[4], Faculty[6], and Faculty [9]? (8 markah/marks) iii) Elemen manakah akan menyimpan aksara nul, lo"?
Which elements will store the null character, lo"? (2 markah/marks) Soalan/ Question 2 a) Apakah output bagi segmen aturcara berikut? What is the output of the following program segment? i) int p = 0, q = 0; for (p = 1; p =>
Consider a struct variable of Rekod in which their items will be stored at memory spaces as follows Name Matric No Gender Programme Year PNGS PNGK Tuliskan pengisytiharan bagi Rekod di atas. SULIT/ CONFIDENTIAL Write the declaration of Rekod above. (7 markah/marks) b) Pertimbangkan aturcara berikut: Consider the following program: #include void Functionl (void) { int a,b,c; a 2; b = 3; C = Function2 (3*a, 2*b+3); Function3 (c); } float Function2 (int p, int q) { float outcome; outcome = (p+0.34*q-2)/5.0; return (outcome); } void Function3 (float r) { printf(" Its result is %10.2f",r); 3 main() SULIT/ CONFIDENTIAL float y; y = 9.5; Function3 (3*y+1.0); Function1(); return 0; } i
) Tuliskan semula turutan fungsi takrifan pengguna supaya tiada mesej ralat daripada pengkompilasi apabila aturcara ini diuji. Rewrite the sequence of user definition functions in order that there is no any error of compilation as this program is tested. (8 markah/marks) ii) Apakah output bagi aturcara yang diperbetulkan pada soalan 3.b.i)? What is the output of the corrected program in the question 3.b.i? (6 markah/marks) iii) Tuliskan semula aturcara di atas tanpa penggunaan fungsi takrifan pengguna. Aturcara tersebut juga menghasilkan output yang sama seperti pada soalan
b. Rewrite the above program without using any user definition function. This program will give the same output as the question b. (8 markah/marks) Soalan/Question 4 SULIT/ CONFIDENTIAL a) Tuliskan aturcara yang hanya menerima satu nombor ganjil integer positif dan seterusnya mempaparkan corak berikut: Write a program that receives one positive integer odd number and then display the following pattern. Contoh/Example:
purata suhu tersebut. Seterusnya tentukan suhu tertinggi. Write a program to prompt user to enter the temperatures over 30 days and calculate the average temperature. Then determine the height of temperatures.
Can anyone please give me answer to these questions, these are my senior past year exam questions for computer programming but our lecturer refuse to give us the answer. This is not a homework or assignment, I want to do it by myself for practise.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started