Practical Lab Manual
Part 1 Practical — Information Technology
M.Sc. IT Part 1 dives into enterprise architecture, advanced networking protocols, big data engineering, and security management at organizational scale.
// Lab Subjects (3)
MIT-P101
Big Data Lab (Hadoop Ecosystem)
2 credits
MIT-P102
Network Security Lab (Kali Linux)
2 credits
MIT-P103
Mini Research Project
4 credits
// Sample Programs (Interactive Viewer)
AI WidgetProgram 1: Write a program to implement linear search and binary search.
C#include <stdio.h>
// Linear Search
int linearSearch(int arr[], int n, int key) {
for (int i = 0; i < n; i++)
if (arr[i] == key) return i;
return -1;
}
// Binary Search (sorted array required)
int binarySearch(int arr[], int low, int high, int key) {
while (low <= high) {
int mid = low + (high - low) / 2;
if (arr[mid] == key) return mid;
else if (arr[mid] < key) low = mid + 1;
else high = mid - 1;
}
return -1;
}
int main() {
int arr[] = {2, 5, 8, 12, 16, 23, 38, 56, 72, 91};
int n = 10, key = 23;
int li = linearSearch(arr, n, key);
printf("Linear Search: %d found at index %d\n", key, li);
int bi = binarySearch(arr, 0, n - 1, key);
printf("Binary Search: %d found at index %d\n", key, bi);
return 0;
}Compile & run this in your local IDE or online compiler (onlinegdb.com)
Program 2: Implement a stack using arrays with push, pop, and peek operations.
C++#include <iostream>
using namespace std;
class Stack {
int data[100];
int top;
public:
Stack() : top(-1) {}
void push(int val) {
if (top >= 99) { cout << "Stack Overflow!\n"; return; }
data[++top] = val;
cout << val << " pushed.\n";
}
int pop() {
if (top < 0) { cout << "Stack Underflow!\n"; return -1; }
return data[top--];
}
int peek() {
if (top < 0) return -1;
return data[top];
}
bool isEmpty() { return top < 0; }
};
int main() {
Stack s;
s.push(10);
s.push(20);
s.push(30);
cout << "Top: " << s.peek() << endl; // 30
cout << "Pop: " << s.pop() << endl; // 30
cout << "Top: " << s.peek() << endl; // 20
return 0;
}Compile & run this in your local IDE or online compiler (onlinegdb.com)
Program 3: Write a Python program to demonstrate list comprehensions and file I/O.
Python# List Comprehension Examples
squares = [x**2 for x in range(10)]
evens = [x for x in range(20) if x % 2 == 0]
matrix = [[i * j for j in range(1, 4)] for i in range(1, 4)]
print("Squares:", squares)
print("Evens:", evens)
print("Multiplication Table Matrix:")
for row in matrix:
print(row)
# File I/O
with open("output.txt", "w") as f:
f.write("Student Grade Report\n")
f.write("=" * 30 + "\n")
students = [("Alice", 92), ("Bob", 85), ("Carol", 88)]
for name, grade in students:
line = f"{name:<15} Grade: {grade}\n"
f.write(line)
print(line, end="")
print("\nFile written successfully.")
with open("output.txt", "r") as f:
print("\nFile contents:")
print(f.read())Compile & run this in your local IDE or online compiler (onlinegdb.com)
// Lab Submission Checklist
✓Write the aim, algorithm, and flowchart before coding
✓Use meaningful variable names and add inline comments
✓Test with multiple inputs including edge cases (0, negative, large)
✓Document the expected vs actual output in your journal
✓Include the time and space complexity analysis for each program
✓Paste the screenshot of successful output in your practical file