0% found this document useful (0 votes)
42 views8 pages

Data Structures and OOP Assignment Guide

The document is an assignment for a Data Structures and Algorithms course, authored by M Sameer Malik. It includes two questions: the first requires a comparison of two data structures in the context of cybersecurity, and the second involves designing a management system using object-oriented programming principles. The document also provides a source code example for a Student Management System, demonstrating key operations like adding, updating, deleting, and displaying records.

Uploaded by

sameer Malik
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views8 pages

Data Structures and OOP Assignment Guide

The document is an assignment for a Data Structures and Algorithms course, authored by M Sameer Malik. It includes two questions: the first requires a comparison of two data structures in the context of cybersecurity, and the second involves designing a management system using object-oriented programming principles. The document also provides a source code example for a Student Management System, demonstrating key operations like adding, updating, deleting, and displaying records.

Uploaded by

sameer Malik
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

10/16/2025

Data Structures
Algorithms
Assignment 1

M Sameer Malik
NASTP INSTITUTE OF INFORMATION AND TECHNOLOGY
Data Structures Algorithms | Sameer Malik

Contents
Question 1 ..................................................................................................................................2

pg. 1
Data Structures Algorithms | Sameer Malik

Question 1
Q1) Distinguish between any two data structures through explaining difference in their
applicability in cybersecurity-related computer systems, and support your comparison with at
least
two relevant examples. [CLO-1, C2, PLO2]

pg. 2
Data Structures Algorithms | Sameer Malik

Question 2:
Comprehend your object-oriented concepts providing solution for any management
system of your choice. You can design any system (e.g., Library Management System, Student
Management System, or Inventory Management System) using Object-Oriented Programming
(OOP) principles. Your implementation should include:
• At least two classes with relevant attributes and methods.
• Object creation to represent real-world entities.
• Arrays to store data
• Functionality to perform key operations such as add, update, delete, and display records.

Output:

Source code:
#include <iostream>

pg. 3
Data Structures Algorithms | Sameer Malik

using namespace std;

class Student {
public:
int roll;
string name;
float marks;

void show() {
cout << "Roll: " << roll << " Name: " << name << " Marks:" << marks << endl;
}
};

class Manager {
public:
Student arr[50];
int count = 0;

void add(int r, string n, float m) {


arr[count].roll = r;
arr[count].name = n;
arr[count].marks = m;
count++;
}

void update(int r, float m) {


for(int i=0;i<count;i++){
if(arr[i].roll==r){
arr[i].marks = m;
cout<<"Marks updated ok"<<endl;

pg. 4
Data Structures Algorithms | Sameer Malik

return;
}
}
cout<<"roll not found"<<endl;
}

void removeStu(int r) {
for(int i=0;i<count;i++){
if(arr[i].roll==r){
arr[i] = arr[count-1];
count--;
cout<<"student removed"<<endl;
return;
}
}
cout<<"cant delete, no roll"<<endl;
}

void display(){
if(count==0){
cout<<"no data to show"<<endl;
return;
}
for(int i=0;i<count;i++){
arr[i].show();
}
}
};

int main(){

pg. 5
Data Structures Algorithms | Sameer Malik

Manager m;
int ch, r;
string n;
float mk;

while(true){
cout<<"1 Add"<<endl<<"2 Update"<<endl<<"3 Delete"<<endl<<"4 Show"<<endl<<"5
Exit"<<endl;
cin>>ch;

if(ch==1){
cout<<"Roll:"<<endl; cin>>r;
cout<<"Name:"<<endl; cin>>n;
cout<<"Marks:"<<endl; cin>>mk;
[Link](r,n,mk);
}
else if(ch==2){
cout<<"roll to update:"<<endl;
cin>>r;
cout<<"new marks:"<<endl;
cin>>mk;
[Link](r,mk);
}
else if(ch==3){
cout<<"roll delete:"<<endl;
cin>>r;
[Link](r);
}
else if(ch==4){
[Link]();

pg. 6
Data Structures Algorithms | Sameer Malik

}
else if(ch==5){
cout<<"bye"<<endl;
break;
}
else{
cout<<"wrong choice"<<endl;
}
}
}

pg. 7

You might also like