0% found this document useful (0 votes)
21 views2 pages

Com 121

Uploaded by

Dan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views2 pages

Com 121

Uploaded by

Dan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

DEPARTMENT OF COMPUTER SCIENCE

GLORYLAND POLYTEHNIC, ANKPA-KOGI STATE


SECOND SEMESTER EXAMINATIONS FOR 2022/2023 SESSION
COURSE TITLE: Programming Using C Language
COURSE CODE: COM 121 LEVEL: ND I TIME: 2 HRS
INSTRUCTION: ATTEMPT FIVE (5) QUESTIONS ONLY. No 1 is compulsory
Question 1:
(a) What is programming language? Briefly explain how programming language works.
(b) Write a short note on C-Programming and State five (5) reasons for C-Language.
(c) Write a c program to calculate the area of a circle. Given: Area = PI *R 2, R = 6 and PI =
3.142. The answer should be rounded to two decimal places.

Question 2:
(a) Explain the following terms in C programming with examples:
(i) Token (ii) Comments (iii) Semicolon (iv) Header files
(b) Identify the tokens available in the statement below and their respective function.
printf("Programming is fun \n");
Question 3:
(a) With adequate example, explain the following C programming terms:
(i) keyword (ii) Expression (iii) Statement (iv)Symbolic Constants
(b) Debug and rewrite the correct version of the C program given below in your answer booklet:
#include
main()

int distance=33
float time=10.7
char school;
double speed;
speed=distance*time;
printf("value of time taken is %f\n", );
printf("value of distance taken is %d\n",distance);
printf("value of speed of car is %.4f\n",speed);
}
Question 4:
(a) Give the syntax for the following decision making statements in C programming
(i) if statement (ii) if...else statement (iii)switch statement
(b) Demonstrate the use of switch statement with a valid example.

Question 5:
(a) Outline the four (4) categories of operators in C-Programming and list out their respective
operators.
(b) Write complete C program to show the use of Relational and Logical Operators.

Question 6:
(a) Write a C program to calculate the percentage of a user's score in relation to the
maximum score in a game if the maximum score is 500 and the user’s score is 420.
(b) Give the output for the c program below:
#include <stdio.h>
main()
{
int a = 20;
int b = 10;
int c = 15;
int d = 5;
int e;
e = (a + b) * c / d;
printf("Value of (a + b) * c / d is : %d\n", e );
e = ((a + b) * c) / d;
printf("Value of ((a + b) * c) / d is : %d\n" , e );
e = (a + b) * (c / d);
printf("Value of (a + b) * (c / d) is : %d\n", e );
e = a + (b * c) / d;
printf("Value of a + (b * c) / d is : %d\n" , e );
return 0;
}

Question 7:
(a) Assuming a student’s grade is A in a given course. Use a switch statement to write a
program that prints the student’s grade.
(b) With a valid code snippet, show the difference between the “gets function” and “puts
function”

You might also like