Skip to main content
My learning

Your progress, your control

Guest progress stays in this browser.

All topics

Focused practice

Programming foundations

Reason about simple code, data structures, and algorithms.

Make time for a small step

Answer at your own pace, skip a question when needed, and review every explanation at the end. Answers save when you finish the session.

This topic has 6 questions. A difficulty filter may shorten your session.

A useful way to practise programming foundations

Trace small examples carefully before reasoning about larger inputs. Programming fundamentals include understanding how values change, which data structure fits an operation, and how an algorithm's work grows with its input.

  1. Track variable values after each loop iteration instead of jumping to the final result.
  2. Check a small or empty input and distinguish the number of operations from the actual running time on one machine.
  3. Explain why a data structure supports an operation, then compare the alternative choices.

A worked example

A loop that visits each of n items once performs work proportional to n, commonly written O(n). Two complete passes still give O(n), while a nested loop visiting every pair of n items usually gives O(n²). Always examine the actual loop bounds.