Code breaking using Trace Tables

In the following set of challenges, you will use a trace table to workout the secret code of the following six padlocks. Before attempting this challenge, you may want to find out mode about the use of trace tables when testing or predicting the output of an algorithm.

Padlock #1Padlock #2Padlock #3Padlock #4Padlock #5Padlock #6

Padlock #1:


The following code will help you work out the combination (code) to open padlock #1 (see below)

Trace Table

 Line NumberidigitcodeOUTPUT
1“”
21
32
4“2”
22
34
4“24”
23
36
4“246”
6246

Padlock


Input the combination on the padlock below and click on “Unlock?” to test your combination.

Padlock #2:


The following code will help you work out the combination (code) to open padlock #2 (see below)

Trace Table


Complete the following trace table to work out the 3-digit padlock code:
 Line NumbercodeOUTPUT
1

Padlock


Input the combination on the padlock below and click on “Unlock?” to test your combination.

Padlock #3:


The following code will help you work out the combination (code) to open padlock #3 (see below)

Trace Table


Complete the following trace table to work out the 3-digit padlock code:
 Line NumbercodeOUTPUT
1

Padlock


Input the combination on the padlock below and click on “Unlock?” to test your combination.

Padlock #4:


The following code will help you work out the combination (code) to open padlock #4 (see below)

Trace Table


Complete the following trace table to work out the 3-digit padlock code:
 Line Numbercodecode MOD 2 == 0 ?OUTPUT
1

Padlock


Input the combination on the padlock below and click on “Unlock?” to test your combination.

Padlock #5:


The following code will help you work out the combination (code) to open padlock #5 (see below)

Trace Table


Complete the following trace table to work out the 3-digit padlock code:
 Line Numbercodecode>20 ?code<=10 ?OUTPUT
1

Padlock


Input the combination on the padlock below and click on “Unlock?” to test your combination.

Padlock #6:


The following code will help you work out the combination (code) to open padlock #6 (see below)

Trace Table


Complete the following trace table to work out the 3-digit padlock code:
 Line Numbercodecode<1000 ?OUTPUT
1

Padlock


Input the combination on the padlock below and click on “Unlock?” to test your combination.

Did you like this challenge?

Click on a star to rate it!

Average rating 4.3 / 5. Vote count: 6

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!