Quiz 2

Computational Thinking · Week 1 — Variables & representation

1209 words
6 min read
2026-08-16T00:00:00.000Z
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

state, iterators, datatypes, flowcharts — concepts, pattern families, and traps for Quiz 2 week 1. # Week 1 — variables & representation > **Quiz 2 scope:** Weeks 1–8 per IITM May 2026 foundation courses.

Week 1 — variables & representation

Quiz 2 scope: Weeks 1–8 per IITM May 2026 foundation courses. Source baseline: IITM BS admissions important-dates calendar · May 2026 cycle. Times on assessments are operational conventions — verify hall ticket.
Part of the Quiz 2 prep system%20%C2%B7%20%5BWeeks%201%E2%80%938%20index%5D(.%2Fmay-2026-ct-quiz-2-weeks-1-8-prep) · Pattern atlas · Formula chains.

Week map

Problem → variables → datatype → flowchart boxes → trace state

Classify → Represent → Execute → Trap-check

  • Recognize: Ask: What does a diamond represent in a flowchart?
  • Procedure: Follow arrows from Start. At diamond, one branch taken. Update variables in rectangles before next decision.
  • Variations / traps: Watch for: Skipping decision branch label (Y/N).

Formula chain (compressed)

state variables → datatype → assignment updates → flowchart ↔ trace.
  1. Statenamed variables hold values — trace step by step
  2. Assignmentx ← expression — RHS evaluated first
  3. Iteratorloop counter / index — repeated steps
  4. Datatypeint, float, str, bool — legal operations
  5. Flowchartboxes + arrows — algorithm before code

Deep study

Computational Thinking · Week 1 — Variables and state

CT week 1 builds representations: naming quantities, picking datatypes, and tracing state through flowcharts or pseudocode.

Week map

Problem → variables as named state → datatypes → iterators → flowchart symbols → state snapshots → input/output boxes.

Representation notation

  • Variable → name bound to a value that may change → count, total, name.
  • State → all current variable values at one instant → snapshot table one row per step.
  • Iterator → variable stepping through a sequence or count → i from 0 to n-1.
  • Datatype → kind of value → determines legal operations → number vs string vs list.

Flowchart symbols

ShapeRoleExample action
Ovalstart / endStart, Stop
Rectangleprocesstotal ← total + price
Diamonddecisionscore ≥ 50?
Parallelograminput / outputRead age, Print sum
Arrow direction defines order. At a diamond, follow one branch label (Y/N or T/F).

Choosing a representation

Ask three questions:
  1. Single vs collection? One score → number; list of scores → list.
  2. Fraction allowed? Integer count vs float average.
  3. Text vs number? ID as string even if digits; phone codes not for arithmetic.
Mini-example: Track 5 quiz scores → list scores length 5, not five unrelated names unless table fixed.

State snapshot tracing

Problem: start x=3, y=1. Process: y ← x + y, then x ← y - 2.
stepxy
init31
after 1st34
after 2nd24
Read as: assignment uses current values when evaluating right-hand side.

Pattern families

Easy — Read flowchart step

  • Follow arrows; update rectangles; branch at diamond once.
  • Identify start/end and missing arrow bugs in diagrams.
  • Match parallelogram to Read/Print in trace.

Medium — Choose datatype and names

  • From word problem, list variables and types.
  • Distinguish index (position) vs value at index.
  • Flowchart with two variables swapping — track both columns.

Hard — Full state table

  • Multi-step with decision: duplicate row only along taken branch.
  • Iterator introduced mid-flow: when does i increment?
  • Detect unreachable rectangle (no arrow in).

Worked mini-examples

Example 1 — Simple trace.
Start a=10, b=2. a ← a - ba=8. b ← a + bb=10.
Example 2 — Decision.
n=7. Diamond: n > 5? Yes → msg ← "big". Else branch skipped. msg is "big".
Example 3 — Iterator intro.
i=0, sum=0. Loop body: sum ← sum + i, i ← i + 1, repeat while i < 4.
isum after step
00
10
21
33
46
Loop stops when i becomes 4.
Example 4 — Wrong type choice.
Storing price = "12.50" then total = price + 5 concatenates strings in Python-like semantics — representation error if numeric total intended.

Traps

  • Skipping decision branch label — both paths mentally.
  • Same name for two concepts (total for both count and sum).
  • Using value before rectangle that assigns it.
  • Iterator confused with stored data value (i vs item[i]).
  • Flowchart arrow bypassing update rectangle.

Diagnostic (try yourself)

  1. Start p=5, q=3. Execute p ← p + q then q ← p - q. What are final p and q?
  2. A flowchart diamond asks x < 0. If x = 0, which branch (Y/N) is taken for “less than zero”?
  3. You need to store a student’s 8 weekly quiz percentages. One variable or a collection? Which datatype class?
  4. Trace c=1, d=4, then c ← d, d ← c. What are c and d? (Watch order.)
  5. In a state table, why duplicate rows only on the taken branch after a decision?

ChatGPT prep archive

Archived import for extra depth — complements the notes above, not official IITM material.

Core concepts

  • Variable names a value that can change; iterator often counts or walks a collection.
  • Datatypes: number, string, boolean, list—operations depend on type.
  • Flowchart: start/end ovals, process boxes, decision diamonds, arrows show order.
  • State snapshot: all variable values at one step.

Notation & vocabulary

FlowchartMeaning
Rectangleprocess / assign
Diamonddecision
Parallelograminput/output

Pattern families

Easy — Read flowchart step

Follow arrows from Start. At diamond, one branch taken. Update variables in rectangles before next decision.

Medium — Choose representation

Pick variable names for quantities in word problem. Decide int vs float vs list based on whether fractional, textual, or collective data.

Hard — State table trace

Columns for each variable; rows for each step. Decision rows branch—duplicate state only along taken path.
Drill these on the pattern atlas — filter to week 1.

Traps

  • Skipping decision branch label (Y/N).
  • Same variable name for different concepts.
  • Flowchart arrow bypassing a required update.
  • Confusing iterator index with value stored.

Retrieval prompts

  1. What does a diamond represent in a flowchart?
  2. What is a state snapshot?
  3. When represent data as list vs single variable?

Practice loop

  1. Read Deep study (if present) or core concepts once.
  2. Recite the formula chain without looking.
  3. Open one easy pattern on the interactive atlas for week 1.
  4. Attempt without solutions; mark studied after an honest try.
  5. Say one trap aloud before closing the tab.
Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.