← Main Menu
1
Variables
2
Data Types
3
Conditionals
4
Loops
5
Functions
6
Arrays / Lists
7
OOP Basics
1
Variables
Definition
A variable stores data that can change during program execution. Think of it as a labeled box that holds a value — and that value can be replaced at any time.
🔍 QA Thinking
  • Test valid values — expected input the system should accept
  • Test invalid values — wrong type, wrong format, unexpected data
  • Test boundary values — min, max, empty, null
  • Ask: what happens if the variable is never assigned a value?
Example — Field: userAge
let userAge = 25;   // ✅ Valid
let userAge = 0;    // ⚠️ Edge case — is 0 a valid age?
let userAge = -1;   // ❌ Invalid — negative age
let userAge = null; // ❌ Invalid — no value provided
let userAge = "abc";// ❌ Invalid — wrong type (string)
Test InputExpected ResultStatus
25Accepted✅ Pass
0Edge case — verify system behavior⚠️ Review
-1Validation error shown❌ Should fail
nullRequired field error❌ Should fail
"abc"Type error / validation message❌ Should fail
💡 Why this matters for QA
Understanding variables helps you design test cases that cover valid, invalid, and boundary scenarios. Every input field in an application is backed by a variable — knowing that helps you ask: what values can break it?
🔍 Quick Check
Test your understanding of Variables
2
Data Types
Definition
Data types define the kind of data a variable can hold. The most common types are: String (text), Integer (whole numbers), Float (decimal numbers), and Boolean (true/false).
🔍 QA Thinking
  • Verify the system handles the correct data type as expected
  • Test what happens when a wrong type is submitted
  • Check type conversions — does "123" behave like 123?
  • Validate edge cases: empty strings, zero, false vs null
Example — Field: phoneNumber
// String (correct type for phone)
phoneNumber = "3001234567"  // ✅ Valid string
phoneNumber = 3001234567    // ⚠️ Integer — leading zeros lost
phoneNumber = "ABC123"      // ❌ Invalid format
phoneNumber = ""            // ❌ Empty string
phoneNumber = true          // ❌ Wrong type (Boolean)
InputTypeExpectedStatus
"3001234567"StringAccepted
3001234567IntegerLeading zeros may be lost⚠️
"ABC123"StringFormat validation error
""EmptyRequired field error
💡 Why this matters for QA
Data type mismatches are one of the most common sources of bugs. A field expecting a String that receives an Integer can cause silent failures, data corruption, or crashes — especially in APIs and databases.
🔍 Quick Check
Test your understanding of Data Types
3
Conditional Statements
Definition
Conditional statements allow the system to make decisions based on certain conditions. If a condition is true, one block of code runs. If false, another runs. This is the foundation of all system behavior.
🔍 QA Thinking
  • Always test both the TRUE path and the FALSE path
  • Verify error messages or actions appear correctly on each path
  • Test boundary conditions — what happens exactly at the threshold?
  • Check for missing else branches — what if neither condition is met?
Example — Login Page
if (credentials.areValid()) {
  redirectTo("dashboard");   // ✅ TRUE path
} else {
  showError("Invalid login"); // ❌ FALSE path
}
ConditionExpected ResultStatus
Valid credentialsRedirect to Dashboard✅ TRUE path
Invalid passwordShow error message❌ FALSE path
Valid email, wrong passwordShow error — not redirect❌ Must test
Empty fields submittedValidation before if/else⚠️ Edge case
💡 Why this matters for QA
Every feature has conditional logic. Testing only the happy path (the TRUE branch) is the most common QA mistake. The FALSE path is where most production bugs live — especially missing error messages, wrong redirects, and silent failures.
🔍 Quick Check
Test your understanding of Conditionals
4
Loops
Definition
Loops repeat a block of code until a condition is met. A for loop runs a set number of times. A while loop runs as long as a condition is true. Loops power lists, pagination, notifications, and more.
🔍 QA Thinking
  • Test minimum iterations — what happens with 0 items?
  • Test maximum iterations — does the loop have a limit?
  • Check performance — what if the loop runs 10,000 times?
  • Verify off-by-one errors — does it show 10 or 11 items?
  • Test empty state — what does the user see with no data?
Example — Display last 10 messages
for (let i = 0; i < 10; i++) {
  displayMessage(messages[i]);
}

// QA asks: what if messages.length is 0? 5? 50?
ScenarioExpected ResultStatus
10 messages existDisplay all 10
0 messagesDisplay empty state message✅ Must test
50 messages existDisplay only last 10
1 messageDisplay 1, not crash⚠️ Edge case
💡 Why this matters for QA
Loops are behind every list, table, notification feed, and search result in an application. Testing empty states and maximum limits catches the bugs that only appear in real usage — not in the developer's test environment with 3 items of sample data.
🔍 Quick Check
Test your understanding of Loops
5
Functions
Definition
A function is a reusable block of code that performs a specific task. It takes inputs (parameters), executes logic, and returns an output. Functions are the building blocks of every feature in an application.
🔍 QA Thinking
  • Test valid inputs — does the function return the correct output?
  • Test invalid inputs — does it handle errors gracefully?
  • Test edge cases — zero, negative numbers, empty strings
  • Verify consistent results — same input should always return same output
  • Check what happens when required parameters are missing
Example — calculateDiscount(price, discountRate)
function calculateDiscount(price, discountRate) {
  return price - (price * discountRate / 100);
}

calculateDiscount(100, 10)  // → 90  ✅
calculateDiscount(0, 10)    // → 0   ✅
calculateDiscount(-50, 10)  // → ❌ Should return error
calculateDiscount(100, 110) // → ❌ >100% discount?
InputExpected OutputStatus
(100, 10)90
(0, 10)0
(-50, 10)Error — negative price❌ Should fail
(100, 110)Error — discount over 100%❌ Should fail
(100, 0)100 — no discount applied⚠️ Edge case
💡 Why this matters for QA
Every button click, form submission, and API call triggers a function. Testing a function's inputs and outputs systematically — especially invalid and edge cases — is the essence of test design. This is Equivalence Partitioning and BVA applied to code.
🔍 Quick Check
Test your understanding of Functions
6
Arrays / Lists
Definition
An array stores multiple values in a single variable, in an ordered sequence. Arrays are used everywhere: shopping carts, search results, notification lists, user permissions. Each item has an index starting at 0.
🔍 QA Thinking
  • Test adding, removing, and updating items
  • Check behavior for empty arrays — does the UI show an empty state?
  • Test maximum size — is there a limit? What happens when exceeded?
  • Validate index boundaries — first item, last item, item beyond end
  • Test duplicate values — are they allowed or filtered?
Example — Shopping Cart: cartItems[]
let cartItems = [];           // Empty cart
cartItems.push("shoes");      // Add item → count = 1
cartItems.push("shirt");      // Add item → count = 2
cartItems.splice(0, 1);       // Remove first → count = 1

// QA: what if we push beyond the max cart limit?
ActionExpected ResultStatus
Add 3 itemsCount = 3, all displayed
Remove 1 itemCount decreases by 1
Empty cart checkoutError — cart is empty❌ Must test
Add item beyond max limitError message shown❌ Must test
Add duplicate itemIncreases quantity or blocks⚠️ Define behavior
💡 Why this matters for QA
Arrays power every list you see in an application. Cart items, search results, user permissions, notification feeds — all arrays. Empty state testing and boundary testing on arrays catches the bugs that appear in real-world usage, not demo environments.
🔍 Quick Check
Test your understanding of Arrays
7
Basic OOP Concepts
Definition
Object-Oriented Programming organizes code around objects. A Class is a blueprint. An Object is an instance of that class. A Method is a function inside a class. Think of a Class as a cookie cutter and Objects as the cookies.
🔍 QA Thinking
  • Test object behavior — does the object do what the class defines?
  • Verify method outputs under valid and invalid conditions
  • Ensure objects interact correctly — does User interact with Order correctly?
  • Test state changes — does updating one property affect others?
Example — Class: User / Method: updateEmail()
class User {
  constructor(name, email) {
    this.name = name;
    this.email = email;
  }

  updateEmail(newEmail) {
    if (!isValidEmail(newEmail)) throw new Error("Invalid email");
    this.email = newEmail;
  }
}

const user = new User("Watson", "user@example.com");
user.updateEmail("user@example.com"); // ✅
user.updateEmail("notanemail");    // ❌ Should throw error
user.updateEmail("");              // ❌ Empty — should fail
Input to updateEmail()Expected ResultStatus
"user@example.com"Email updated successfully
"notanemail"Validation error thrown❌ Should fail
""Required field error❌ Should fail
"user@example.com"No change or duplicate check⚠️ Define behavior
💡 Why this matters for QA
Modern applications are built with OOP. Understanding that every feature maps to a class and its methods helps you write more targeted test cases. When a developer says "the User object's updateEmail method failed" — you'll know exactly what to test and where to look.
🔍 Quick Check
Test your understanding of OOP
🏆
Module Complete!
You've covered 7 programming concepts from a QA perspective.
"QAlemental, Dear Watson. You now think like both a tester and a developer."
← Back to Main Menu
🏠 Home 🎮 Lesson 🎯 Exam 💼 Interview 💻 Programming 📖 Glossary