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

CT1 paper (B)

This document outlines the Class Test 1 for the Principles of Programming course at Tshwane University of Technology, scheduled for March 2024. It includes instructions for the test, a series of questions covering programming concepts, and tasks related to algorithms and calculations. The test consists of true/false questions, short answer questions, and practical programming exercises, totaling 35 marks.

Uploaded by

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

CT1 paper (B)

This document outlines the Class Test 1 for the Principles of Programming course at Tshwane University of Technology, scheduled for March 2024. It includes instructions for the test, a series of questions covering programming concepts, and tasks related to algorithms and calculations. The test consists of true/false questions, short answer questions, and practical programming exercises, totaling 35 marks.

Uploaded by

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

PPAFO5D/TROF05D CLASS TEST 1 March 2024

Faculty of Information and Communication Technology


ICT First Years and Foundation Unit

Principles of Programming and


Introduction to Programming
(Extended) (Year 1)

PPAF05D & TROF05D


CLASS TEST 1 B
I declare that I am familiar
with, and will abide to the 26 March 2024 Examiner: VL Baloyi
Examination rules of KS Tshehla
Tshwane University of Duration: 90 min
Technology Total: 35 Moderator: TA Maseko
Full Marks: 35 GROUP
Number of Pages: 7
_____________________
Signature

Student Number


= _____%
35 Surname Initials

Instructions:
Read instructions at the beginning of each question.
All questions must be answers on the question paper.
Only blue and black pens are allowed. Answers in pencil will not be marked.
Scientific, non-programmable calculators are allowed.
Cellular Phones are not allowed.
No sharing of calculators and/or stationery.
Round decimal answers to 2 decimal places.
Show all calculations when requested.

1
PPAFO5D/TROF05D CLASS TEST 1 March 2024

Question 1 (TRUE or FALSE) [8]

State whether the following statements are true or false.


Statements Answer

1.1 Multiplication is written as * in programming.

1.2 In programming languages values that have a decimal point in


them can be called real numbers.

1.3 student numbers must be stored in string variables.

1.4 Spaces are not allowed in variable names.

1.5 An algorithm is a step-by-step set of instructions.

1.6 On the IPO table, for the column of processing, is used to show
calculation formulas.

1.7 sPhoneNumber is a valid variable name.

1.8 Given iNum1 = 2, iNum2 = 5


The statement below will output 2*5=10
display “iNum1” + * + “iNum2=” + iAns

Question 2 (SHORT ANSWERS) [7]

2.1 Given values, iNum1 = 0 and iNum2 = 10 (1)


iAns is calculated as iAns = iNum1 + iNum2

What will be the output of the following statements?


iAns = iNum2/iNum1
display iNum2 + “/” + iNum1 + “ = ” + iAns
___________________________________________
___________________________________________
___________________________________________
2.2 What does the small letter at the beginning of a variable represent? (1)
___________________________________________
___________________________________________

2
PPAFO5D/TROF05D CLASS TEST 1 March 2024

2.3 Write a statement(s) to input a student number. Use variable (3)


sStudNum.

___________________________________________
___________________________________________
___________________________________________
2.4 Given a = 2, b = 3 and c = 4 (1)
When using the formula: a+b×c , a student got an answer of 20,
however the actual answer should be 14, correct the formula so it gives
the correct answer.

___________________________________________
___________________________________________
___________________________________________
2.5 Create a suitable variable to store the number of litres a bucket can (1)
carry.

___________________________________________
___________________________________________
___________________________________________

3
PPAFO5D/TROF05D CLASS TEST 1 March 2024
Question 3 [20]
3.1 A physicist at XYZ college is analysing the motion of objects, to determine their momentum. They are conducting several experiments but finds
it tiring to keep manually working out the momentum of each object. They know the mass and velocity, therefore they can work out the momentum
for themself. The formula they use is momentum = mass * velocity. You are tasked with creating a program to solve this issue. For now, you must
create the IPO table to show what is necessary. [4]
Assume that the numbers are decimals.
Ensure to use proper naming conventions.

Input Processing Output

4
PPAFO5D/TROF05D CLASS TEST 1 March 2024

3.2 Complete the following algorithm which will:


ABC wants to calculate the nett salary of it’s employees. They want a program that
will receive the monthly salary, then calculate and show the tax as well as the nett
salary (monthly salary + tax) . [3]
Please note, only write the line number and the corrected statement(s)

Answer:

___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________

5
PPAFO5D/TROF05D CLASS TEST 1 March 2024

3.3 Write an algorithm for a simple weekly pay calculator. Prompt the user to input
the number of hours worked and the hourly rate. Then, calculate and display the
amount earned, the bonus amount (bonus rate of 5%), and the total amount with the
bonus. [13]
Example 1:

Example 2:

Answer:

___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________

6
PPAFO5D/TROF05D CLASS TEST 1 March 2024

___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________
___________________________________________________

You might also like