🎓 University Curriculum & Practical Lab Manuals

Computer Science Practical Labs Catalog

Explore 14 standardized computer science practical laboratory categories. Every experiment includes formal Aims, Learning Objectives, Algorithms, Verified Source Code, Sample Inputs/Outputs, Test Cases, and Viva Voce Q&As.

Categories: 14 Subjects (A to N)
Format: 18-Point Standard
Execution: Client-Side & 100% Free
Direct: 1-Click Open in IDE
Syllabus Completion 0 / 84
Avg Quiz Score -
Bookmarked Labs 0
⚡
Microprocessor & Microcontroller (MPMC) Simulator 8085 â€ĸ 8086 â€ĸ 8051
Simulate assembly code, input data into memory, inspect live registers, flags, and step-by-step outputs.
Launch MPMC Simulator →
How to Use Curriculum Labs: Select your department and semester below to filter matching syllabus experiments. Click any lab card to open interactive theory, algorithm flowchart, and runnable in-browser code.
Department:
6 Academic Tracks â€ĸ 84 Experiments
Semester:

đŸ”Ŧ University Practical Laboratory Curriculum & Viva Voce Manual

Standardized undergraduate computer science and engineering laboratory syllabus reference. Includes rigorous algorithms, complete runnable source implementations, expected outputs, time complexity bounds, viva questions, and the official 18-point university lab record documentation format.

📋 Official 18-Point University Lab Record Standardization Format

Academic Compliance â€ĸ AICTE & ABET Guidelines

To ensure strict adherence to university academic grading criteria and accreditation bodies, every engineering practical laboratory experiment on VAB-CODE follows the standardized 18-point documentation structure:

Points 1 to 9: Formulation & Design

1. Experiment Title & Date: Clear curricular identifier.
2. Aim / Problem Statement: Concise statement of technical objective.
3. Apparatus & Software Environment: Compiler versions (GCC, Java 17, Python 3.11, MySQL).
4. Learning Objectives: Specific skills and competencies acquired.
5. Theoretical Background: Underlying mathematical or algorithmic foundations.
6. Mathematical Equations: Formal equations, asymptotic bounds, and formulas.
7. Architectural Flowchart: Logic diagram depicting program execution flow.
8. Step-by-Step Algorithm: Language-agnostic pseudocode steps.
9. Input Data Specifications: Domain constraints and variable ranges.

Points 10 to 18: Implementation & Evaluation

10. Complete Source Code: Syntactically verified and fully indented code.
11. Comments & Error Handling: Boundary safety and explanatory annotations.
12. Compilation & Build Commands: Exact terminal CLI invocation.
13. Sample Test Case (Nominal): Standard expected input and output.
14. Boundary Test Case (Edge): Zero, null, negative, or max-scale inputs.
15. Expected Terminal Output: Exact stdout transcript.
16. Result & Conclusion: Verification that the stated aim was fulfilled.
17. Viva Voce Questions & Model Answers: Oral examination preparation.
18. Academic References: Standard textbooks (Cormen, Silberschatz, Tanenbaum).

đŸ’ģ Academic Track 1: Programming Fundamentals & Data Structures

Pointers â€ĸ Dynamic Memory (malloc/free) â€ĸ Linear & Non-Linear Lists

Data structures establish memory layout models and access patterns for algorithmic processing. Linear data structures (arrays, linked lists, stacks, queues) enforce sequential predecessor-successor relationships, whereas non-linear structures (trees, graphs) represent hierarchical and arbitrary network topologies.

Experiment 1: Implementation of Singly Linked List Operations

Aim: To write a modular C program to implement dynamic singly linked list operations: insertion at beginning/end, deletion by value, reversal of nodes, and display.
Algorithm:
1. Define struct Node containing integer data and pointer struct Node* next.
2. Insert at Beginning: Allocate memory via malloc(sizeof(struct Node)). Set newNode->next = head; update head = newNode.
3. Reverse: Initialize three pointers: prev = NULL, curr = head, next = NULL. In a loop while curr != NULL: save next = curr->next; reverse pointer curr->next = prev; advance prev = curr; advance curr = next. Set head = prev.

#include <stdio.h> #include <stdlib.h> struct Node { int data; struct Node* next; }; struct Node* insertBeginning(struct Node* head, int val) { struct Node* newNode = (struct Node*)malloc(sizeof(struct Node)); if (!newNode) { printf("Memory allocation failed!\n"); exit(1); } newNode->data = val; newNode->next = head; return newNode; } struct Node* reverseList(struct Node* head) { struct Node *prev = NULL, *curr = head, *next = NULL; while (curr != NULL) { next = curr->next; curr->next = prev; prev = curr; curr = next; } return prev; } void printList(struct Node* head) { struct Node* temp = head; while (temp) { printf("%d -> ", temp->data); temp = temp->next; } printf("NULL\n"); }
Viva Voce Questions:
â€ĸ Q: Why is pointer reversal performed in $O(1)$ auxiliary space?
â€ĸ Answer: Three temporary pointer variables (prev, curr, next) are reused across all loop iterations without allocating new heap memory, bounding space to $O(1)$.

☕ Academic Track 2: Object-Oriented Programming & Multi-Threading (Java)

Encapsulation â€ĸ Polymorphism â€ĸ Synchronized Monitors â€ĸ Thread Safety

Object-oriented design organizes code around self-contained entities (objects) encapsulating state (attributes) and behavior (methods). Java implements concurrency using monitors and intrinsic thread locks.

Experiment 2: Inter-Thread Communication (Producer-Consumer Problem)

Aim: To demonstrate thread synchronization and inter-thread signaling in Java using a bounded buffer with synchronized methods, wait(), and notify().
Theory: When multiple concurrent threads access shared mutable state, race conditions emerge. Using intrinsic object monitors, the Producer thread waits when the buffer is full, and the Consumer thread waits when the buffer is empty.

import java.util.LinkedList; import java.util.Queue; class BoundedBuffer { private final Queue<Integer> queue = new LinkedList<>(); private final int CAPACITY = 5; public synchronized void produce(int item) throws InterruptedException { while (queue.size() == CAPACITY) { wait(); // Buffer full: release monitor and sleep } queue.add(item); System.out.println("Produced: " + item + " | Buffer size: " + queue.size()); notifyAll(); // Wake up waiting consumer threads } public synchronized int consume() throws InterruptedException { while (queue.isEmpty()) { wait(); // Buffer empty: release monitor and sleep } int item = queue.poll(); System.out.println("Consumed: " + item + " | Buffer size: " + queue.size()); notifyAll(); // Wake up waiting producer threads return item; } }
Viva Voce Questions:
â€ĸ Q: Why must wait() always be called inside a while loop instead of an if statement?
â€ĸ Answer: To guard against spurious wakeups, where a thread resumes execution without an explicit signal. The while loop re-checks the condition predicate before proceeding.

đŸ—„ī¸ Academic Track 3: Database Management Systems & SQL Lab

Relational Algebra â€ĸ Multi-Table Joins â€ĸ Triggers & Stored Procedures

Relational databases store structured schemas governed by foreign keys and integrity constraints. SQL provides declarative data definition (DDL) and manipulation (DML).

Experiment 3: SQL Relational Queries, Grouping & Triggers

Aim: Create a University database schema (Department, Student, Course, Enrollment) and execute nested queries with GROUP BY, HAVING, and an automated audit trigger.

-- Schema Definition CREATE TABLE Student ( student_id INT PRIMARY KEY, name VARCHAR(50) NOT NULL, dept_id INT, gpa DECIMAL(3,2) ); CREATE TABLE CourseEnrollment ( enrollment_id INT PRIMARY KEY, student_id INT, course_name VARCHAR(50), grade VARCHAR(2), FOREIGN KEY (student_id) REFERENCES Student(student_id) ); -- Advanced Aggregation Query: Students with above-average GPA per Department SELECT s.student_id, s.name, s.gpa, s.dept_id FROM Student s WHERE s.gpa > ( SELECT AVG(s2.gpa) FROM Student s2 WHERE s2.dept_id = s.dept_id );
Viva Voce Questions:
â€ĸ Q: What is the semantic difference between WHERE and HAVING in SQL?
â€ĸ Answer: The WHERE clause filters individual records before aggregation occurs; the HAVING clause filters aggregated groups produced by GROUP BY.

âš™ī¸ Academic Track 4: Operating Systems & POSIX Systems Programming

Process Management (fork/exec) â€ĸ CPU Scheduling â€ĸ Pipes & IPC

System programming interfaces directly with the operating system kernel via system calls to manage processes, file descriptors, and virtual memory.

Experiment 4: Round Robin CPU Scheduling Simulation in C

Aim: Implement Round Robin scheduling with a given time quantum $Q$ to compute turnaround times, waiting times, and average response metrics.

#include <stdio.h> void roundRobin(int n, int burst[], int quantum) { int rem_burst[n]; for (int i = 0; i < n; i++) rem_burst[i] = burst[i]; int t = 0; // Current time int wait_time[n]; for (int i = 0; i < n; i++) wait_time[i] = 0; while (1) { int done = 1; for (int i = 0; i < n; i++) { if (rem_burst[i] > 0) { done = 0; if (rem_burst[i] > quantum) { t += quantum; rem_burst[i] -= quantum; } else { t += rem_burst[i]; wait_time[i] = t - burst[i]; rem_burst[i] = 0; } } } if (done == 1) break; } printf("PID\tBurst\tWaiting\tTurnaround\n"); for (int i = 0; i < n; i++) { printf("P%d\t%d\t%d\t%d\n", i+1, burst[i], wait_time[i], wait_time[i] + burst[i]); } }
Viva Voce Questions:
â€ĸ Q: How does time quantum size affect Round Robin performance?
â€ĸ Answer: An excessively large time quantum reduces Round Robin to FCFS; an excessively small quantum causes high context-switching overhead, degrading CPU throughput.

🌐 Academic Track 5: Computer Networks & Socket Programming

TCP/IP Sockets â€ĸ Client-Server Model â€ĸ Packet Sniffing & Routing

Socket programming enables inter-process network communication across distributed machines using IP addressing and port numbers.

Experiment 5: Client-Server TCP Echo Socket in Python

Aim: Implement an iterative TCP echo server and client using the standard Python socket library.

# Python 3: TCP Echo Server Implementation import socket def run_server(): server_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) server_sock.bind(('127.0.0.1', 8080)) server_sock.listen(5) print("TCP Server listening on 127.0.0.1:8080...") while True: client_sock, client_addr = server_sock.accept() print(f"Connection established from {client_addr}") data = client_sock.recv(1024) if data: print(f"Received payload: {data.decode()}") client_sock.sendall(data) # Echo data back client_sock.close()
Viva Voce Questions:
â€ĸ Q: Why is SO_REUSEADDR recommended for TCP server sockets?
â€ĸ Answer: It allows the server to immediately re-bind to the port even if previously closed sockets remain in the kernel's TIME_WAIT state.

🤖 Academic Track 6: AI, Machine Learning & Computer Vision

Supervised Learning â€ĸ Feature Scaling â€ĸ Confusion Matrix â€ĸ Scikit-Learn

Machine learning builds predictive data-driven models by discovering functional mappings $f(X) \approx Y$ from empirical training sets.

Experiment 6: Supervised Classification with Decision Trees & Evaluation

Aim: Train a Decision Tree classifier, compute the Confusion Matrix, and calculate Accuracy, Precision, Recall, and F1-Score metrics.

from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split from sklearn.tree import DecisionTreeClassifier from sklearn.metrics import classification_report, confusion_matrix # Load dataset and partition 80/20 iris = load_iris() X_train, X_test, y_train, y_test = train_test_split(iris.data, iris.target, test_size=0.2, random_state=42) # Train Decision Tree with Gini Impurity clf = DecisionTreeClassifier(criterion='gini', max_depth=3, random_state=42) clf.fit(X_train, y_train) # Evaluate model predictions y_pred = clf.predict(X_test) print("Confusion Matrix:\n", confusion_matrix(y_test, y_pred)) print("\nClassification Report:\n", classification_report(y_test, y_pred, target_names=iris.target_names))
Viva Voce Questions:
â€ĸ Q: Why is Precision preferred over Accuracy in imbalanced datasets?
â€ĸ Answer: Accuracy is deceptive when the majority class dominates (e.g. 99% negative cases); Precision ($TP / (TP + FP)$) measures exactness among positive predictions regardless of negative class volume.

đŸ”Ŧ Experiment 3: N-Gram Statistical Language Model with Next-Word Prediction & Perplexity

Standardized university practical engineering curriculum manual across Computer Science and Information Technology degree programs.

📋 Experiment Overview & Curriculum Specifications

NLP & Generative AI â€ĸ Medium â€ĸ 30 mins

Aim / Objective: To formulate, implement, and evaluate a Bigram and Trigram statistical Language Model with Maximum Likelihood Estimation (MLE) and Perplexity evaluation.

Prerequisites & Domain Concepts

Conditional probability, Markov chains, string processing, logarithms.

Asymptotic Complexity Bounds

â€ĸ Time Complexity: Training: O(N) linear in corpus tokens; Next-Word Prediction: O(|V| log |V|) where |V| is vocabulary size
â€ĸ Space Complexity: O(B) where B is the number of observed unique bigrams

Step-by-Step Algorithm

  1. Step 1: Prepend special start symbol <s> and append end symbol </s> to training sentences.
  2. Step 2: Count unigram frequencies C(w_i) and bigram frequencies C(w_{i-1}, w_i).
  3. Step 3: Implement predict_next_word(context_word): find word w with maximum C(context_word, w) / C(context_word).
  4. Step 4: Implement sentence generation: starting with <s>, greedily pick most probable next word until </s> or max length is reached.
  5. Step 5: Implement perplexity(test_sentence): for each bigram transition, calculate log P(w_i | w_{i-1}) with Laplace smoothing.
  6. Step 6: Compute Perplexity = exp(- (1 / N) * sum(log_probs)).
  7. Step 7: Output bigram transition probabilities and perplexity scores.

Verified Academic Source Code (PYTHON)

import math
from collections import Counter, defaultdict

class BigramLanguageModel:
    def __init__(self, laplace_alpha=0.1):
        self.alpha = laplace_alpha
        self.unigram_counts = Counter()
        self.bigram_counts = defaultdict(Counter)
        self.vocab = set()

    def fit(self, sentences):
        for sent in sentences:
            tokens = ['<s>'] + sent.lower().split() + ['</s>']
            for i in range(len(tokens) - 1):
                w1, w2 = tokens[i], tokens[i + 1]
                self.unigram_counts[w1] += 1
                self.bigram_counts[w1][w2] += 1
                self.vocab.add(w1)
                self.vocab.add(w2)

        print("=== Bigram Language Model Trained ===")
        print(f"Total Sentences: {len(sentences)} | Vocabulary: {len(self.vocab)} unique tokens\n")

    def get_bigram_prob(self, w1, w2):
        """Smoothed conditional probability P(w2 | w1)"""
        count_w1 = self.unigram_counts[w1]
        count_w1_w2 = self.bigram_counts[w1][w2]
        V = len(self.vocab)
        # Add-alpha smoothing
        return (count_w1_w2 + self.alpha) / (count_w1 + self.alpha * V)

    def predict_next_word(self, current_word, top_n=3):
        """Returns top N most likely candidate completions"""
        candidates = []
        for next_word in self.vocab:
            if next_word == '<s>':
                continue
            prob = self.get_bigram_prob(current_word.lower(), next_word)
            candidates.append((next_word, prob))
        candidates.sort(key=lambda x: x[1], reverse=True)
        return candidates[:top_n]

    def calculate_perplexity(self, test_sentence):
        """Computes Perplexity: PP = exp(-1/N * sum(log P(w_i | w_{i-1})))"""
        tokens = ['<s>'] + test_sentence.lower().split() + ['</s>']
        n = len(tokens) - 1
        log_prob_sum = 0.0

        for i in range(n):
            w1, w2 = tokens[i], tokens[i + 1]
            p = self.get_bigram_prob(w1, w2)
            log_prob_sum += math.log(p)

        cross_entropy = -log_prob_sum / n
        perplexity = math.exp(cross_entropy)
        return perplexity

# Training Corpus
training_corpus = [
    "deep learning models require large computational resources",
    "deep neural networks achieve high accuracy in computer vision",
    "computational algorithms optimize network execution latency",
    "neural networks learn features from large datasets",
    "machine learning models optimize computer vision algorithms"
]

model = BigramLanguageModel(laplace_alpha=0.1)
model.fit(training_corpus)

# Demonstration 1: Auto-complete / Next-Word Predictions
test_prompts = ['deep', 'neural', 'computer', 'large']
print("--- Next-Word Predictions (Top Candidates) ---")
for prompt in test_prompts:
    predictions = model.predict_next_word(prompt, top_n=2)
    pred_str = ", ".join([f"'{w}' ({p * 100:.1f}%)" for w, p in predictions])
    print(f"Prompt: '{prompt}' -> Candidates: {pred_str}")

# Demonstration 2: Perplexity Comparison
print("\n--- Model Perplexity Evaluation ---")
in_domain_sentence = "neural networks optimize computer vision"
out_domain_sentence = "quantum physics explains molecular orbital transitions"

pp_in = model.calculate_perplexity(in_domain_sentence)
pp_out = model.calculate_perplexity(out_domain_sentence)

print(f"In-Domain Test Sentence : \"{in_domain_sentence}\"")
print(f"  -> Perplexity (PP)    : {pp_in:.2f} (Low uncertainty / High confidence)")

print(f"Out-of-Domain Sentence : \"{out_domain_sentence}\"")
print(f"  -> Perplexity (PP)    : {pp_out:.2f} (High uncertainty / Unseen transitions)")
â–ļ Run in Online IDE

Sample Test Input

Training corpus of 5 machine learning sentences; prompts: deep, neural, computer, large

Expected Terminal Output

=== Bigram Language Model Trained ===
Total Sentences: 5 | Vocabulary: 23 unique tokens

--- Next-Word Predictions (Top Candidates) ---
Prompt: 'deep' -> Candidates: 'learning' (46.3%), 'neural' (46.3%)
Prompt: 'neural' -> Candidates: 'networks' (90.5%), 'achieve' (1.1%)
Prompt: 'computer' -> Candidates: 'vision' (86.6%), 'algorithms' (1.5%)
Prompt: 'large' -> Candidates: 'computational' (44.6%), 'datasets' (44.6%)

--- Model Perplexity Evaluation ---
In-Domain Test Sentence : "neural networks optimize computer vision"
  -> Perplexity (PP)    : 4.47 (Low uncertainty / High confidence)

Out-of-Domain Sentence : "quantum physics explains molecular orbital transitions"
  -> Perplexity (PP)    : 44.53 (High uncertainty / Unseen transitions)
University Viva Voce Questions & Model Answers:

â€ĸ Q: What is the Markov Assumption in n-gram language models?
â€ĸ Answer: The Markov assumption approximates the probability of the next word by looking only at the preceding n-1 words, rather than the entire historical sequence of the document: P(w_k | w_1...w_{k-1}) ~ P(w_k | w_{k-n+1}...w_{k-1}).

â€ĸ Q: What is Perplexity in Natural Language Processing?
â€ĸ Answer: Perplexity is the inverse probability of the test set normalized by number of words: PP(W) = exp(- (1/N) * sum(log P(w_i | context))). It measures the effective branching factor: how many words on average the model is equally uncertain between.

â€ĸ Q: Why is Add-Alpha (Laplace) smoothing required in N-Gram models?
â€ĸ Answer: Without smoothing, any test bigram that did not appear in training will have probability zero, causing the entire sentence probability product to drop to zero and yielding infinite perplexity.

â€ĸ Q: What is the primary drawback of increasing N in N-gram models (e.g. from bigrams to 5-grams)?
â€ĸ Answer: Data sparsity. As n increases, the number of possible n-grams grows exponentially (|V|^n), meaning most valid grammatical 5-grams will never appear in any finite training corpus.

â€ĸ Q: How do modern Transformers (like GPT) overcome N-gram limitations?
â€ĸ Answer: Transformers use multi-head self-attention mechanisms over continuous embedding representations, allowing them to attend to arbitrary long-range dependencies across thousands of tokens without combinatorial sparsity.