You are on page 1of 1

MOCK EXAM – No.

1
(Duration: 60 minutes)

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

Question 1 (6 marks):
Write a program to calculate the sum of the prime numbers less than 1000.

Question 2 (8 marks):
a) Create a structure data type: Student: code (char [5]), name (char [40]), eng
(float), math (loat), comp (loat), avg (float), grade (char). (2 marks)
b) Declare an array of 5 students, write a function to input 5 students from the
keyboard. (2 marks)
c) Write a function to display to the screen the students have grade = ‘A’ or grade =
‘B’. (3 marks)
d) In the main(), call just write functions to input and display information students.
(1 marks)

Question 3 (6 marks):
a) Enter a string from the keyboard, move all the characters of string to upper
characters, then save the string to a file,named as : data.txt. (4 marks)
b) Open data.txt file to read and then print the data in the file to the screen.
(2marks)

You might also like