Romania Clasa a X-a Computer Science
Chapters: 3
1. Programming language basics
Introductory notions · Control structures · Programming environment
- Programming Basics: Sequence, Selection, Loops and Functions – A program is a set of exact instructions a computer follows. Every program is built from three structures: sequence (steps in order), selection (if/else choices) and iteration (loops). Variables store values. Functions group code into reusable, named blocks, which makes programs modular and easier to test, debug and maintain.
- Control Statements in Python: if-else, while and for – Normally Python runs lines one after another (sequence). Control statements change this flow. if-else chooses one of two paths; if-elif-else picks the first true condition from many. while repeats a block while a condition is true; for repeats once for each item of a sequence such as range(start, stop, step).
2. Structured data
Arrays · Text files
- Arrays and Lists: Storing Many Values in One Name – An array is a row of numbered boxes that share one name. Each box holds one value and has an index that starts at 0. We read or change a box with its index, visit every box with a loop (traversal), and use that loop for standard algorithms: sum, average, largest, count and linear search. A 2D array is a grid of rows and columns, read with two indexes and two nested loops. A fixed array has a set length; a list (Python list, Java ArrayList) can grow and shrink.
- File Handling in Python: Save Data That Lasts – Variables vanish when a program ends; files keep data on the disk. A text file stores characters in lines, a binary file stores raw bytes (such as pickled Python objects), and a CSV file stores table rows with commas. You open a file with open(path, mode), using an absolute or relative path and a mode such as r, w, a, r+, rb or wb. The with statement closes the file for you. Text files use write, writelines, read, readline and readlines. seek moves the file pointer and tell reports where it is. pickle.dump and pickle.load save and load objects in binary files, letting you search, append and update records. The csv module's writer (writerow, writerows) and reader handle CSV files.
3. Fundamental algorithms on arrays
Searching, sorting, merging · Interdisciplinary and everyday applications
- Searching and Sorting Algorithms – A searching algorithm finds an item in a list; a sorting algorithm puts a list in order. Linear search checks items one by one and works on any list. Binary search halves a sorted list each time and is much faster. Bubble sort swaps neighbours pass by pass; merge sort splits the list and merges sorted halves, which is faster for big lists.
- Introduction to Problem Solving – Problem solving on a computer has stages: analyse the problem (inputs, outputs, rules), develop an algorithm (a finite, clear, ordered set of steps), code it in a programming language, test it with different inputs, and debug (find and remove errors). An algorithm can be shown as a flowchart (oval = start/stop, parallelogram = input/output, rectangle = process, diamond = decision, arrows = flow) or as pseudocode (structured plain English). Decomposition breaks a big problem into smaller sub-problems that are solved separately and then joined.