You are on page 1of 1

MOCK EXAM – No.

2
(Duration: 60 minutes)

Module: Elementary Programming with C (Total: 20 marks)

Question 1 (8 marks):
Write a program to input an array of 10 integers. Display to the screen arrays just
entered and show all prime numbers in the array

Question 2 (10 marks):


Create a structure data type: Student: code (char [5]), name (char[40]), score
(double), grade (char) (1 marks).
Write a function to input the 5 students from the keyboard, save 5 students into
an array and save array to a binary file, name as “result.txt”. (5 marks)
Write a function to read the results from file “result.txt” and display to the screen
the students have grade = ‘A’ or grade = ‘B’. (3 marks)
In the main(), call just write functions to run the program (1 marks)

Question 3 (2 marks):
Write a program that prints out the triangle * is isosceles triangle
*
***
*****
*******
*********
***********

You might also like