Complete Notes
Complete Notes
Answer
The Internet is a worldwide network of interconnected computers and devices that communicate with each other
using standard protocols such as TCP/IP.
It allows users to exchange data, send emails, browse websites, stream videos, and much more.
Example
When you send a WhatsApp message from Delhi to Mumbai, the message travels through the Internet.
Key Points
Answer
The World Wide Web (WWW) is a collection of web pages and websites that are accessed through the Internet using
a web browser.
Example
When you visit Google, YouTube, or Wikipedia, you are using the Web.
Key Points
Answer
Internet Web
Supports Email, FTP, VoIP, Web etc. Only provides websites and web pages
Think of the Internet as roads and the Web as cars travelling on those roads.
Exam Definition
Web: A collection of interlinked web pages accessed through the Internet using browsers.
Answer
Web Architecture refers to the structure that defines how web components communicate with each other.
Diagram
Client (Browser)
| HTTP Request
Server
| HTTP Response
Client (Browser)
Example
Answer
Client
Examples:
Chrome
Firefox
Edge
Server
Examples:
Apache Server
Nginx Server
Example
Browser = Client
Exam Definition
The Client-Server model is a distributed architecture where clients request resources and servers provide them.
Answer
An HTTP Request is a message sent by a client (browser) to a server asking for a resource.
Example
You type:
[Link]
Browser sends:
GET /
HTTP/1.1
Host: [Link]
Method Purpose
Real-Life Example
Answer
An HTTP Response is the message sent by the server back to the client after processing the request.
Example
Server responds:
HTTP/1.1 200 OK
<html>
<h1>Welcome</h1>
</html>
Components
1. Status Code
2. Headers
3. Content (Body)
Answer
Code Meaning
200 Success
301 Redirect
403 Forbidden
Example
If a webpage does not exist:
Answer
Example
[Link]
Parts of URL
[Link]
│ │ │
│ │ └── Path
└────────────────── Protocol
Components
1. Protocol (HTTP/HTTPS)
2. Domain Name
3. Path
Answer
A Web Server is software or hardware that stores websites and delivers web pages to users.
Functions
Receive requests
Process requests
Send responses
Examples
Nginx
Microsoft IIS
Example
When you visit YouTube, its servers send videos and web pages to your browser.
Q11. What is a Web Browser?
Answer
Functions
Receives responses
Examples
Google Chrome
Mozilla Firefox
Microsoft Edge
Example
Answer
Example
[Link]
[Link]
[Link]
Why Needed?
[Link]
[Link]
Answer
Example
[Link]
Types
IPv4
[Link]
IPv6
2001:db8::1
Purpose
Answer
Example
[Link]
[Link]
Why Needed?
Working
4. Website opens
Real-Life Analogy
You remember:
Mom
Phone stores:
+91XXXXXXXXXX
Similarly:
[Link]
maps to:
142.250.x.x
Web Hosting is a service that stores website files on a server and makes them accessible on the Internet.
Example
A website contains:
HTML files
CSS files
Images
Videos
Hostinger
Bluehost
GoDaddy
Example Flow
Website Files
Hosting Server
Internet
Answer:
The Web works on the Client-Server Architecture. A user enters a URL in a web browser. The browser (client) sends
an HTTP request to the web server. The server processes the request and returns an HTTP response containing the
requested webpage. The browser then displays the webpage to the user.
Steps:
This question is one of the most frequently asked questions from Unit 1 and is worth preparing thoroughly.
Answer
It is the standard language used to create and structure web pages. HTML uses tags to define elements such as
headings, paragraphs, images, tables, links, and forms.
Example
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>Welcome to HTML</h1>
</body>
</html>
Key Points
It is a markup language.
Answer
Example
<a href="[Link]
A tag is a keyword enclosed within angle brackets (< >) that tells the browser how to display content.
Example
<h1>Hello World</h1>
Here:
Answer
1. Paired Tags
Example
<p>This is a paragraph.</p>
2. Unpaired Tags
Example
<br>
<hr>
<img>
Exam Question
Answer
Syntax
<tagname attribute="value">
Example
<a href="[Link]
Here:
href = Attribute
[Link] = Value
Answer
Example
<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
</head>
<body>
<h1>Welcome</h1>
<p>This is my webpage.</p>
</body>
</html>
Components
1. <!DOCTYPE html>
2. <html>
3. <head>
Contains metadata.
4. <title>
5. <body>
HTML5 Declaration
<!DOCTYPE html>
Importance
Answer
Syntax
Example
<h1>My Website</h1>
Uses
Documentation
Debugging
Code readability
Answer
Tag
<ul>
Example
<ul>
<li>Apple</li>
<li>Mango</li>
<li>Banana</li>
</ul>
Output:
• Apple
• Mango
• Banana
Type Attribute
<ul type="square">
Possible values:
disc
circle
square
Answer
Tag
<ol>
Example
<ol>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ol>
Output:
1. HTML
2. CSS
3. JavaScript
Type Attribute
<ol type="A">
Possible values:
Type Output
1 1,2,3
A A,B,C
a a,b,c
I I,II,III
i i,ii,iii
Q11. What is the Start Attribute in Ordered Lists?
Answer
Example
<ol start="5">
<li>Item 1</li>
<li>Item 2</li>
</ol>
Output:
5. Item 1
6. Item 2
Answer
Tags
<dl>
<dt>
<dd>
Example
<dl>
<dt>HTML</dt>
<dt>CSS</dt>
</dl>
Answer
Tag
<a>
Example
<a href="[Link]
</a>
Answer
Example
<a href="[Link]
YouTube
</a>
Answer
The target attribute specifies where the linked page will open.
Example
<a href="[Link]
target="_blank">
</a>
Values
Value Meaning
Answer
Absolute URL
<a href="[Link]
</a>
Relative URL
Contains local file path.
<a href="[Link]">
About Us
</a>
Difference
Answer
Example
<h2 id="contact">
Contact Section
</h2>
Here:
Answer
Example
<table border="1">
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>Rahul</td>
<td>20</td>
</tr>
</table>
Answer
Tag Purpose
Answer
Example
<table border="1">
<tr>
</tr>
</table>
Output:
Student Info
Answer
Example
<td rowspan="2">HTML</td>
Answer
Border
<table border="1">
Cellpadding
<table cellpadding="10">
Cellspacing
<table cellspacing="5">
Answer
Tag
<form>
Example
<form>
Name:
<input type="text">
<input type="submit">
</form>
Answer
Action
<form action="[Link]">
Method
<form method="POST">
Methods
Method Purpose
Text
<input type="text">
Password
<input type="password">
Radio Button
<input type="radio">
Checkbox
<input type="checkbox">
Submit
<input type="submit">
Reset
<input type="reset">
Button
Answer
Name
Value
Required
Answer
Example
<select>
<option>Delhi</option>
<option>Mumbai</option>
<option>Noida</option>
</select>
Answer
Example
</textarea>
Used for:
Feedback
Comments
Messages
Answer
Example
<img src="[Link]">
src
Image location.
src="[Link]"
alt
Alternative text.
alt="Flower Image"
width
width="300"
height
height="200"
Complete Example
<img src="[Link]"
alt="Flower"
width="300"
height="200">
Answer
Frames divide the browser window into multiple sections, each displaying a different webpage.
Note: Frames are obsolete in HTML5 but may still appear in exams because they are in the syllabus.
Answer
<frameset> replaces the <body> tag and divides the page into frames.
Example
<frameset cols="30%,70%">
<frame src="[Link]">
<frame src="[Link]">
</frameset>
Rows
<frameset rows="20%,80%">
Cols
<frameset cols="30%,70%">
Answer
The <frame> tag specifies which page should be displayed inside a frame.
Example
<frame src="[Link]">
The <noframes> tag provides content for browsers that do not support frames.
Example
<noframes>
</noframes>
<!DOCTYPE html>
<html>
<head>
<title>Registration Form</title>
</head>
<body>
Name:
<br><br>
Password:
<br><br>
Gender:
<br><br>
Hobbies:
<br><br>
City:
<select>
<option>Delhi</option>
<option>Noida</option>
<option>Gurugram</option>
</select>
<br><br>
<br><br>
<input type="submit">
<input type="reset">
</form>
</body>
</html>
6. Input Types
7. Images (img)
9. HTML Comments
CSS is used to control the appearance of HTML elements. It separates the content (HTML) from the presentation
(CSS), making websites easier to design and maintain. (GeeksforGeeks)
Answer
It is a stylesheet language used to style HTML elements such as text, colors, backgrounds, spacing, borders, and
layouts. (GeeksforGeeks)
Example
<p>Hello World</p>
p{
color:red;
Output:
Key Points
Answer
Without CSS
<h1>Welcome</h1>
With CSS
h1{
color:blue;
text-align:center;
1. Better design
2. Easy maintenance
3. Reusable styles
(GeeksforGeeks)
Answer
selector{
property:value;
Example
h1{
color:blue;
Components
Part Meaning
h1 Selector
color Property
blue Value
Exam Definition
A CSS rule consists of a selector and a declaration block containing property-value pairs. (Dofactory)
Answer
A CSS rule tells the browser which element to style and how to style it.
Example
p{
color:red;
font-size:20px;
Here:
Selector = p
Answer
1. Inline CSS
2. Internal CSS
3. External CSS
Answer
Inline CSS is written directly inside the HTML element using the style attribute.
Example
<h1 style="color:red;">
Welcome
</h1>
Advantages
Quick styling
Disadvantages
Difficult to maintain
Priority
Answer
Internal CSS is written inside the <style> tag within the <head> section.
Example
<head>
<style>
h1{
color:blue;
</style>
</head>
Use
Answer
HTML File
[Link]
h1{
color:green;
Advantages
Reusable
Easy maintenance
Best method
(Ted Roche)
Answer
Example
@import url("[Link]");
Purpose
Answer
Background Color
body{
background-color:yellow;
}
Background Image
body{
background-image:url("[Link]");
Background Repeat
background-repeat:no-repeat;
Values
Value Meaning
Background Position
background-position:center;
Values
top
bottom
left
right
center
Answer
Text Color
p{
color:red;
}
Text Alignment
h1{
text-align:center;
Values
left
right
center
justify
Text Decoration
text-decoration:underline;
Values
Value Meaning
underline Underline
none No decoration
Text Transform
text-transform:uppercase;
Values
Value Result
uppercase ABC
lowercase abc
capitalize Abc
Answer
Font Family
font-family:Arial;
Font Size
font-size:20px;
Font Weight
font-weight:bold;
Values
normal
bold
Font Style
font-style:italic;
Values
normal
italic
Answer
Selectors identify HTML elements that should receive styles. (MDN Web Docs)
Answer
Syntax
*{
color:red;
Example
Answer
Example
p{
color:blue;
Answer
Syntax
.classname
Example
HTML:
<p class="note">
Hello
</p>
CSS:
.note{
color:red;
Important Point
Answer
Syntax
#idname
Example
HTML:
<h1 id="title">
Welcome
</h1>
CSS:
#title{
color:green;
}
Important Point
Answer
ID Class
Unique Reusable
Uses # Uses .
Example
#header{
color:red;
.menu{
color:blue;
This is one of the most important exam questions. (MDN Web Docs)
Answer
Example
div p{
color:red;
Meaning:
All <p> inside <div> become red.
Answer
div > p{
color:blue;
Answer
Example
h1 + p{
color:red;
Answer
Cascade determines which CSS rule is applied when multiple rules target the same element. (DevDoc)
Factors
1. Inheritance
2. Specificity
3. Source Order
Answer
Example
body{
color:blue;
Answer
Specificity decides which selector is stronger.
Priority Order
Inline Style
ID Selector
Class Selector
Element Selector
Example
p{
color:red;
.note{
color:blue;
#text{
color:green;
ID selector wins.
Answer
Example
p{
color:red;
p{
color:blue;
}
Output:
Blue text
Answer
Block
display:block;
Examples:
div
p
h1
Inline
display:inline;
Examples:
span
a
Inline-Block
display:inline-block;
None
display:none;
Example
ul{
list-style-type:square;
Values
Value Output
disc ●
circle ○
square ■
decimal 1,2,3
Example
table{
Border Collapse
border-collapse:collapse;
Example
table{
border-collapse:collapse;
Answer
Every HTML element is treated as a rectangular box. The box model consists of:
Margin
Border
↓
Padding
Content
(DevDoc)
Diagram
-------------------------
| Margin |
| ---------------------- |
|| Border ||
|| ------------------- | |
||| --------------- | | |
|||| Content | | | |
||| --------------- | | |
|| ------------------- | |
| ---------------------- |
-------------------------
Answer
Example
width:200px;
height:100px;
Answer
Example
padding:20px;
Individual Sides
padding-top:10px;
padding-right:20px;
padding-bottom:10px;
padding-left:20px;
Shorthand
Answer
Example
Border Style
border-style:solid;
Values:
solid
dotted
dashed
double
Border Width
border-width:3px;
Border Color
border-color:red;
Answer
Example
margin:20px;
Individual Sides
margin-top:10px;
margin-right:20px;
margin-bottom:10px;
margin-left:20px;
Answer
Margin Padding
Example
padding:20px;
margin:20px;
Example
width:200px;
padding:20px;
border:5px;
margin:10px;
Calculation
Total Width =
Margin Left
+ Border Left
+ Padding Left
+ Content Width
+ Padding Right
+ Border Right
+ Margin Right
= 10 + 5 + 20 + 200 + 20 + 5 + 10
= 270px
Answer:
The CSS Box Model describes how every HTML element is represented as a rectangular box consisting of Content,
Padding, Border, and Margin.
Content
Padding
Border
Margin
The total size of an element depends on the combined width of content, padding, border, and margin.
(DevDoc)
1. CSS Introduction
4. Class vs ID
5. CSS Selectors
7. Background Properties
8. Text Formatting
9. Font Properties
These topics usually cover the majority of Unit 3 theory and practical questions.
Unit 4: JavaScript (Question–Answer Format)
JavaScript is a programming language used to make web pages interactive. It can respond to user actions, validate
forms, manipulate HTML elements, and perform calculations. (MDN Web Docs)
Answer
JavaScript (JS) is a scripting language used to add interactivity and dynamic behavior to web pages.
Example
<button onclick="alert('Hello!')">
Click Me
</button>
Uses
Form validation
Animations
Interactive buttons
Dynamic content
Games
JavaScript works together with HTML and CSS. (MDN Web Docs)
Answer
It represents an HTML document as a tree structure of objects (nodes) that JavaScript can access and modify. (MDN
Web Docs)
Example HTML
<h1 id="title">Welcome</h1>
DOM Structure
Document
html
/ \
head body
|
h1
Importance
Change text
Change styles
Add/remove elements
Answer
Example
<p>Hello</p>
Nodes:
p element → Node
Answer
Syntax
[Link]("idname")
Example
<p id="msg">Hello</p>
<script>
[Link]("msg").innerHTML="Welcome";
</script>
Output:
Welcome
Answer
Example
<p class="note">HTML</p>
<p class="note">CSS</p>
[Link]("note");
Answer
String "Hello"
Number 100
Boolean true
Undefined undefined
Null null
Object {name:"Rahul"}
Answer
Example
Output:
Abhinay
Answer
Example
Answer
Stores either true or false.
Example
Answer
Example
let x;
[Link](x);
Output:
undefined
(Reddit)
Answer
Example
Answer
Example
let student = {
name:"Rahul",
age:20
};
Answer
Example
Answer
Example
Features
Function scope
Can be redeclared
Answer
Example
Features
Block scope
Answer
Example
const PI = 3.14;
Rule
Cannot be reassigned.
Answer
Types
1. Global Scope
2. Local Scope
Q18. What is Global Scope?
Answer
Example
function show(){
[Link](name);
Accessible everywhere.
Answer
Example
function show(){
Answer
Syntax
function name(){
Example
function greet(){
alert("Welcome");
Answer
Example
function greet(){
alert("Hello");
greet();
Answer
Example
function add(a,b){
[Link](a+b);
add(5,10);
Output:
15
Answer
Example
function add(a,b){
return a+b;
Output:
Answer
Example
alert("Welcome");
Output:
Answer
Example
[Link]("Hello");
Answer
Example
[Link]("Welcome");
Output:
Welcome
(Reddit)
Answer
Examples
Clicking button
Loading page
Submitting form
Moving mouse
(DevDoc)
Q28. What is onclick Event?
Answer
Example
<button onclick="show()">
Click
</button>
<script>
function show(){
alert("Button Clicked");
</script>
Answer
Example
Answer
Example
<select onchange="alert('Changed')">
<option>HTML</option>
</select>
Answer
Example
</p>
Answer
Example
Answer
Example
if(age>=18){
[Link]("Eligible");
else{
[Link]("Not Eligible");
Answer
Example
let day = 1;
switch(day){
case 1:
[Link]("Monday");
break;
case 2:
[Link]("Tuesday");
break;
Answer
Example
for(let i=1;i<=5;i++){
[Link](i);
Output:
Answer
Example
let i=1;
while(i<=5){
[Link](i);
i++;
Answer
Example
for(let i=1;i<=10;i++){
if(i==5){
break;
[Link](i);
Output:
1234
Answer
Example
for(let i=1;i<=5;i++){
if(i==3){
continue;
[Link](i);
Output:
1245
Answer
Main Objects
1. Window
2. Document
3. History
4. Location
5. Navigator
Answer
Example
[Link]("Hello");
Answer
Example
[Link]("Welcome");
Answer
Example
[Link]();
Answer
Example
[Link];
Answer
Example
[Link];
Q45. What is String Object?
Example
Method
[Link]
Output:
Answer
Example
Answer
Example
[Link]("Yellow");
Answer
Example
[Link]();
Example
[Link]
Example
[Link]();
Example
[Link](4.7);
Output:
Example
Example
Operator Meaning
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulus
Example
10 % 3
Output:
Operator Meaning
== Equal value
Operator Meaning
!= Not equal
> Greater
< Less
Example
5=="5"
Output:
true
5==="5"
Output:
false
Operator Meaning
&& AND
|| OR
! NOT
Example
Output:
false
Operator Meaning
= Assign
Example
let x = 10;
x += 5;
Output:
15
Answer
Form validation checks whether user input is correct before submitting data.
Examples
Email validation
Password matching
JavaScript validation commonly uses the onsubmit event. (MDN Web Docs)
Example
<input type="submit">
</form>
<script>
function validate(){
let name =
[Link]("name").value;
if(name==""){
alert("Name Required");
return false;
</script>
Purpose
Example
let email =
[Link]("email").value;
if(){
alert("Invalid Email");
return false;
Example
if(age<18 || age>60){
alert("Invalid Age");
Example
let p1 =
[Link]("pass1").value;
let p2 =
[Link]("pass2").value;
if(p1!=p2){
return false;
<!DOCTYPE html>
<html>
<body>
Name:
<br><br>
Email:
<br><br>
<input type="submit">
</form>
<script>
function validate(){
let name =
[Link]("name").value;
let email =
[Link]("email").value;
if(name==""){
return false;
if(){
alert("Invalid Email");
return false;
return true;
</script>
</body>
</html>
Working
This is one of the most frequently asked JavaScript practical questions in exams.
Most Frequently Asked Unit 4 Topics
2. Data Types
13. Operators
These topics usually cover the majority of Unit 4 theory and practical exam questions. (MDN Web Docs)
jQuery is a JavaScript library that simplifies JavaScript programming, while JSON is a lightweight format used for
storing and transferring data between applications. (GeeksforGeeks)
Part A: jQuery
Answer
jQuery is a fast, lightweight JavaScript library that simplifies HTML manipulation, event handling, animations, and
AJAX operations.
This means tasks that require many lines of JavaScript can often be done with a single line of jQuery code.
(W3Schools)
Example
JavaScript:
[Link]("msg").[Link]="red";
jQuery:
$("#msg").css("color","red");
Answer
(jQuery)
Answer
1. Using CDN
<script src=
"[Link]
</script>
2. Downloading jQuery
<script src="[Link]">
</script>
(GeeksforGeeks)
Answer
$(selector).action();
Components
Part Meaning
$ jQuery symbol
Example
$("p").hide();
(GeeksforGeeks)
Answer
It is a shortcut for:
jQuery()
Example
$("h1")
(GeeksforGeeks)
Answer
The document ready event ensures that jQuery code runs only after the webpage is fully loaded.
Syntax
$(document).ready(function(){
});
Example
$(document).ready(function(){
$("p").hide();
});
Importance
(GeeksforGeeks)
Q7. What is a jQuery Selector?
Answer
Syntax
$(selector)
Answer
Example
$("p")
Answer
Syntax
$("#id")
Example
$("#title")
Selects:
<h1 id="title">
Welcome
</h1>
Answer
Syntax
$(".classname")
Example
$(".note")
Selects:
<p class="note">
Hello
</p>
Answer
Syntax
$("[attribute]")
Example
$("[href]")
Answer
Examples
Mouse click
Double click
Key press
Form submission
Answer
Example
$("button").click(function(){
alert("Button Clicked");
});
Answer
$("p").dblclick(function(){
$(this).hide();
});
Answer
Example
$("p").mouseenter(function(){
alert("Mouse Entered");
});
Answer
Example
$("p").mouseleave(function(){
alert("Mouse Left");
});
Answer
Example
$("input").keypress(function(){
alert("Key Pressed");
});
Answer
Example
$("form").submit(function(){
alert("Form Submitted");
});
Answer
Example
$("select").change(function(){
alert("Selection Changed");
});
Answer
Example
$("p").hover(
function(){
$(this).css("color","red");
},
function(){
$(this).css("color","black");
);
<!DOCTYPE html>
<html>
<head>
<script src=
"[Link]
</script>
<script>
$(document).ready(function(){
$("#btn").click(function(){
$("p").hide();
});
});
</script>
</head>
<body>
<p>Hello World</p>
<button id="btn">
Hide Paragraph
</button>
</body>
</html>
Working
1. Page loads.
3. Paragraph hides.
This is one of the most frequently asked jQuery practical questions. (GeeksforGeeks)
Part B: JSON
Answer
It is a lightweight text-based format used for storing and exchanging data between systems. (MDN Web Docs)
Example
"name":"Rahul",
"age":20
Answer
4. Is lightweight
(MDN Web Docs)
Answer
Syntax
"key":"value"
Example
"name":"Abhinay",
"age":20,
"city":"Delhi"
Answer
"key" : value
Example
"name":"Rahul"
Here:
Key = name
Value = Rahul
Answer
Example
"subjects":[
"HTML",
"CSS",
"JavaScript"
Output Structure
subjects
HTML
CSS
JavaScript
Answer
No.
Invalid Example
"name":"Rahul",
"show":function(){}
Strings
Numbers
Objects
Arrays
Boolean values
Null
Answer
JSON XML
Lightweight Heavy
JSON Example
"name":"Rahul"
XML Example
<student>
<name>Rahul</name>
</student>
Exam Point
JSON is lighter, faster, and easier to parse than XML. (MDN Web Docs)
Answer
Syntax
[Link](object)
Example
let student = {
name:"Rahul",
age:20
};
let data =
[Link](student);
[Link](data);
Output:
{"name":"Rahul","age":20}
Answer
Example
let obj = {
name:"Aman"
};
let text =
[Link](obj);
Answer
Syntax
[Link](string)
Example
let data =
'{"name":"Rahul","age":20}';
let obj =
[Link](data);
[Link]([Link]);
Output:
Rahul
(DevDoc)
Answer
Example
Server sends:
"name":"Rahul"
[Link](data);
Example
let student = {
name:"Rahul",
age:20
};
let jsonText =
[Link](student);
let obj =
[Link](jsonText);
[Link]([Link]);
Working
Object
[Link]()
JSON String
[Link]()
Object
JSON XML
Lightweight Heavy
Faster Slower
Example JSON
"name":"Rahul",
"age":20
Example XML
<student>
<name>Rahul</name>
<age>20</age>
</student>
JSON is generally preferred in modern web applications because it is smaller, faster, and easier to work with. (MDN
Web Docs)
2. Advantages of jQuery
3. jQuery Syntax
5. jQuery Selectors
6. jQuery Events
8. JSON Introduction
9. JSON Syntax
12. [Link]()
13. [Link]()
These topics cover the majority of Unit 5 theory and practical examination questions. (GeeksforGeeks)