Revise DBMS, SQL, operating systems, networks and object-oriented programming.
Month 5 Object-oriented programming
Concept & theory
Four pillars: encapsulation, abstraction, inheritance, polymorphism. Prefer composition when inheritance does not model a true is-a relationship.
Example code
class Shape:
def area(self): raise NotImplementedError
class Rectangle(Shape):
def __init__(self,w,h): self.w,self.h=w,h
def area(self): return self.w*self.h
shapes = [Rectangle(3,4)]
print([s.area() for s in shapes])
Code explained
Rectangle overrides area; the caller uses the Shape interface without knowing the concrete subtype. Output is [12].
Try it yourself
Add Circle and compare inheritance with composition.
Month 5 DBMS and SQL
Concept & theory
Relational databases store rows in tables. Primary keys identify rows; foreign keys express relationships. Joins combine related tables; indexes accelerate reads with write/storage costs.
Example code
CREATE TABLE students (id INT PRIMARY KEY, name VARCHAR(80));
CREATE TABLE marks (student_id INT, score INT,
FOREIGN KEY (student_id) REFERENCES students(id));
SELECT s.name, AVG(m.score) AS average_score
FROM students s JOIN marks m ON s.id = m.student_id
GROUP BY s.id, s.name;
Code explained
JOIN matches student IDs. AVG aggregates each student’s scores; GROUP BY creates one row per student. Students without marks are excluded by INNER JOIN.
Try it yourself
Change to LEFT JOIN and show students with no marks.
Month 5 Operating systems
Concept & theory
A process has its own address space; threads share process memory. Scheduling shares CPU time. Deadlock requires mutual exclusion, hold-and-wait, no preemption and circular wait.
Example code
import threading
lock = threading.Lock()
counter = 0
def add():
global counter
with lock:
counter += 1
Code explained
with lock protects a critical section so two threads do not update counter concurrently. This illustrates synchronization, not OS scheduling.
Try it yourself
Explain mutex vs semaphore and four deadlock conditions.
Month 5 Computer networks
Concept & theory
TCP provides ordered reliable byte streams; UDP provides datagrams without delivery guarantees. DNS resolves names; HTTP defines web request/response semantics; TLS protects data in transit.
Example code
GET /tutorials/python HTTP/1.1
Host: example.test
Accept: text/html
Code explained
GET requests a resource; Host identifies the virtual host; Accept indicates preferred response type. A server may respond 200, 301, 404, or 500.
Try it yourself
Trace typing a URL: DNS → TCP/TLS → HTTP → render.