Study guide
10.1 Variables, Types & Operators
U.S. Air Force Cyber Test CSAT/ICTL
Track your progress as you read
Finished sections get a check mark.
1 Introduction & Exam Overview
1.1 Current Exam Facts 1.2 Cyber AFSCs & Qualification Pipeline 1.3 How to Use This Guide & Study Plan
2 Number Systems & Encoding
2.1 Binary & Decimal Conversion 2.2 Hexadecimal & ASCII 2.3 Bitwise Operations & Two's Complement
3 Computing Architecture
3.1 Memory Hierarchy 3.2 CPU, Components & Data Path 3.3 Core Data Structures
4 Boolean Logic & Storage
4.1 Boolean Algebra & Logic Gates 4.2 Encoding, Files & Storage Concepts
5 Networking Models
5.1 OSI Model 5.2 TCP/IP Model & Encapsulation 5.3 Topologies & Transmission Media
6 Addressing & Subnetting
6.1 IPv4 Addressing 6.2 Subnetting & CIDR 6.3 IPv6 Fundamentals
7 Protocols & Network Services
7.1 TCP, UDP & Well-Known Ports 7.2 DNS & DHCP 7.3 Routing & Switching Basics
8 Cybersecurity Foundations
8.1 CIA Triad & Security Goals 8.2 Threats, Vulnerabilities & Malware 8.3 Social Engineering & Human Factors
9 Defensive Controls
9.1 Access Control & Authentication 9.2 Firewalls, IDS & IPS 9.3 SIEM & Defense in Depth
10 Programming Fundamentals
10.1 Variables, Types & Operators 10.2 Control Flow 10.3 Functions & Recursion
11 Languages & Debugging
11.1 Python Essentials for the Cyber Test 11.2 C++ Basics & Debugging Concepts
12 Operating Systems
12.1 Linux Fundamentals & Commands 12.2 Windows Fundamentals 12.3 Processes, Permissions & File Systems
13 Cryptography
13.1 Symmetric Encryption (AES) 13.2 Asymmetric Crypto & PKI 13.3 Hashing, MACs & Integrity
14 ICTL-Style Logic Reasoning
14.1 Deductive Logic & Syllogisms 14.2 Sequences & Pattern Recognition 14.3 Arrangement & Conditional Puzzles
15 Test Strategy & Mixed Review
15.1 Pacing, Elimination & AF Testing Day 15.2 Mixed Domain Review & Next Steps
10.1 Variables, Types & Operators
Key Takeaways Explain This Topic AI
A variable is a named storage location; its type constrains what values it can hold and which operations are valid
Assignment (=) stores a value; equality (==) compares two values — confusing them is a classic Cyber Test trap
Arithmetic (+ − * / %), comparison (< > <= >= == !=), and logical (AND OR NOT) operators combine into expressions evaluated by precedence rules
Integer division truncates toward zero in many languages; mixing types can produce unexpected results without an explicit cast
- Tracing code means updating a mental table of variable names and values after each statement in order
- Last updated: July 2026
Programming questions on the USAF Cyber Test (CSAT/ICTL heritage) rarely ask you to write long programs. They ask you to read short snippets , predict values, and spot mistakes. That skill rests on three ideas: variables hold values, types constrain those values, and operators combine them into expressions. Master tracing — walking the code line by line — and most items become mechanical.
Why Variables Matter
A variable is a named box in memory. The name is a label; the box holds a current value that can change as the program runs. Pseudocode style: SET count TO 0
SET count TO count + 1
After the first line, count is 0. After the second, count is 1. Exams love questions that ask "what is the value of X after these statements?" Your job is to maintain a tiny state table and update it after every assignment.
Naming and Mutability
Names should be unique within a scope (you will see scope again with functions). Reassigning does not create a new box in most beginner models — it overwrites the old value. If x was 5 and you set x to 9, the 5 is gone unless you stored it elsewhere first.
- Concept Meaning Exam cue
- Declaration Introduce the name (and often the type) int n; or n = 0 in Python
- Initialization First meaningful value Uninitialized use is a bug
- Assignment Store a new value Right-hand side evaluated first
- Read / use Expression looks up current value Order of statements matters
- Types: What the Box Is Allowed to Hold
A type tells the language (and you) what kind of data lives in the variable. Cyber Test items stay near the primitives:
- Type family Typical values Notes
- Integer -3 , 0 , 42 Whole numbers; common for counters and array indices
- Floating-point 3.14 , -0.5 Approximate real numbers; rounding can surprise
- Boolean true / false (or True / False in Python) Results of comparisons; drive if decisions
- Character / string 'A' , "hello" Text vs sequence of characters — language-dependent
Python flavor: types are attached to values; x = 3 then x = "hi" is allowed. C++ flavor: you declare the type; int x = 3; then assigning a string is a compile-time error. The exam cares more about what value results than about compiler jargon, but knowing that integers and floats behave differently under division is fair game.
Integers vs Floats in Division
In many C-family languages, 7 / 2 with integer operands yields 3 (truncation toward zero), while 7.0 / 2 yields 3.5 . In Python 3, / always produces a float ( 7 / 2 → 3.5 ) and // is floor division ( 7 // 2 → 3 ). If a stem shows / without clarifying language, look for context clues (integer variables, int , float , or // ).
- Operators
- Arithmetic
- Operator Meaning Example
- + Add 3 + 4 → 7
- Subtract 10 - 3 → 7
- * Multiply 6 * 7 → 42
- / Divide language-dependent
- % Modulo (remainder) 17 % 5 → 2
Modulo is high-yield: n % 2 == 0 tests evenness; n % 10 peels off the last decimal digit.
Comparison (Relational)
Comparisons produce booleans:
- == equal
- != not equal
- < , > , <= , >=
- Logical
- AND ( && in C++, and in Python): true only if both sides true
- OR ( || / or ): true if at least one side true
- NOT ( ! / not ): flips true/false
Short-circuit evaluation: if the left side of AND is false, the right side may never run. Exam stems usually stay simple, but if a right-hand expression has a side effect (assignment or call), short-circuit can change outcomes.
Assignment vs Equality — The Classic Trap
- Symbol Role Wrong use
- = Assignment: store RHS into LHS Using = when you meant "are these equal?"
- == Equality test: compare two values Using == when you meant to store
- Worked trap (C++-style): int x = 5;
- if (x = 0) { /* body */ }
The condition uses assignment . It sets x to 0 , and the value of the assignment expression is 0 , which is treated as false — so the body does not run, and afterward x is 0 . Candidates who skim as "if x equals 0" miss that x was overwritten.
Python note: if x = 0 is a syntax error; Python forces == in conditions. Stems that mix languages still test the conceptual distinction.
Compound Assignment
x += 2 means x = x + 2 . Same pattern for -= , *= , /= , %= . Always evaluate the right-hand expression using the current value of x , then store.
Precedence (Order of Operations)
Rough high-to-low order (simplified):
- Parentheses ()
- Unary NOT / unary minus
- * , / , %
- + , -
- Comparisons
- AND
- OR
- Assignment
When unsure, parenthesize mentally . 3 + 4 * 2 is 11 , not 14 .
- Worked Tracing Example (Language-Agnostic) SET a TO 4
- SET b TO 10
- SET c TO a + b * 2
- SET a TO a + 1
- SET flag TO (a > 4) AND (c == 24)
State after each line:
- Step a b c flag
- start — — — —
- 1 4 — — —
- 2 4 10 — —
- 3 4 10 24 —
- 4 5 10 24 —
- 5 5 10 24 true
Why c is 24: b * 2 is 20, then a + 20 is 24. Why flag is true: after increment, a > 4 is true and c == 24 is true.
- Python / C++ Flavor Side-by-Side
- Python: a = 4
- b = 10
- c = a + b * 2
- a += 1
- flag = (a > 4) and (c == 24)
- C++: int a = 4;
- int b = 10;
- int c = a + b * 2;
- a += 1;
- bool flag = (a > 4) && (c == 24);
Same final values. The Cyber Test rewards recognizing that shared logic, not memorizing one syntax tree.
Exam Habits
Build a state table; never "eyeball" multi-step snippets.
Circle every = and ask: assignment or equality?
Resolve * / % before + - unless parentheses say otherwise.
Watch integer vs float division when the stem emphasizes whole-number types.
Modulo questions often hide in "remainder" or "even/odd" wording.
Programming fundamentals here feed the next sections: control flow decides whether assignments run, and functions package expressions into reusable units. If you can already update a state table confidently, you are ready for if , loops, and call stacks.