100% found this document useful (1 vote)
210 views

Questions

This document contains 5 questions about computer programming concepts. Question 1 asks about the differences between programs and programming languages, and the classifications and characteristics of machine language, assembly language, high-level languages, and natural languages. Question 2 provides pseudocode problems involving conditionals, loops, and calculating sums and averages. Question 3 asks the user for age and outputs a message about driving eligibility. Question 4 calculates weekly pay based on hourly rate and regular/overtime hours. Question 5 uses conditionals to output messages based on temperature ranges.

Uploaded by

NJUGO MCHUNJUGO
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
210 views

Questions

This document contains 5 questions about computer programming concepts. Question 1 asks about the differences between programs and programming languages, and the classifications and characteristics of machine language, assembly language, high-level languages, and natural languages. Question 2 provides pseudocode problems involving conditionals, loops, and calculating sums and averages. Question 3 asks the user for age and outputs a message about driving eligibility. Question 4 calculates weekly pay based on hourly rate and regular/overtime hours. Question 5 uses conditionals to output messages based on temperature ranges.

Uploaded by

NJUGO MCHUNJUGO
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

CSS 112: PRINCIPLES OF COMPUTER PROGRAMMING

TUTORIAL SHEET 1

Question One
a) What is the difference between a programme and a programming language?
b) Programming language are classifies as Machine language, Assembly
language, High-level languages and Natural languages or very high-level
languages. Describe advantages and disadvantages of each.
c) What do compilers and interpreters do, and how do they differ?

Question Two
a) What is the output of the following pseudocode? (Assume the user enters 21
and all output is displayed on the same line)
input myNumber
if myNumber > 4 then
display myNumber
else
increase myNumber by 1
endif
display myNumber
b) Design an algorithm expressed in terms of flowchart and pseudo-code for
i) Finding the sum of N numbers.
ii) Adding the test scores as given as: 26, 49, 98, 87, 62, 75
iii) Reading four numbers. If the first number is positive the algorithm
should calculate the sum of all four numbers otherwise the algorithm
must calculate the average of the last three numbers.
c) Write the basic pseudo code IF-THEN-ELSE statement for each of the
following:
i) If sum is greater than 100, print sum.
ii) If sum is greater than 5, print sum else add 10 to sum.
iii) If grade is greater than or equal to 90, print “A” else if grade is greater
than or equal 80, print “B”, else print “F”.

Question Three
Obtain a name and age from the user. If the user is 16 or older, output a message
indicating they are old enough to drive. For people under 16, output a message
indicating how many years they must wait before they can drive legally.

Question Four
Obtain from the user an hourly pay rate and the number of hours worked for
the week. Calculate and output their weekly pay according to the following:
 Regular pay is the pay up to 40 hours
 Overtime pay is pay for the hours over 40
 Overtime is paid at a rate of 1.5 times the hourly rate
 Gross pay is the sum of the regular p

Question Five
Obtain a temperature in degrees Fahrenheit from the user. If the temperature is
80 degrees or more display the message "Go play golf" otherwise, if the
temperature is 70 - 79 degrees display the message "Put on a jacket", otherwise
display the message "It is way too cold." Make a variable list, flowchart, and
perform a desk check using the following values: 95, 72, 50

You might also like