← Back to blog
Study science

How to Study for Intro to Computer Science (CS1)

How to study for intro to computer science: trace code by hand, learn the Python traps exams test, drill exceptions and Big-O, and practice coding every week.

Intro to computer science is two courses sharing one syllabus. The first is a skill: writing programs that work. You can only build it by writing code, running it and fixing it. The second is a body of knowledge: what a given line does, which exception it raises, what a function returns, how fast an algorithm grows. That half is tested on paper, often without a computer, and it responds to the same study methods as any other course.

Most students only do the first half and are surprised when the exam asks them to predict output from a snippet they have never seen. Here is how to cover both.

How CS1 is tested

Typical exam questions fall into four groups:

The first three are concept work. The fourth needs real practice in an editor, plus the habit of writing code by hand at least occasionally before the exam.

Trace before you run

The single most useful skill in CS1 is tracing: walking through code line by line and tracking every variable's value on paper. Students who run code to see what it does learn less than students who predict first and then run it to check. The prediction is what builds the mental model, which is the generation effect at work: producing an answer yourself makes it stick better than reading one.

A simple routine for every example in your textbook or lecture:

  1. Cover the output.
  2. Write down what you think it prints, with the value of each variable after each line.
  3. Run it.
  4. If you were wrong, find the exact line where your trace and Python disagreed.

Step 4 is where the learning happens. A wrong prediction you track down teaches more than ten right ones.

Learn the traps on purpose

CS1 exams return to the same small set of beginner traps. Encodr's Intro to Computer Science course seeds them across units deliberately, and it is worth knowing them by name. Each of these was run in Python 3:

```python print(7 / 2, 7 // 2, -7 // 2, -7 % 2) # 3.5 3 -4 1 print(0.1 + 0.2 == 0.3) # False print(round(2.5), int(-5.9)) # 2 -5

a = [1, 2, 3] b = a b.append(4) print(a) # [1, 2, 3, 4]

def add_item(item, lst=[]): lst.append(item) return lst

print(add_item("x")) # ['x'] print(add_item("y")) # ['x', 'y']

names = ["Ana", "Bo"] names = names.append("Cy") print(names) # None ```

What each one tests:

Make a one-line card or note for each trap and review them until you spot them on sight.

Exceptions are a vocabulary list

"Which exception does this raise?" questions are pure recall once you know the categories, and they are easy points:

ExceptionTypical cause
TypeErrorWrong type for the operation, like "5" + 5
ValueErrorRight type, unsuitable value, like int("3.5")
IndexErrorSequence position out of range (slices never raise it)
KeyErrorMissing dictionary key
NameErrorA name that was never assigned
AttributeErrorAn object without that attribute or method
ZeroDivisionErrorDividing or taking modulo by zero

Drill these with retrieval, not rereading. Cover the right column and name the cause, then cover the left column and name the exception. The testing effect explains why that beats looking at the table again.

Recursion and Big-O: draw it

Recursion and algorithm analysis are where many students stall, mostly because they try to hold everything in their head.

For recursion, draw the call stack. Write each call as a box with its own parameter values, stack the boxes as calls are made, and pass return values back down as each box finishes. After a few factorial and string-reversal traces, the pattern becomes visible: statements before the recursive call run on the way down, statements after it run on the way back up.

For Big-O, count how many times the innermost line runs as the input grows. A single loop over n is O(n), nested loops multiply to O(n^2), and a loop that doubles its counter is O(log n). Big-O notation explained for beginners works through each pattern with code you can run.

A weekly rhythm that covers both halves

Spacing matters more than total hours. A topic reviewed for ten minutes on four separate days is usually retained better than the same forty minutes in one sitting; cramming vs spacing summarizes the research. The Pomodoro timer is a simple way to keep coding sessions focused without running long.

Where the course goes next

What's in Intro to Computer Science maps all 16 units so you can see where you are in the sequence. If you are heading toward IT, the same habits carry into certification study: how to study for Security+ SY0-701 applies retrieval and spacing to a much larger vocabulary. And the trace-every-step discipline is the same one that makes debits and credits click in accounting, where every transaction has to leave the books in balance.

The course is free, alongside the other gen-ed course flashcards on Encodr.

Encodr turns this into a habit: study anything in a feed, and it schedules the rest.

Get started free

Related posts