0% found this document useful (0 votes)
17 views22 pages

Desk Check Technique Overview

The document is a guide on desk checking, a manual technique for verifying the logic of algorithms before coding. It outlines the structure of a desk check, including necessary columns for pseudo code line numbers, variables, conditions, and input/output values. The guide also provides examples of desk checks for various algorithms, demonstrating how to evaluate and record results systematically.

Uploaded by

happyneph12
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)
17 views22 pages

Desk Check Technique Overview

The document is a guide on desk checking, a manual technique for verifying the logic of algorithms before coding. It outlines the structure of a desk check, including necessary columns for pseudo code line numbers, variables, conditions, and input/output values. The guide also provides examples of desk checks for various algorithms, demonstrating how to evaluate and record results systematically.

Uploaded by

happyneph12
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

23/08/2023, 09:49 Desk Check Guide - INFORMATION TECHNOLOGY

Search this site


INFORMATION TECHNOLOGY

Home Page

Navigation Problem Solving and Programming‎> ‎


Home Page
0 Oct 4 2014 Saturday
Desk Check Guide
0 SAT OCT 26 2013
0- SBA PROGRAMMING
0-SBA 2013 Quality
0-September 23 2014 Desk checking is a manual (non computerised) technique for checking the logic of an algorithm. The
2. Question 9 and 10 for Jan
person performing the desk check effectively acts as the computer, using pen and paper to record
2011 as requested results. The desk checker carefully follows the algorithm being careful to rigidly adhere to the logic
Class Work specified. The desk check can expose problems with the algorithm.
CLASS WORK 1
Desk checks are useful to check an algorithm (before coding) thereby confirming that the algorithm
CLASS WORK FEB 28, 2015
works as expected and saves time possibly writing a program that doesn't do what was intended.
File Bucket
Another benefit of a desk check is that it confirms to the programmer/designer that the algorithm
Links performs as intended.
PRACTICE END OF TERM
EXAM A desk check is normally done as a table with columns for:
Quality SBA
SBA 2016 1. Pseudo code line number column (Pseudo code doesn't normally have lines numbers, but these
SUGGESTED ANSWERS FOR are necessary in a desk check to specify the line(s) being executed)
MOCK EXAM 2. One column per variable used. The columns should be in alphabetical order on variable name
0 EXAM FILES DEC 3 with the variable name at the top of the column. As the algorithm is executed, the new values of
0 SBA 2017
the variables are put in the appropriate column. Show working for calculations. If variable names
consist of a number of words it is permissible to put a space between each word in the name so
0 Syllabus
that the name fits better in the column by wrapping to the next line. e.g. the variable column
0 Test 1
heading discount Price could be used rather than the actual variable name discountPrice.
0- SBA 2014 JAN 3. A condition column. The result of the condition will be true (T) or false (F). As the algorithm is
000 WORK FOR SATURDAY MAY executed, conditions are evaluated and the details are recorded in the column. Show working
4 2013 when evaluating the conditions. This is used whenever a condition is evaluated - IF WHILE or
0000 - Test 2015 Past Paper FOR statements all have explicit or implicit conditions.
0000 - Test 2015 Past Paper

[Link] 1/22
23/08/2023, 09:49 Desk Check Guide - INFORMATION TECHNOLOGY

0000 - Test 2015 Past Paper 4. An Input/Output column is used to show what is input by the user and displayed by the
00TEST 1 program. Show inputs with: the variable name, a "?" and the value input e.g. price ? 200. Show
1 Access In class outputs with the variable name, an =, and the value displayed (or just the value displayed) e.g.
1. Sat Feb 9 discountPrice= 180 .
[Link] Fundamentals of Hardware Normally portrait page layout would be used for the desk check, however if the table is too wide,
and Software
landscape layout may be used.
MEMORY
Software Desk Checks vs Test Plans
13/12/16
3/14/2017 TEST A Desk Check concentrates on the value of variables and the logic i.e. what is the value of variable x
BLOG
after statement n; what is the next statement to be executed? A Test Plan focuses on the values of inputs
Practice Exam
and outputs required to test a program without concern for the internal workings i.e. are the results
(outputs) correct for the inputs?.
Class Work 17-11-2015
Class Work Dec 3, 2016
DATA REPRESENTATION
Example 1
1. Binary Algebra Problem Description: Calculate the discounted price of an item purchased. (Note: a problem
2. Hexadecimal description is not normally specified in a desk check, it is only included to assist in understanding the
[Link] to HEX problem.)
[Link]
CLASS WORK The following example shows desk checking involving sequence, executing instructions one after the
NOV 16 Class work other.
DATA SECURITY Sequence involves executing all instructions once, from top to bottom, one after the other.
DATA SECURITY/COM TEST
Hierarchy Chart Algorithm (with line numbers added for the Desk Check)
Information Processing 1 calcDiscountPrice()
Information Processing
Questions 2 Input price, discountPercent
Latest News
3 discount = price * discountPercent / 100
Untitled Post
Networking / Data Communication 4 discountPrice = price - discount
19-4-2016
5 Display discountPrice
PAST PAPERS
Practice Questions 6 STOP
Test Page
Problem Solving and
Desk Check
Programming
Test Data
ARRAYS

[Link] 2/22
23/08/2023, 09:49 Desk Check Guide - INFORMATION TECHNOLOGY

Boolean Expressions and Truth Inputs: price = $200, discountPercent = 10%.


Tables Correct results: discount = $20, discountPrice = $180.
Class Work Oct 2, 2012
Desk Check Guide
Linear Search
Line discount discount discount price Input/Output
Linear Search Program
Number Percent Price
Problem Solving Questions
1
Problem Solving Solution
Programming Errors
2 10 200 price ? 200; discountPercent ?
Productivity Tools
10
Database Management
Spreadsheets 3 200 * 10 / 100 =
Word Processing 20
QUIZ 1 OCT 18 2016
The Internet and Communications 4 200 - 20 =
Technology 180
Web page design
What ever 5 discountPrice = 180
Work For Thurs\Sat Feb
Sitemap 6
Recent site activity

Past Papers
Example 2
Home Problem Description: Calculate the discounted price of an item purchased. Customers receive a
Sitemap discount of 15% on an item if the purchase price of the item is over $100.
The following example shows desk checking involving selection using an IF.
For an IF without an ELSE, if the condition evaluates to True then execution continues to the next line
and the lines between the IF and ENDIF are executed (inclusive), otherwise (the condition is False)
execution jumps from the IF to the ENDIF.
Algorithm (with line numbers added for the Desk Check)
1 calcPrice()

2 Input price

3 IF price > 100 THEN

4 discount = price * 15 / 100


[Link] 3/22
23/08/2023, 09:49 Desk Check Guide - INFORMATION TECHNOLOGY
5 price = price - discount

6 ENDIF

7 Display price

8 STOP

Desk Check
Inputs: price = $200
Correct results: price = $170.

Line Number discount price Conditions Input/Output

2 200 price ? 200

3 200 > 100 ? is T

4 200 * 15 / 100 = 30

5 200 - 30 = 170

7 price = 170

Inputs: price = $50


Correct results: price = $50.

Line Number discount price Conditions Input/Output

2 50 price ? 50

[Link] 4/22
23/08/2023, 09:49 Desk Check Guide - INFORMATION TECHNOLOGY

3 50 > 100 ? is F

7 price = 50

Example 3
Problem Description: Display whether a student passed or failed a subject depending on their mark.
The following example shows desk checking involving selection using an IF-ELSE.
For an IF-ELSE, if the condition evaluates to True, execution continues to the next line after the IF and
the lines up to but excluding the ELSE are executed, then execution jumps to the ENDIF. If the
condition is False, execution jump from the IF to the ELSE, and the lines from the ELSE to the ENDIF
(inclusive) are executed.
Algorithm (with line numbers added for the Desk Check)
1 displayGrade()

2 Input mark

3 IF mark >= 50 THEN

4 grade = "Pass"

5 Display "Well done"

6 ELSE

7 grade = "Not pass"

8 ENDIF

9 Display grade

10 STOP

Desk Check

[Link] 5/22
23/08/2023, 09:49 Desk Check Guide - INFORMATION TECHNOLOGY

Inputs: mark = 75
Correct results: grade = "Pass", "Well done"

Line Number grade mark Conditions Input/Output

2 75 mark ? 75

3 75 >= 50 ? is T

4 Pass

5 "Well done"

9 Pass

10

Desk Check
Inputs: mark = 40
Correct results: grade = "Not pass"

Line Number grade mark conditions Input/Output

2 40 mark ? 40

3 40 >= 50 ? is F

7 Not pass "Well done"

[Link] 6/22
23/08/2023, 09:49 Desk Check Guide - INFORMATION TECHNOLOGY

9 Not pass

10

Example 4
Problem Description: Calculate the cost of electricity based on the electricity used.
The following example shows desk checking involving selection using a linear nested IF-ELSEs.
Algorithm (with line numbers added for the Desk Check)
1 calcElectrictyCost()

2 Input electricityUsed

3 IF electricityUsed < 1000 THEN

4 cost = 100

5 usageLevel = "Low"

6 ELSE

7 IF electricityUsed < 5000 THEN

8 cost = 100 + (electricityUsed - 1000) * 0.1

9 usageLevel = "Moderate"

10 ELSE

11 cost = 500 + (electricityUsed - 5000) * 0.08

12 usageLevel = "High"

13 ENDIF

14 ENDIF

15 Display cost, usageLevel

16 STOP

[Link] 7/22
23/08/2023, 09:49 Desk Check Guide - INFORMATION TECHNOLOGY

Desk Check
Inputs: electricityUsed = 500,
Correct results: cost = 100, usageLevel = "Low".

Line Number cost electricity Used usage Level Conditions Input/ Output

2 500 electricityUsed ? 500

3 500 < 1000 ? is T

4 100

5 Low

14

15 cost = 100, usageLevel = "Low"

16

Inputs: electricityUsed = 3000,


Correct results: cost = 300, usageLevel = "Moderate".

Line cost electricity usage Conditions Input/ Output


Number Used Level

2 3000 electricityUsed ? 3000

3 3000 < 1000 ?


is F

[Link] 8/22
23/08/2023, 09:49 Desk Check Guide - INFORMATION TECHNOLOGY

7 3000 < 5000 ?


is T

8 100 + (3000-1000)
* 0.1 = 300

9 Moderate

13

14

15 cost = 300, usageLevel =


"Moderate"

16

Inputs: electricityUsed = 15000,


Correct results: cost = 1300, usageLevel = "High".

Line cost electricity usage Conditions Input/ Output


Number Used Level

2 15000 electricityUsed ? 15000

3 15000 < 1000 ?


is F

7 15000 < 5000 ?


is F

10

[Link] 9/22
23/08/2023, 09:49 Desk Check Guide - INFORMATION TECHNOLOGY

11 500 + (15000-5000) *
0.08 = 1300

12 High

13

14

15 cost = 1300, usageLevel


= "High"

16

Example 5
Problem Description: Calculate the cost of water based on the water used and whether the customer is a
Domestic or Commercial user.
The following example shows desk checking involving selection using a non-linear nested IF-ELSEs.
Algorithm (with line numbers added for the Desk Check)
1 calcWaterCost()

2 Input waterUsed

3 IF waterUsed < 100 THEN

4 cost = 50

5 ELSE

6 Input customerType

7 IF customerType = "D" THEN

8 cost = waterUsed * 0.5

9 ELSE

10 cost = waterUsed * 0.6

[Link] 10/22
23/08/2023, 09:49 Desk Check Guide - INFORMATION TECHNOLOGY
11 Display "Commercial rate"

12 ENDIF

13 Display "High usage"

14 ENDIF

15 Display cost

16 STOP

Desk Check
Inputs: waterUsed = 70, customerType (not required)
Correct results: cost = 50

Line Number cost customer Type water Used Conditions Input/ Output

2 70 waterUsed ? 70

3 70 < 100 ? is T

4 50

14

15 cost = 50

16

Inputs: waterUsed = 200, customerType = D


Correct results: cost = 100

Line Number cost customer Type water Used Conditions Input/ Output

[Link] 11/22
23/08/2023, 09:49 Desk Check Guide - INFORMATION TECHNOLOGY

2 200 waterUsed ? 200

3 200 < 100 ? is F

6 D customerType ? D

7 D = D ? is T

8 200 * 0.5 = 100

12

13 High usage

14

15 cost = 100

16

Inputs: waterUsed = 200, customerType = C


Correct results: cost = 120

Line Number cost customer Type water Used Conditions Input/ Output

2 200 waterUsed ? 200

3 200 < 100 ? is F

6 C customerType ? C

[Link] 12/22
23/08/2023, 09:49 Desk Check Guide - INFORMATION TECHNOLOGY

7 C = D ? is F

10 200 * 0.6 = 120

11 Commercial rate

12

13 High usage

14

15 cost = 120

16

Example 6
Problem Description: Display a table of values of x and x squared. X is to start at 1 and increase by 1
up to 3.
The following example shows desk checking involving iteration (repetition) using a FOR loop.
The counter variable is initialized once at the top of the loop, the first time through the loop. The
implied condition is evaluated at the top of the loop, with execution going to the next line if the
condition is True and going to the line after the ENDFOR if the condition is False. In this case the
implied condition is x <= 3 ?. On the ENDFOR line the counter variable is incremented by 1, then
program execution loops from the ENDFOR line, back to the FOR line.
Algorithm (with line numbers added for the Desk Check)
1 calcSquares()

2 Display "X", "X Squared"

3 FOR x = 1 TO 3 DO

4 xSquared = x * x

[Link] 13/22
23/08/2023, 09:49 Desk Check Guide - INFORMATION TECHNOLOGY
5 Display x, xSquared

6 ENDFOR

7 Display "-----------"

8 STOP

Desk Check
Test Data
Input: None
Correct results: x = 1, xSquared = 1; x = 2, xSquared = 4; x = 3, xSquared = 9.

Line Number x xSquared Conditions Input/ Output

2 X, X Squared

3 1 1 <= 3 ? is T

4 1*1=1

5 x = 1, xSquared = 1

6 1+1=2

3 2 <= 3 ? is T

4 2*2=4

5 x = 2, xSquared = 4

6 2+1=3

3 3 <= 3 ? is T

4 3*3=9

[Link] 14/22
23/08/2023, 09:49 Desk Check Guide - INFORMATION TECHNOLOGY

5 x = 3, xSquared = 9

6 3+1=4

3 4 <= 3? is F

7 -----------

Example 7
Problem Description: Total a series of number input by the user. Allow the user to continue inputting
numbers until a negative number is input, then display the total of the numbers input.
The following example shows desk checking involving iteration (repetition) using a WHILE loop.
The condition is evaluated at the top of the loop, with execution going to the next line if the condition
is True and going to the line after the ENDWHILE if the condition is False. Program execution loops
from the ENDWHILE line, back to the WHILE line.
Algorithm (with line numbers added for the Desk Check)
1 totalNumbers()

2 total = 0

3 Input number

4 WHILE number >= 0 DO

5 total = total + number

6 Input number

7 ENDWHILE

8 Display total

9 STOP

Desk Check

[Link] 15/22
23/08/2023, 09:49 Desk Check Guide - INFORMATION TECHNOLOGY

Inputs: numbers = 10, 6, -1.


Correct results: total = 16

Line Number number total Conditions Input/Output

2 0

3 10 number ? 10

4 10 >= 0 ? is T

5 0 + 10 = 10

6 6 number ? 6

4 6 >= 0 ? is T

5 10 + 6 = 16

6 -1 number ? -1

4 -1 >= 0 ? is F

8 total = 16

Example 8
Problem Description: Calculate the membership fee for club members.
The following example shows desk checking involving sequence, selection and iteration (repetition).

[Link] 16/22
23/08/2023, 09:49 Desk Check Guide - INFORMATION TECHNOLOGY

Algorithm (with line numbers added for the Desk Check)


1 calcMembershipFees()

2 totalFees = 0

3 Input membershipType

4 WHILE membershipType <> "X" DO

5 IF membershipType = "F" THEN

6 membershipFee = 160

7 membershipName = "Full"

8 ELSE

9 IF membershipType = "J" THEN

10 membershipFee = 80

11 membershipName = "Junior"

12 ELSE

13 IF membershipType = "P"

14 membershipFee = 30

15 membershipName = "Pensioner"

16 ELSE

17 membershipFee = 10

18 membershipName = "Life"

19 ENDIF

20 ENDIF

21 ENDIF

22 totalFees = totalFees + membershipFee

23 Display membershipFee, membershipName

24 Input membershipType

[Link] 17/22
23/08/2023, 09:49 Desk Check Guide - INFORMATION TECHNOLOGY
25 ENDWHILE

26 Display totalFees

27 STOP

Desk Check
Inputs: membershipType = "J", membershipType = "F", membershipType = "X".
Correct results: membershipFee = 80, membershipName = "Junior"; membershipFee = 160,
membershipName = "Full"; totalFees = 240.

Line membership membership membership total Conditions Input/ Output


Number Fee Name Type Fees

2 0

3 J membership Type ? J

4 J <> X ? is
T

5 J = F? is F

9 J = J ? is T

10 80

11 Junior

20

21

22 0 + 80

[Link] 18/22
23/08/2023, 09:49 Desk Check Guide - INFORMATION TECHNOLOGY

= 80

23 membership Fee = 80,


membership Name =
Junior

24 F membership Type ? F

25

4 F <> X ? is
T

5 F = F? is T

6 160

7 Full

21

22 80 +
160 =
240

23 membership Fee =
160, membership
Name = Full

24 X membership Type ? X

25

4 X <> X ? is
F

26 totalFees = 240

27
[Link] 19/22
23/08/2023, 09:49 Desk Check Guide - INFORMATION TECHNOLOGY

Example 9
Problem Description: find the smallest of 3 numbers.
The following example shows desk checking involving subroutines.
When a subroutine is called, execution goes from the calling line (subroutine call e.g. line 3 in this
example) to the first line in the subroutine (e.g. line 6). The subroutine is then executed, and when the
end of the subroutine is reached (e.g. line 14), execution goes back to the line after where it was
originally called (e.g. line 4).
Algorithm (with line numbers added for the Desk Check)
1 compareNumbers()

2 Input number1, number2, number3

3 getSmallestNumber()

4 Display smallest

5 STOP

6 getSmallestNumber()

7 smallest = number1

8 IF number2 < smallest THEN

9 smallest = number2

10 ENDIF

11 IF number3 < smallest THEN

12 smallest = number3

13 ENDIF

14 EXIT

Desk Check

Inputs: number1 = 5, number2 = 3, number3 = 8.


Correct result: smallest = 3.

[Link] 20/22
23/08/2023, 09:49 Desk Check Guide - INFORMATION TECHNOLOGY

Line number1 number2 number3 smallest Conditions Input/ Output


Number

2 5 3 8 number1 ? 5; number2 ? 3;
number3 ? 8

7 5

8 3 < 5 ? is T

9 3

10

11 8 < 3 ? is F

13

14

4 smallest = 3

Inputs: number1 = 7, number2 = 12, number3 = 9.


Correct result: smallest = 7.

Line number1 number2 number3 smallest Conditions Input/ Output


Number

[Link] 21/22
23/08/2023, 09:49 Desk Check Guide - INFORMATION TECHNOLOGY

2 7 12 9 number1 ? 7; number2 ? 12;


number3 ? 9

7 7

8 12 < 7 ? is
F

10

11 9 < 7 ? is F

13

14

4 smallest = 7

Comments

You do not have permission to add comments.

Sign in | Recent Site Activity | Report Abuse | Print Page | Powered By Google Sites

[Link] 22/22

You might also like