0% found this document useful (0 votes)
39 views

SCS1101201301 Introduction To Computer Science and Programming

The document is an exam paper for an Introduction to Computer Science and Programming course. It contains 6 questions testing knowledge of computer fundamentals like data types, memory, operating systems, algorithms, and programming in C.

Uploaded by

n02019697m
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

SCS1101201301 Introduction To Computer Science and Programming

The document is an exam paper for an Introduction to Computer Science and Programming course. It contains 6 questions testing knowledge of computer fundamentals like data types, memory, operating systems, algorithms, and programming in C.

Uploaded by

n02019697m
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

NATIONAL UNIVERSITY OF SCIENCE AND TECHNOLOGY

FACULTY OF APPLIED SCIENCE

Examinations – January 2013


SUBJECT: INTRODUCTION TO COMPUTER SCIENCE AND PROGRAMMING
CODE: SCS 1101

Instructions to candidate:
1. Answer all questions from Section A and any two from Section B.
2. All programming questions to be answered in C
3. Each questions contains 20 marks
3 HOURS

Section A

QUESTION ONE

a) Compare and contrast the following:


i. Output device and input device [2]
ii. Compiler and interpreter [4]
iii. Knowledge society and Information society [4]
iv. scanf and printf [4]

b) Explain the two different types of errors in programming. Give examples in your
explanation. [6]

QUESTION TWO

a) Convert
i. 10010102 to base 4 [2]
ii. 1110.12 to base 16 [3]

b) Artificial intelligence is one of the attributes of the fifth generation of computers.


Explain artificial intelligence. [2]

c) Rewrite the C program below using a for loop statement [6]

Page 1 of 3
#include <stdio.h>

int main()
{
int i = 10;

do{
printf("Hello %d\n", i );
i = i -1;
}while ( i > 0 );
getch();
return 0;
}

d) Give the four data types in C and show how they are declared [4]

e) The size of a file is 14KB. Calculate the size of the file in bits. [3]

QUESTION THREE

a) Write a C program that converts decimal numbers to binary. [10]

b) Explain any two differences RAM and ROM memory [4]

c) Outline the functions of the CPU [6]

Section B

QUESTION FOUR

a) Write a program that reads an integer and checks whether it is odd or even.
Show the algorithm for this program using a flow chart.
For example:
Enter a number: 25
25 is an odd number. [20]

Page 2 of 3
QUESTION FIVE

a) The wind chill index (WCI) is calculated from the wind speed v in miles per hour
and the temperature t in Fahrenheit. Three formulas are used, depending on the
wind speed:
if (0 <= v <= 4) then WCI = t
if (v >=45) then WCI = 1.6t - 55
otherwise, WCI = 91.4 + (91.4 - t)(0.0203v - 0.304(v)1/2 - 0.474). Write a
program that can calculate the wind chill index. [15]

b) Explain the functions of an operating system [5]

QUESTION SIX

a) It would not be possible for education at NUST with Information Technology.


Discuss [10]

b) How do you declare the following in C:


i. Variable
ii. constant
iii. function [4]

c) Write a C program that finds the greatest number from an array of 5 integers
[6]

END OF QUESTION PAPER

Page 3 of 3

You might also like