Study Skills

How to Prepare for a Programming Exam (Written and Viva)

A practical plan for college programming exams that combine written code-writing questions with an oral viva: what to revise, how to practise writing code by hand, and how to handle the viva component.

QuizMaster TeamSeptember 25, 20269 min read

College programming exams are often different from an online multiple-choice quiz: you may need to write working code by hand on paper, trace through a program's output, and then defend your answers in a short viva. This guide covers all three parts.

Understand the exam format first

Before you revise, find out exactly what the exam will ask for. Common formats include:

  • Writing a complete program for a given problem (such as sorting an array or implementing a simple class).
  • Tracing code by hand and writing down its output, step by step.
  • Short-answer theory questions (definitions, comparisons, advantages/disadvantages).
  • A practical lab component where you run and debug your own code.
  • A viva where an examiner asks you to explain what you wrote.

Ask your instructor or check previous years' papers for the actual mix, and weight your revision accordingly instead of guessing.

Revise the syllabus topics, not everything

List the topics your syllabus actually covers, and rank them by how often they appear in past papers. For a first programming course this usually means variables and types, conditionals, loops, functions, arrays or lists, strings, and basic object-oriented concepts. Do not try to cover everything the language offers; focus your limited time where the marks are.

Practise writing code without an editor

Exams that ask you to write code by hand remove autocomplete, error highlighting and instant feedback, which changes what "knowing" a topic means. Practise by:

  1. Writing a short program (10-20 lines) on paper or in a plain text file with no IDE help.
  2. Running it afterwards to check for syntax slips: missing colons, mismatched brackets, incorrect indentation.
  3. Repeating with a few standard problems: reversing a list, finding the maximum value, counting vowels in a string, checking if a number is prime.

This single habit closes most of the gap between "I understand this" and "I can produce correct code for it under exam conditions."

Practise tracing code

Many papers include a snippet and ask you to state its output. Trace it the same way a computer would: write down each variable's value after every line that changes it, and update a small table as you go. Do this with loops especially, since off-by-one mistakes (loops that run one time too many or too few) are the most common trace-question trap.

Do not skip the theory questions

"What is the difference between X and Y" questions are easy marks if you prepare short, precise comparisons in advance: list versus array, compile-time versus run-time error, function versus method, and so on. Write these comparisons out once in your own words rather than trying to memorise a textbook's phrasing.

Preparing for the viva component

A viva examiner is usually checking three things: do you understand what your code does, can you explain a concept clearly, and can you think on your feet when asked a follow-up. To prepare:

  • Be ready to explain any code you submit, line by line, including why you chose a particular approach.
  • Practise answering "why" questions, not just "what" questions: why did you use a loop here instead of recursion, why is this variable declared outside the function.
  • Keep answers short first, then expand only if asked. A long rambling answer to a simple question reads as uncertainty, not thoroughness.
  • If you do not know an answer, say so directly and reason through what you do know, rather than guessing silently.

A one-week revision plan

  • Days 1-2: list the syllabus topics and rank them; revise the highest-weight theory topics with short written comparisons.
  • Days 3-4: practise writing 8-10 small programs by hand, then test them.
  • Day 5: practise tracing code, including at least three loop-heavy examples.
  • Day 6: take topic quizzes such as the Python Basics quiz or Java Fundamentals quiz in exam mode.
  • Day 7: do a mock viva with a classmate, where each of you explains a program you wrote and answers follow-up questions.

On exam day

Read the full question before writing anything, note the marks allocated to each part so you can pace yourself, and attempt every part of a multi-part question, even briefly, since partial answers usually still earn partial marks. For a viva, listen to the full question before answering, and ask for clarification if a question is ambiguous rather than guessing what was meant.

Key takeaways

  • Find out the actual exam format before you revise, and weight your time accordingly.
  • Practise writing and tracing code without IDE help; this is the skill most different from everyday practice.
  • Prepare short, precise comparisons for common "difference between X and Y" questions.
  • For a viva, be ready to explain your own code and reasoning, not just recite definitions.