Sujal Sahu Lab Externalfile
Sujal Sahu Lab Externalfile
ANDREWS INSTITUTE
OF TECHNOLOGY & MANAGEMENT
Gurugram Delhi (NCR)
Approved by AICTE, Govt. of India, New Delhi
Affiliated to Maharshi Dayanand University
+
‘A ’ Grade State University, accredited by NAAC
Practical software Lab–Based on paper BCA 206 & 208, i.e.HTML and C++
Programming
Semester: 4th
DEPARTMENT OF
COMPUTER APPLICATIONS
St. Andrews Institute of Technology & Management,
Gurugram
Department of Computer Applications
Practical Lab Evaluation Sheet
P Practical Date CO Pract Viv Atten Pract Ove
r ical aVoce dan ce ica l ra
o Perfo (04) (04) File ll
g rm (04)
r (2
ed
a 0)
(08)
m
N
o.
- Headings (h1-h6)
- Paragraphs (p)
- Bold and italic text (b, i, strong, em)
- Lists (ul, ol, li)
- Links (a)
Apply CSS styles to enhance the
layout, typography, and visual
appearance of the webpage. Use
1 CSS selectors etc. 17/02/2025 CO3
- Name
- Contact Information
(Phone Number and Email)
- Education (Degree, Institution,
and Year of Graduation)
Use the concepts of rowspan and
5 01/04/2025 CO4
a) Demonstrate use of cout and
cin to print a first n term of
Fibonacci series.
b) Write a C ++ program to create
your own namespace and swap
values two variables.
c) Demonstrate string operations
in
6 C++ 17/02/2025 CO1
Average Marks
WEB DESIGNING
Q1. Design an HTML webpage that showcases the use of all formatting tags in HTML, along with CSS styling.
The webpage should include:
- Headings (h1-h6)
- Paragraphs (p)
- Bold and italic text (b, i, strong, em)
- Lists (ul, ol, li)
- Links (a)
Apply CSS styles to enhance the layout, typography, and visual appearance of the
<html lang="en">
<head>
<meta charset="UTF-8">
color: #f4f4f4;
} h1
{ color: #333;
text-align: center; }
color: #555;
p{
margin: 15px 0;
font-size: 1.1em;
b, strong
{ color:
#d9534f;
} i, em {
color: #5bc0de;
} ul, ol
{ margin: 20px 0;
padding-left: 20px;
a{
decoration: none;
a:hover { text-
decoration: underline;
.container
{ max-width: 800px;
margin: auto;
background: white;
padding: 20px;
border-radius: 8px;
rgba(0, 0, 0, 0.1);
</style>
</head>
<body>
<div class="container">
<h2>Paragraphs</h2>
<p>This is a <strong>bold</strong> paragraph that demonstrates the use of <b>bold</b> and <i>italic</i>
text. You can also use <em>emphasis</em> to highlight important points.</p>
<p>Another paragraph can be added here to show how multiple paragraphs look on the page.</p>
<h2>Lists</h2>
<h3>Unordered List</h3>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
<h3>Ordered List</h3>
<ol>
<li>First Item</li>
<li>Second Item</li>
<li>Third Item</li>
</ol>
<h2>Links</h2>
<p>For more information, visit <a href="https://www.w3schools.com" target="_blank">W3Schools</a> for
tutorials and references on web development.</p>
</div>
</body>
</html>
OUTPUT
Q2. Design a web page to demonstrate your college name aligned with the logo of your college.
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My College</title>
background-color: #f4f4f4;
height: 100vh;
h1 { color:
#333; margin:
20px 0;
bottom: 20px;
}
</style>
</head>
<body>
<div class="container">
</div>
</body>
</html>
OUTPUT
Q3. Design a web page which asks for mode of payment which includes the options: Credit card/Debit
card/Online transfer
<html lang="en">
<head>
<meta charset="UTF-8">
background-color: #f4f4f4;
height: 100vh;
text-align: center;
width: 300px;
} h1 { color:
#333; margin-bottom:
20px;
} label
{ display: block;
margin: 10px 0;
font-size: 1.1em;
input[type="radio"]
{ margin-right: 10px;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
</style>
</head>
<body>
<div class="container">
<form>
<label>
Credit Card
</label>
<label>
Debit Card
</label>
<label>
Online Transfer
</label>
<button type="submit">Submit</button>
</form>
</div>
</body>
</html>
OUTPUT
Q4. Design an HTML webpage that displays your personal bio-data using a table tag. The table should include
the following information:
- Name
- Contact Information (Phone Number and Email)
- Education (Degree, Institution, and Year of Graduation)
Use the concepts of rowspan and colspan to merge cells and create a visually appealing table structure.
<html lang="en">
<head>
<title>Personal Bio-Data</title>
background-color: #f4f4f4;
height: 100vh;
width: 400px;
} h1 { text-
align: center;
color: #333;
}
table { width: 100%;
border-collapse: collapse;
margin-top: 20px;
th,
td {
align: left;
th {
background-color: #007bff;
color: white;
tr:nth-child(even) { background-
color: #f2f2f2;
tr:hover { background-
color: #ddd; }
</style>
</head>
<body>
<div class="container">
<h1>Personal Bio-Data</h1>
<table>
<tr>
<th colspan="2">Personal Information</th>
</tr>
<tr>
<td>Name</td>
<td>Khushi</td>
</tr>
<tr>
</tr>
<tr>
<td>Email: [email protected]</td>
</tr>
<tr>
<th colspan="2">Education</th>
</tr>
<tr>
<td>Degree</td>
<tr>
<td>Institution</td>
</tr>
<tr>
<td>Year of Graduation</td>
<td>2026</td>
</tr>
</table>
</div>
</body>
</html>
Output:
Q5. Design an HTML webpage that demonstrates the use of frames. Create a frameset that includes:
- A top frame for a header or navigation menu
- A left frame for a sidebar or menu
- A main frame for displaying content
- A bottom frame for a footer or copyright information
Use HTML frame tags to create the frameset and specify the source files for each frame.
Ans- Index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Frameset Example</title>
</head>
</frameset>
</frameset>
<noframes>
</noframes>
</html>
header.html
<!DOCTYPE html>
<html lang="en">
<head><title>Header</title></head>
</body>
</html>
Sidebar.html
<!DOCTYPE html>
<html lang="en">
<head><title>Sidebar</title></head>
<style>
li a{
text-decoration: none;
color: black;
font-size: 23px;
</style>
<ul>
</ul>
</body>
</html>
content.html
<!DOCTYPE html>
<html lang="en">
<head><title>Content</title></head>
<body>
<p>This is where the page content will be displayed when you click links from the sidebar.</p>
</body>
</html>
footer.html
<!DOCTYPE html>
<html lang="en">
<head><title>Footer</title></head>
</body>
</html>
OUTPUT
OOPS
Q6. A) Demonstrate use of cout and cin to print a first n term of Fibonacci series.
int main() {
int n;
cout << "Enter the number of terms in the Fibonacci series: ";
cin >> n;
if (i == 0) { cout <<
" ";
}
}
return 0; }
OUTPUT
Q 6. B) Write a C ++ program to create your own namespace and swap values two variables.
namespace MyNamespace {
int temp = a; a = b;
b = temp;
int main() {
int x, y;
cout << "Enter two integers to swap: "; cin >> x >> y; cout
<< "Before swapping: x = " << x << ", y = " << y << endl;
MyNamespace::swap(x, y);
cout << "After swapping: x = " << x << ", y = " << y << endl;
return 0;
}
OUTPUT
Q 6. C) Demonstrate string operations in C++.
Ans:-
CODE
#include <iostream>
#include <string>
int main() {
"World";
endl;
<< endl;
upperStr) { c = toupper(c);
return 0;
}
OUTPUT
Q 7. A) Demonstrate all types of constructors in a C++ program.
Ans:-
1. Default Constructor
2. Parameterized Constructor
3. Copy Constructor
4. Move Constructor
CODE
#include <iostream>
#include <cstring>
class MyClass {
private:
char* name;
int age;
public:
// 1. Default Constructor
char[20]; strcpy(name,
"Unknown");
age = 0; cout << "Default Constructor called: " << name << ", Age: " <<
// 2. Parameterized Constructor
cout << "Parameterized Constructor called: " << name << ", Age: " << age << endl;
cout << "Copy Constructor called: " << name << ", Age: " << age << endl;
obj.age = 0; cout << "Move Constructor called: " << name << ", Age: " <<
~MyClass() { cout << "Destructor called for: " << (name ? name :
void display() const { cout << "Name: " << name <<
};
int main() {
MyClass obj1;
// Displaying information
obj1.display();
obj3.display();
obj4.display(); return 0;
}
OUTPUT
Q 7. B) Create Static data members in a C++ program and demonstrate how they are different form
normal data members.
Ans:-
Key Differences:
1. Memory Allocation: Static data members are allocated memory only once, while normal data members are
allocated memory for each object.
2. Access: Static data members can be accessed without creating an instance of the class, while normal data
members require an instance.
3. Lifetime: Static data members exist for the lifetime of the program, while normal data members exist for
the lifetime of the object.
CODE
#include <iostream>
class MyClass
{ private:
int normalData;
public:
{ staticData++;
void display() const { cout << "Normal Data: " << normalData << ", Static Data:
}
static int getStaticData()
{ return staticData;
};
int MyClass::staticData = 0;
int main() {
MyClass obj1(10);
MyClass obj2(20);
obj1.display();
obj2.display();
cout << "Static Data accessed through class: " << MyClass::getStaticData() << endl;
return 0;
}
OUTPUT
Q 7. C) Write a C++ program to demonstrate use of new and delete operator
class MyClass {
private: int
data;
public:
};
int main() {
>display();
MyClass* objArray = new MyClass[3] { MyClass(20), MyClass(30), MyClass(40) };
{ objArray[i].display();
delete obj1;
delete[] objArray;
return 0;
}
OUTPUT
Q8. A) Write C++ Program that illustrate how the Single, Multiple, Multilevel and Hierarchical Inheritance are
supported.
};
};
};
// Derived class for Multiple Inheritance
{ public:
};
};
};
// Further derived class for Multilevel Inheritance class SportsCar : public Car { public:
};
// Base class for Hierarchical Inheritance
};
};
void draw() {
};
int main() {
// Single Inheritance
dog.bark();
// Multiple Inheritance
bat.screech();
// Multilevel Inheritance
SportsCar sportsCar;
sportsCar.start();
sportsCar.drive();
sportsCar.race();
// Hierarchical Inheritance
Circle circle;
circle.draw(); Square
square; square.draw();
return 0;
}
OUTPUT
Q8. B) Write a C++ program to overload member function area() and demonstrate function overloading.
namespace std;
class Shape
{ public:
};
}
OUTPUT
Q8. C) Demonstrate the effect of virtual functions in C++
Ans:-
Key Concepts:
1. Virtual Function: A member function in a base class that you expect to override in derived classes.
2. Dynamic Binding: The mechanism by which a call to an overridden function is resolved at runtime rather
than compile time.
3. Base Class Pointer: A pointer of the base class type can point to objects of derived classes.
CODE
#include <iostream>
class Base
{ public:
};
};
int main() {
Base* basePtr;
Derived derivedObj;
basePtr = &derivedObj;
basePtr->show();
basePtr->display();
return 0;
}
OUTPUT
Q9. Write a C++ program to Demonstrate Class template and Function template
// Class Template
class Box
{ private:
T length;
public:
Box(T l) : length(l) {}
length * length;
};
// Function Template
T add(T a, T b)
{ return a + b;
int main() {
return 0;
}
OUTPUT
Q10. Write a Program containing a possible exception. use a try block to through it under catch block to handle it
properly.
namespace std;
num1, num2;
try {
return 0;
}
OUTPUT
DATA STRUCTURE
Q 11. Write a program to create header node of any tree.
TreeNode {
TreeNode* right;
};
struct HeaderNode
};
header;
}
struct TreeNode* insert(struct TreeNode* node, int data) {
= insert(node->left, data);
>right, data);
return node;
inOrderTraversal(node->right);
inOrderTraversal(header->root); printf("\n");
free(header);
return 0;
}
OUTPUT
Q 12. Write a program to create binary search tree.
TreeNode {
TreeNode* right;
};
createTreeNode(data);
insert(node->right, data);
return node;
inOrderTraversal(node->right);
{ return root;
search(root->right, key);
}
return search(root->left, key);
root = NULL;
inOrderTraversal(root); printf("\n");
} else {
return 0;
}
OUTPUT
Q 13. Write a program to create AVL tree.
#include <stdlib.h>
struct TreeNode {
height;
};
return node->height;
newNode;
}
= insert(node->left, data);
} else
{ return
node;
return rightRotate(node);
{ return leftRotate(node);
rightRotate(node);
node->right = rightRotate(node->right);
return leftRotate(node);
return node;
inOrderTraversal(node->right);
}
int main() { struct TreeNode* root = NULL;
n"); return 0;
}
OUTPUT
Q14. Write a program to create M-Way tree.
#include <stdlib.h>
#define M 3
struct MWayNode {
numKeys;
};
>numKeys = 1;
>children[i] = NULL;
return newNode;
createNode(key);
return;
}
struct MWayNode* current = *root;
while (1) {
int i;
if (current->children[i] == NULL) { if
>numKeys++;
return;
} else {
return;
current = current->children[i];
}
void levelOrderTraversal(struct MWayNode* root) {
queue[rear++] = root;
current->keys[i]);
if (current->children[i] != NULL)
{ queue[rear++] = current->children[i];
30);
printf("Level-order traversal of the M-way tree: ");
levelOrderTraversal(root); printf("\n");
return 0;
}
OUTPUT
Q 15. Write a program to perform Warshall Algorithm.
#define MAX 10
{ int reach[MAX][MAX];
reach[i][j] = graph[i][j];
reach[i][j]);
printf("\n");
}
}
int main() {
int n;
int graph[MAX][MAX];
matrix (0 or 1):\n");
scanf("%d", &graph[i][j]);
warshall(graph, n);
return 0;
}
OUTPUT