Skip to content
EspañolWorkspace →

An online trace table for your pseudocode

A trace table (a desk check, or “prueba de escritorio” in Spanish-speaking classrooms) is how you follow an algorithm by hand: one row per step and one column per variable. Codoritmo fills it in while your program runs, so you can check the table you made on paper or find the exact step where a variable gets a value you didn't expect.

Run this trace in Codoritmo

Opens the same program; answer 12, 7.5, 30 and 0 to get this table.

A real trace table

This table comes from running the “Sum Until Zero” example with the answers 12, 7.5, 30 and 0. Each row shows the variables just before that line runs; highlighted cells changed since the previous row.

Trace table for “Sum Until Zero”
StepLineInstructionnumerosumacantidad
23Definir cantidad Como Entero00
34suma <- 0000
45cantidad <- 0000
56Escribir "Escribe números para sumar. Escribe 0 para terminar."000
67Leer numero000
78Mientras numero <> 0 Hacer1200
89suma <- suma + numero1200
910cantidad <- cantidad + 112120
1011Escribir "Siguiente número (0 para terminar):"12121
1112Leer numero12121
129suma <- suma + numero7.5121
1310cantidad <- cantidad + 17.519.51
1411Escribir "Siguiente número (0 para terminar):"7.519.52
1512Leer numero7.519.52
169suma <- suma + numero3019.52
1710cantidad <- cantidad + 13049.52
1811Escribir "Siguiente número (0 para terminar):"3049.53
1912Leer numero3049.53
2014Si cantidad > 0 Entonces049.53
2115Escribir "Sumaste ", cantidad, " números."049.53
2216Escribir "Total: ", suma049.53
2317Escribir "Promedio: ", suma / cantidad049.53

22 rows, one for each step with variables.

Answers typed
12, 7.5, 30, 0
What the console shows
Escribe números para sumar. Escribe 0 para terminar.
Siguiente número (0 para terminar):
Siguiente número (0 para terminar):
Siguiente número (0 para terminar):
Sumaste 3 números.
Total: 49.5
Promedio: 16.5

How to make a trace table in Codoritmo

  1. Open your algorithm

    Type it, paste it or open an example.

  2. Open the Desk Check tab

    In the bottom panel, choose the Desk Check tab.

  3. Step through it

    Use Step Forward: each step adds a row. If the program asks for values, answer them in the console.

  4. Go back to any step

    Click a row to return to that moment of the run: the code and the flowchart move to that line.

Run this trace in Codoritmo

Opens the same program; answer 12, 7.5, 30 and 0 to get this table.

How to read the table

The Step column counts the instructions run so far and Line says which one it was. An empty cell means the variable doesn't exist yet at that step.

Notice that line 8, the Mientras, appears only once: after each pass the condition numero <> 0 is checked again without adding a row, and the run carries on at line 9. When numero is 0, the loop ends and the run jumps to the Si on line 14.

What it's for

Teachers ask for trace tables so you understand what each instruction does. Do yours on paper first and then compare it with Codoritmo's: if they don't match, the first different row shows you where the difference is.

Codoritmo and PSeInt desktop

PSeInt also has a desk check inside its step-by-step mode. Here's how they compare.

What Codoritmo adds

  • The table fills itself in with every variable, with nothing to set up.
  • You can step back and click any row to return to that step.
  • Arrays appear as boxes in the Arrays tab.
  • As in PSeInt, you can evaluate an expression at any step and add it as a column to follow, such as suma / cantidad.

What PSeInt desktop does that Codoritmo doesn't yet

  • It works offline, as an installed program.

Codoritmo is an independent project, inspired by PSeInt and compatible with its syntax and school profiles. It is not PSeInt and is not affiliated with it. Official PSeInt website

Frequently asked questions

What is a trace table?

It's following an algorithm by hand, writing down each variable's value after every instruction. It helps you understand what the program does and find mistakes without running it.

Can I hand in Codoritmo's table?

Use it to check yours. If your teacher wants the trace table done by hand, do it yourself first and then use Codoritmo to verify it.

Why are some rows missing?

The table only shows steps where some variable already exists, and keeps up to the last 400. At instant speed only some steps are recorded; to see them all, use Step Forward or the slow or normal speed.

Solved programs, each with its code, its flowchart and a sample run.

  • Sum Until Zero

    Adds up the numbers you type until you enter a 0.

    Beginner
  • Factorial and Power

    Functions that compute a factorial and a power.

    Intermediate
  • Linear Search

    Finds a name in a list, ignoring upper and lower case.

    Intermediate
  • Bubble Sort

    Sorts random numbers by swapping neighbors, and stops as soon as they're in order.

    Intermediate

Keep learning