0% found this document useful (0 votes)
2 views10 pages

Computer Science Lecture Notes

The document is a comprehensive set of lecture notes for a Computer Science course covering topics such as computer hardware, software, programming fundamentals, data representation, computer networks, and cybersecurity. It includes learning objectives, detailed explanations of key concepts, and examples, as well as common exam errors and mnemonics for memorization. The notes also pose questions for further discussion in future sessions.

Uploaded by

rndeneng
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)
2 views10 pages

Computer Science Lecture Notes

The document is a comprehensive set of lecture notes for a Computer Science course covering topics such as computer hardware, software, programming fundamentals, data representation, computer networks, and cybersecurity. It includes learning objectives, detailed explanations of key concepts, and examples, as well as common exam errors and mnemonics for memorization. The notes also pose questions for further discussion in future sessions.

Uploaded by

rndeneng
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

Computer Science Lecture Notes – Master

Template

1. Lecture Header (Metadata)


 Course: [e.g., Introduction to Computer Science CS101]
 Topic: [e.g., Computer Hardware & Operating Systems]
 Date: [DD/MM/YYYY]
 Reading: [e.g., Chapter 1 – Computer Architecture; Online: How a CPU
works]

2. Learning Objectives (Pre-Lecture)


 By the end of this lecture, you should be able to:
o Identify the major hardware components of a computer
o Explain the fetch-decode-execute cycle of a CPU
o Distinguish between system software and application software

Part A: Computer Hardware (The Physical


Machine)

3. The Von Neumann Architecture (Standard Model)


text
Input Device → Memory (RAM) → CPU (Control Unit + ALU) → Output Device
↑ ↓
└─────── Storage ←────┘

Five classic components:

1. Input – Keyboard, mouse, microphone, scanner


2. Output – Monitor, speakers, printer
3. Memory – RAM (temporary, fast, volatile)
4. Control Unit – Directs operations
5. Arithmetic Logic Unit (ALU) – Performs calculations and logic

4. The CPU (Central Processing Unit) – The Brain


Component Function

Control
Decodes instructions, controls data flow
Unit

ALU Performs arithmetic (+, -, ×, ÷) and logic (AND, OR, NOT)

Registers Tiny, ultra-fast memory inside CPU (e.g., Program Counter, Instruction Regis

Cache Small, very fast memory (L1, L2, L3) – faster than RAM

The Fetch-Decode-Execute Cycle:

1. Fetch – Get next instruction from RAM (using Program Counter)


2. Decode – Control unit interprets the instruction
3. Execute – ALU performs operation or data moves
4. Store – Result written back to register or RAM

Clock speed (GHz) – Number of cycles per second (e.g., 3.5 GHz = 3.5
billion cycles/sec)

5. Memory Hierarchy (Speed vs. Cost vs. Size)

Volatile
Type Speed Size Cost/GB
?

Registers Fastest Bytes-KB Highest Yes

Extremely Very
Cache (L1/L2/L3) KB-MB Yes
fast high

GB (8–64 GB Moderat
RAM (DRAM) Fast Yes
typical) e

SSD (Solid State


Medium 128GB – 4TB Low No
Drive)

HDD (Hard Disk


Slowest 500GB – 20TB Lowest No
Drive)

6. Bits, Bytes & Binary


 Bit – Smallest unit: 0 or 1 (on/off, true/false)
 Byte – 8 bits (can store 0–255 or one ASCII character)
 Word – CPU-dependent (typically 32 or 64 bits)

Binary to decimal:
1011₂ = 1×8 + 0×4 + 1×2 + 1×1 = 11₁₀

Common prefixes:

Abbr Power of
Prefix Bytes
. 2

Kilo (KiB) K 2¹⁰ 1,024

Mega ~1.05
M 2²⁰
(MiB) million

Giga ~1.07
G 2³⁰
(GiB) billion

~1.1
Tera (TiB) T 2⁴⁰
trillion

Part B: Software (Instructions for Hardware)

7. Types of Software

Category Definition Examples

Manages hardware, runs OS (Windows, Linux, macOS), drive


System Software
applications firmware

Application
Performs user tasks Browser, Word, Photoshop, games
Software

Utility Software Maintains system Antivirus, disk cleaner, backup tool

8. Operating System (OS) Functions


 Process management – Multitasking, scheduling
 Memory management – Allocates RAM to programs
 File system – Organizes data on storage
 Device management – Drivers for peripherals
 User interface – GUI (graphical) or CLI (command line)
 Security & access control – Users, permissions

Common OS examples: Windows (11, 10), macOS, Linux (Ubuntu, Debian),


Android, iOS

9. How a Program Runs (High-Level to Machine Code)


text
Source code (Python/Java/C++)
↓ [Compiler or Interpreter]
Assembly language (human-readable machine instructions)
↓ [Assembler]
Machine code (binary: 10110000 01100001)
↓ [CPU executes]
Result

Compiler vs. Interpreter:

 Compiler – Translates entire program before running (C, C++, Rust) →


Faster execution
 Interpreter – Translates and runs line by line (Python, JavaScript) →
Easier debugging

Part C: Programming Fundamentals

10. Core Programming Concepts

Concept Explanation Example

Variable Named storage for data age = 25

Data type Kind of data stored int, float, string, boolean

Conditional Choose path based on condition if (x > 10): ...

Loop Repeat code for i in range(5):


Concept Explanation Example

Function Reusable block of code def add(a,b): return a+b

Array/List Collection of items [3, 7, 9]

11. Common Data Types (Examples in Python)

Type Description Example

int Integer 42

float Decimal number 3.14159

str Text string "Hello"

bool True/False True

list Ordered, changeable sequence [1, 2, 3]

dict Key-value pairs {"name": "Alice"}

12. Algorithms – Step-by-Step Procedures


Example: Linear Search
text
1. Start at first item in list
2. Compare item with target
3. If match → return position and stop
4. Else move to next item
5. If end of list reached → return "not found"

Measuring algorithm efficiency – Big O notation:

Notation Name Example

O(1) Constant Access array element

O(log n) Logarithmic Binary search


Notation Name Example

O(n) Linear Linear search

O(n log n) Linearithmic Merge sort

O(n²) Quadratic Bubble sort

O(2ⁿ) Exponential Recursive Fibonacci

Part D: Data Representation & Storage

13. How Different Data Types Are Stored

Data Storage method Example

Numbers Binary (two's complement for negatives) 5 = 00000101

Text ASCII (7-bit) or Unicode (UTF-8) 'A' = 65 (01000001)

Images Pixels (RGB values) Red = (255,0,0)

Sound Samples (amplitude over time) CD quality = 44,100 samples/se

Video Sequence of images + compression MP4, AVI

14. File Systems & Storage Hierarchy


 File – Named collection of data
 Directory/Folder – Contains files/subfolders
 Path – Location in hierarchy (e.g., C:\Users\Name\[Link] on
Windows; /home/name/[Link] on Linux)

Common file extensions:


Extension Type

.txt Plain text

.docx Word document

.jpg / .png Image

.mp3 / .wav Audio

.mp4 Video

.exe Executable (Windows)

.py Python script

.c C source code

.html Web page

Part E: Computer Networks

15. Network Types by Size

Type Range Example

PAN (Personal Area) ~1-10 meters Bluetooth headset

LAN (Local Area) Building/school Office network

WAN (Wide Area) Cities/countries The Internet

16. The OSI Model (Simplified – 4 layers)


Layer Function Protocols/Devices

Application User-facing services HTTP, FTP, SMTP, DNS

Transport Reliable data delivery, error checking TCP, UDP

Internet/Network Routing between networks IP (IPv4, IPv6)

Link/Physical Cables, Wi-Fi, MAC addresses Ethernet, Wi-Fi, switche

Key difference – TCP vs. UDP:

 TCP – Reliable, ordered, error-checked (web browsing, email)


 UDP – Fast, no guarantee (video streaming, gaming)

17. IP Addresses & DNS


 IPv4 – 32-bit → [Link] (about 4 billion addresses)
 IPv6 – 128-bit → 2001:0db8:85a3::8a2e:0370:7334 (vastly more)
 DNS (Domain Name System) – Translates [Link] to IP
address [Link]

18. Client-Server Model


text
Client (your laptop) → Request (e.g., GET /[Link]) → Server (web server)
Client ← Response (HTML, CSS, images) ← Server

Part F: Cybersecurity Basics

19. Common Threats

Threat Description Defense

Malware Malicious software (virus, worm, trojan) Antivirus, updates

Phishing Fake emails/sites stealing credentials User education, 2FA


Threat Description Defense

Man-in-the-middle Intercepting communication Encryption (HTTPS, VP

DDoS Overwhelming a server with traffic Firewalls, traffic filterin

Social engineering Manipulating people for access Training, verification

20. Security Best Practices (The CIA Triad)

Principle Meaning

Confidentiality Only authorized users access data (encryption, passwords)

Integrity Data is not tampered with (checksums, hashing)

Availability Systems are accessible when needed (backups, redundancy)

Strong password rules:

 Length > 12 characters


 Mix: uppercase, lowercase, numbers, symbols
 Unique per account
 Use a password manager

Part G: Application & Exam Skills

21. Common Exam Errors

Mistake Correction

Confusing RAM with storage RAM is volatile and fast; storage (SSD/HDD) is permanent

CPU is one component; computer includes memory, storag


Saying "CPU is the computer"
I/O

Mixing bits and bytes 1 byte = 8 bits (network speeds often in bits; storage in
Mistake Correction

bytes)

Forgetting ASCII values 'A' = 65, 'a' = 97, '0' = 48

Thinking TCP/UDP are the


TCP reliable (slow), UDP fast (unreliable)
same

22. Key Mnemonics to Memorize

Concept Mnemonic

CPU cycle steps Fetch Decode Execute Store (FDES)

Memory hierarchy (fast to


Registers Cache RAM SSD HDD (RC R SH – "ReCycRe SH")
slow)

All Teachers Insist Learning (Application, Transport, Interne


OSI layers (simplified)
Link)

CIA security triad Confidentiality, Integrity, Availability (spell CIA)

23. Questions for Next Session


 How many unique IP addresses does IPv4 provide? Why was IPv6
created?
 What happens when you type [Link] into a browser
and press Enter? (Trace the steps)
 Prepare: Write a simple Python function that checks if a number is
prime. Then calculate its Big O complexity.

You might also like