Computer Science Practical Based Assessment Comprehensive Notes (SLO Policy)

Overview of the SLO-Based Examination Policy

The Students Learning Outcomes (SLOs) Based Examination Policy is implemented by the Federal Board of Intermediate and Secondary Education (FBISE) for Computer Science Grade 11 and 12. This policy shifts traditional practical exams toward a Practical Based Assessment (PBA) model.

  • Total Marks: The PBA consists of 5050 marks total.
  • Section-A (60%): Accounting for 3030 marks, this section focuses on Python programming, functions, libraries, file handling, databases, and entrepreneurship (MVP/prototyping).
  • Section-B (40%): Accounting for 2020 marks, this section focuses on Digital Systems (logic gates, truth tables, K-maps), Pseudocode, Flowcharts, Algorithms (sorting, searching), Data Analysis, and Digital Literacy (data collection strategies).
  • Core Absence: There are no marks awarded for practical notebooks or viva voce. Performance in the laboratory throughout the academic session is mandatory to attempt the PBA effectively.

Python Programming Fundamentals (Section-A)

Variables and Data Types

Practicals involve declaring variables of various types including strings, integers, floats, and booleans.

  • Example Code Snippet:
    • name = "Ali" (String)
    • age = 16 (Integer)
    • height = 5.8 (Float)
    • is_student = True (Boolean)
Input/Output Handling

Python utilizes the input() function for taking user data and the print() function for formatted output.

  • Example: name = input("Enter your name: ") and print(f"Hello {name}!").
Operators and Expressions
  • Arithmetic Operators: Addition +, Subtraction -, Multiplication *, Division /, Modulus %, and Exponent **.
  • Comparison Operators: Greater than >, Check for equality ==.
  • Logical Operators: and, or, not.
Selection and Decision Making

Programs use if, elif, and else blocks to handle conditions such as checking for even/odd numbers, pass/fail status, or building menu-based selections.

Repetition (Loops)
  • For Loops: Used to generate sequences (e.g., range(1, 11)) and for iterating through lists.
  • Star Pattern Generation: Loops can be nested or multiplied to create patterns such as: python for i in range(1, rows + 1): print("*" * i)     

Functional Decomposition and Modular Programming

Computational problems are solved by decomposing large problems into smaller, manageable sub-problems using functions. This is demonstrated through modular programs such as a "Simple Calculator" or an "Area Finder."

  • Modular Calculator: Uses distinct functions for add(a, b), subtract(a, b), multiply(a, b), and divide(a, b).
  • Area Finder: Incorporates the math library for complex calculations.
    • Circle Area Formula: A=π×r2A = \pi \times r^2
    • Triangle Area Formula: A=0.5×base×heightA = 0.5 \times \text{base} \times \text{height}

Turtle Graphics and Library Usage

Python's built-in libraries allow for specialized tasks:

  • Turtle Library: Used for drawing geometric shapes.
    • pen.forward(side): Moves the cursor forward.
    • pen.right(90): Turns the turtle 9090 degrees for a square.
    • pen.circle(radius): Draws a circle.
  • Math Library: Functions like math.sqrt(), math.pow(), math.floor(), and math.ceil().
  • Random Library: Using random.randint(low, high) for random number generation in games or simulations.
  • Datetime Library: Using datetime.datetime.now() to get the current timestamp.

GUI Development with Tkinter

Tkinter is used to create Basic Graphical User Interfaces. Key components include:

  • Main Window: Created via tk.Tk().
  • Widgets:
    • Label: Displays text/titles.
    • Entry: Used for user input fields.
    • Button: Triggers events (e.g., a command=calculate_sum).
  • Layout Management: Using .pack(pady=5) to place widgets vertically.
  • Event-Driven Programming: Developing applications where actions happen in response to user clicks, such as a Color Recognition Game.

Advanced Data Structures and File Handling

Data Structures
  • Lists: Mutable sequences used for operations like linear search, matrix representation, and finding sum(), min(), or max().
  • Tuples: Ordered, immutable collections used with count() and index() methods.
  • Sets: Collections used for mathematical operations like union, intersection, and difference.
  • Dictionaries: Key-Value pairs used for storing records, requiring logic for search, update, and delete operations.
File Handling
  • write(): For saving text to .txt files.
  • read(), readline(), readlines(): For retrieving data.
  • Safe Execution: Using the with open() as file: construct ensures files are closed automatically, combined with try-except blocks for error handling (e.g., FileNotFoundError).
Databases
  • SQLite: Utilizing the sqlite3 module to connect to databases, create tables via SQL, and perform INSERT, SELECT, and DELETE queries. Records are typically retrieved using cur.fetchall().

Entrepreneurship in the Digital Age

Students must understand the process of moving from a business idea to a prototype and then a Minimum Viable Product (MVP).

  • Case Study: Laundry Pickup & Delivery App ("QuickWash"):
    • Prototyping: Creation of High-Fidelity digital screens (using tools like Figma) and Storyboards (6 panels illustrating the user journey).
    • User Feedback and Iteration: Testing the prototype with classmate groups to identify pain points (e.g., small buttons) and implementing design changes (e.g., adding "Saved Locations").
    • MVP Features: Prioritizing core features such as a Google Form for order requests and a WhatsApp channel for communication rather than a full app.

Digital Systems and Boolean Logic (Section-B)

Truth Tables

Construction of tables for expressions involving up to 33 inputs (2n=23=82^n = 2^3 = 8 rows). Variables are expressed in binary order.

Logic Gates
  • AND Gate (Product): F=A⋅BF = A \cdot B
  • OR Gate (Sum): F=A+BF = A + B
  • NOT Gate (Inverter): F=AˉF = \bar{A}
Karnaugh Maps (K-maps)
  • Visual method for simplifying Boolean expressions by grouping adjacent 1s1s in groups of 2,4, or 82, 4, \text{ or } 8.
  • Grouping Rules: Groups must be powers of 22, as large as possible, and can wrap around edges.

Algorithms and Flowcharts

Computational Problems

Students must create pseudocode and flowcharts for common tasks:

  • Sorting Algorithms:
    • Bubble Sort: Repeatedly compares and swaps adjacent elements.
    • Insertion Sort: Builds a sorted list one element at a time by inserting a "key" into its correct position.
  • Searching Algorithms:
    • Linear Search: Checks elements one by one.
    • Binary Search: Requires a sorted list; uses a divide-and-conquer approach by checking the middle index mid = (low + high) // 2.
Trace Tables

Used to manually track variable values during algorithm execution to ensure logical accuracy.

Data Science and Digital Literacy

Data Visualization

Using tools like Google Colab (Python Pandas and Matplotlib) or Excel to create:

  • Scatter Plots: Showing relationships between two variables.
  • Bar Charts: Comparing quantities across categories.
  • Line Graphs: Showing trends over time or sequence.
  • Boxplots: Visualizing the median, quartiles, and spread/variability of data.
  • Pie Charts: Showing percentage distributions.
Data Collection Strategies
  • Qualitative Interviews: Using open-ended questions for detailed viewpoints.
  • Surveys: Using structured questions (Likert scale, MCQs) via tools like Google Forms.
  • Simulations: Generating synthetic datasets using Python (e.g., random.uniform()) to model real-world patterns when real data is unavailable.
  • Prototypes: Creating draft versions of tools to test for ambiguity or clarity before final implementation.