0% found this document useful (0 votes)
6 views6 pages

CTS Prep-Assessment

The document contains a series of programming questions and tasks related to algorithms, logic errors, and programming constructs. It includes scenarios involving wage calculations, loops, variable identification, and input/output requirements for a program. Additionally, it discusses validation routines for a car dealership's data entry system.

Uploaded by

jarrdeja
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)
6 views6 pages

CTS Prep-Assessment

The document contains a series of programming questions and tasks related to algorithms, logic errors, and programming constructs. It includes scenarios involving wage calculations, loops, variable identification, and input/output requirements for a program. Additionally, it discusses validation routines for a car dealership's data entry system.

Uploaded by

jarrdeja
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/ 6

1. Charley is writing a program for music students.

To make sure that there are no logic errors in the program,


Charley uses a test plan.

Describe what is meant by a logic error.


[2]

2. Jim is writing a program to calculate the wages of workers in a teddy bear factory.

Workers sometimes get a £50 bonus.

Here is the algorithm used to calculate whether a worker should get a bonus.

State the value of Pay after this code is executed for each of the following values of WagesEarned.

WagesEarned = 50 Pay = .....................................................


WagesEarned = 200 Pay = .....................................................
[2]

3(a). A programmer has written an algorithm to output a series of numbers. The algorithm is shown below:

01 for k = 1 to 3

02 for p = 1 to 5

03 print (k + p)

04 next p

05 next k

06 m = 7

07 print m * m
i. Give the first three numbers that will be printed by this algorithm.

[1]

ii. State how many times line 03 will be executed if the algorithm runs through once.

[1]

(b). Identify two basic programming constructs that have been used in this algorithm.

[2]

(c).

i. Describe what is meant by a variable.

[2]

ii. Identify two variables that have been used in the algorithm above.

[2]

4(a). The following program uses a condition-controlled loop.

x = 15
y = 0
while x > 0

y = y + 1
x = x – y

endwhile
print(y)

Complete the trace table to test this program.

x y output

[4]

(b). A teacher researches the length of time students spend playing computer games each day.

The teacher asks students how long they spend completing homework. Students answer in minutes and hours
(for example 2 hours 15 minutes).

The teacher would like to create an algorithm that will display students’ inputs in minutes only.

i. Identify the input and output required from this algorithm.

Input

Output

[2]
ii. A program is created to convert hours and minutes into a total number of minutes.

The teacher wants to create a sub program to perform the calculation.

The program has been started but is not complete.

Complete the design for the program.

hours = input("Please enter number of hours played")


minutes = input("Please enter number of minutes played")
finalTotal = .................................................................................
print(finalTotal)

function ................................................................................
................................................................................
................................................................................
................................................................................
................................................................................

endfunction

[4]

iii. The following flowchart outputs a message depending on how long each person has spent playing
computer games.

Rewrite the flowchart as a program.


You must use either:

• OCR Exam Reference Language, or


• a high-level programming language that you have studied.
[4]

5. A car dealership uses a computer system to record details of the cars that it has for sale. Each car has a make,
model, age and number of miles driven.

The car dealership only sells cars that have fewer than 10 000 miles and are 5 years old or less.

i. Write an algorithm that will:

• ask the user to enter the number of miles and the age of a car
• validate the input to check that only sensible values that are in the given range are entered
• output True if valid data has been entered or False if invalid data has been entered.

[5]

ii. The validation routine from part (i) must be tested with normal, erroneous and boundary test data.

Identify suitable test data for each type of test.

Miles Age
Normal

Erroneous

Boundary

[3]
END OF QUESTION PAPER

You might also like