WEB DEVELOPMENT File
WEB DEVELOPMENT File
-Practical Question
Q1. Write a code to display another webpage within the another webpage.
Code:
<!DOCTYPE html>
<html>
<head>
<title>HTML iframe Tag</title>
</head>
<body style="text-align: center">
<h2>HTML iframe Tag</h2>
<iframe src="https://media.geeksforgeeks.org/wp-content/uploads/20240206111438/uni2.html"
height="370" width="400">
</iframe>
</body>
</html>
Code:
<!DOCTYPE html>
<html>
<head>
<title>GeeksforGeeks</title>
</head>
<body>
<h2>Welcome To GeeksforGeeks Learning</h2>
<h5>List of available courses</h5>
<ul>
<li>Data Structures & Algorithm</li>
<li>Web Technology</li>
<li>Aptitude & Logical Reasoning</li>
<li>Programming Languages</li>
</ul>
<h5>Data Structures topics</h5>
<ol>
<li>Array</li>
<li>Linked List</li>
<li>Stacks</li>
<li>Queues</li>
<li>Trees</li>
<li>Graphs</li>
</ol>
</body>
</html>
Q3. Write a code to display Heading and paragraph on the webpage.
Q3. Write a code to display the personal user information and use the submit button on the
webpage.
.smc {
font-family: "Comic Sans MS", cursive, sans-serif;
font-variant:small-caps;
text-align: center;
}
</style>
</head>
<body>
<div class="gfg">Shri Mahaveer College</div>
<div class="smc">
Grow your career with
</div>
</body>
</html>
Q7. Write a code to display the CSS align using the margin: auto property.
Code:
<!DOCTYPE html>
<html>
<head>
<style>
.center {
margin: auto;
width: 60%;
border: 3px solid #73AD21;
padding: 10px;
}
</style>
</head>
<body>
<h1 style="color:green;">
GeeksforGeeks
</h1>
<h2>Center Align Elements</h2>
<div class="center">
This is div element on which
margin auto is used to horizontally
align it into center
</div>
</body>
</html>
Q8. Write a code to change the style type of the list.
Code:
<!DOCTYPE html>
<html>
<head>
<style>
ul.a {
list-style-type: square;
}
ol.c {
list-style-type: lower-alpha;
}
</style>
</head>
<body>
<h2>
Shri Mahaveer College
</h2>
<p> Unordered lists </p>
<ul class="a">
<li>one</li>
<li>two</li>
<li>three</li>
</ul>
<ul class="b">
<li>one</li>
<li>two</li>
<li>three</li>
</ul>
<p> Ordered Lists </p>
<ol class="c">
<li>one</li>
<li>two</li>
<li>three</li>
</ol>
<ol class="d">
<li>one</li>
<li>two</li>
<li>three</li>
</ol>
</body>
</html>
let count = 0;
return function increment(){
count++;
console.log(count);
};
}
const counter = createCounter();
counter(); // Output: 1
counter();// Output: 2
Q11. Write a code to check if the “name” property exists(true) and if the “address” property does
not exist(false).
Code:
const Data = {
name: "Rahul",
age: 21,
city: "Noida"
};
// true ("name" property exists in the object)
console.log("name" in Data);
Output:
true
false
Q12. Write a code to display the if-statement in javascript.
Code:
// JavaScript program to illustrate If
statement
let i = 10;
Output:
I am Not in if
greetUser('Admin');
Output:
Q14. Write a code to creates a WeakMap looseMap, sets objects as keys with names, assigns
values, and checks if it has a specific key. Outputs the map and checks for presence of Ram.
Code:
function myGeeks() {
looseMap.set(Raj, "Raj");
looseMap.set(Rahul, "Rahul");
console.log(looseMap);
console.log(looseMap.has(Ram))
}
myGeeks();
Output:
WeakMap {{…} => 'Raj', {…} => 'Rahul', {…} => 'Ram'}
true
Q15. Write a code to prints infinite series of natural numbers using a simple generator.
Code:
// Generate Function generates an
function* nextNatural() {
let naturalNumber = 1;
// Infinite Generation
while (true) {
yield naturalNumber++;
// 10 Generated number
console.log(gen.next().value);
Output: 1
2
3
4
5
6
7
8
9
10