0% found this document useful (0 votes)
4 views5 pages

Computer Science Review Material

The document provides detailed notes on Unit 9.6 of a computing course, covering topics such as writing Python code from flowcharts, decomposition, iterative development, binary search, count-controlled loops, data types, programming errors, test plans, and big data. It includes definitions, examples, and explanations to aid understanding and revision. The notes emphasize the importance of structured programming and debugging techniques.

Uploaded by

owogiangcute1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views5 pages

Computer Science Review Material

The document provides detailed notes on Unit 9.6 of a computing course, covering topics such as writing Python code from flowcharts, decomposition, iterative development, binary search, count-controlled loops, data types, programming errors, test plans, and big data. It includes definitions, examples, and explanations to aid understanding and revision. The notes emphasize the importance of structured programming and debugging techniques.

Uploaded by

owogiangcute1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Sure! Here's a more detailed version of the Unit 9.

6 notes with examples, explanations, and


structured headings for better understanding and revision:

📘 Computing – Unit 9.6 Detailed Revision


Notes

1. Writing Python Code from a Flowchart


🧠 What is a Flowchart?

 A flowchart visually represents a process or algorithm using different shapes and arrows.
 Each shape has a specific meaning:
o Oval: Start/End of the program.
o Rectangle: Instruction/Process (e.g., x = 5)
o Diamond: Decision/Condition (e.g., if x > 10)
o Arrows: Show the flow from one step to another.

💡 Example Flowchart:
[Start] → [x = 10] → [x > 5?] → Yes: print("Big") | No: print("Small")

🐍 Python Code Equivalent:


x = 10
if x > 5:
print("Big")
else:
print("Small")

🔁 Practice Tip:

When given a flowchart, identify:

1. Input/Start
2. Sequence of processes
3. Decision branches
4. Output
2. Decomposition & Iterative Development
🧩 Decomposition

 Breaking down a big problem into smaller, manageable parts (modules or functions).
 Makes code easier to write, test, and debug.

🔁 Iterative Development

 Building a system step-by-step.


 Each version is improved by:
1. Testing
2. Fixing errors
3. Enhancing features

🧮 Example: Calculator App

 Decomposition:
o Input function
o Calculation function
o Output display
 Iteration: Test each part → improve if it fails → test again.

3. Binary Search
🔍 What is Binary Search?

 A fast algorithm to search for an item in a sorted list.


 Time Complexity: O(log n)

🔁 How It Works:

1. Find the middle of the list.


2. If it's the target → found.
3. If the target is smaller → search the left half.
4. If larger → search the right half.

📦 Example:
list = [2, 4, 6, 8, 10]
target = 8

 Step 1: Middle = 6 → 8 > 6 → go right.


 Step 2: Middle = 8 → FOUND!

⚠️Important:

 List must be sorted before using binary search.

4. Count-Controlled Loops & Trace Tables


🔁 Count-Controlled Loop

 A loop that runs a fixed number of times.


 Syntax:

for i in range(3):
print(i)

 Output:

0
1
2

🧮 Trace Table

 A tool used to track how variables change during loop execution.


 Useful for debugging and understanding logic.

i
0
1
2

5. Data Types in Programming


🧠 Common Data Types:

Type Description Example


int Integer (whole number) 3, 100
float Decimal number 3.14, 1.5
str String/Text "hello"
bool Boolean (True/False) True
✅ Example:
name = "Alice" # str
age = 17 # int
gpa = 3.75 # float
active = True # bool

⚠️Why Important?

 Using correct types prevents bugs and improves program efficiency.

6. Types of Programming Errors


Type Description Example
Syntax Error Breaking language rules if x = 5 → should be ==
Logic Error Code runs but gives wrong result if x > y: return x*y instead of x+y
Runtime Error Code crashes when it runs print(5 / 0) → Division by 0

🧰 Debugging Techniques:

 Use print() to check variable values.


 Read error messages carefully.
 Create and run multiple test cases.

7. Writing a Test Plan


📝 What is a Test Plan?

 A table used to ensure that a program behaves as expected with different inputs.

📊 Structure:

Test # Description Input Expected Actual Pass/Fail


1 Add 5 and 3 5 + 3 8 8 Pass
2 Divide by zero 10 / 0 Error Crash Fail

💭 Why Test Invalid Inputs?

 To ensure the program can handle errors without crashing.


8. Trace Tables and Iteration
 Trace tables help track values across iterations, especially in loops.
 They’re vital for spotting logic errors.

🧪 Example:

Problem: If x >= y, add them. Else, multiply.

x = 4
y = 3
if x > y:
result = x * y # ❌ Should be x + y

 Logic Error: Condition is true, but it multiplies instead of adding.

9. Online User Data & Big Data


🌐 How Data is Collected:

 Web tracking: pages visited, forms filled.


 Shopping behaviour: products viewed/purchased.
 Social Media: posts liked, location, keywords.

💸 Why is it Valuable?

 Helps companies target ads, understand customer interests, and improve sales.

💾 Big Data: 5 V’s

V Meaning
Volume Massive amounts of data
Velocity Speed of data generation
Variety Different types: video, text, numbers
Veracity Data accuracy and reliability
Value Usefulness of data to make decisions

Would you like this formatted into a printable document or digital flashcards for revision?

You might also like