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 collec on 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 Defini on
Web: A collec on 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 Defini on
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:
h ps://[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 a er 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
h ps://[Link]/mobile
Parts of URL
h ps://[Link]/mobile
│ │ │
│ │ └── Path
└────────────────── Protocol
Components
1. Protocol (HTTP/HTTPS)
2. Domain Name
3. Path
Answer
A Web Server is so ware or hardware that stores websites and delivers web pages to users.
Func ons
Receive requests
Process requests
Send responses
Examples
Nginx
Microso IIS
Example
When you visit YouTube, its servers send videos and web pages to your browser.
Q11. What is a Web Browser?
Answer
Func ons
Receives responses
Examples
Google Chrome
Mozilla Firefox
Microso 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 Hos ng 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
Hos nger
Bluehost
GoDaddy
Example Flow
Website Files
Hos ng 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 ques on is one of the most frequently asked ques ons 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 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 Ques on
Answer
Syntax
<tagname a ribute="value">
Example
<a href="h ps://[Link]">Google</a>
Here:
href = A ribute
h ps://[Link] = Value
Answer
Example
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>Welcome</h1>
<p>This is my webpage.</p>
</body>
</html>
Components
1. <!DOCTYPE html>
2. <html>
3. <head>
Contains metadata.
4. < tle>
5. <body>
HTML5 Declara on
<!DOCTYPE html>
Importance
Answer
Syntax
Example
<h1>My Website</h1>
Uses
Documenta on
Debugging
Code readability
Answer
Tag
<ul>
Example
<ul>
<li>Apple</li>
<li>Mango</li>
<li>Banana</li>
</ul>
Output:
• Apple
• Mango
• Banana
Type A ribute
<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 A ribute
<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 A ribute 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>
Answer
Example
YouTube
</a>
Answer
The target a ribute specifies where the linked page will open.
Example
target="_blank">
</a>
Values
Value Meaning
Answer
Absolute URL
</a>
Rela ve URL
Contains local file path.
<a href="[Link]">
About Us
</a>
Difference
Answer
Example
<h2 id="contact">
Contact Sec on
</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
Ac on
<form ac on="[Link]">
Method
<form method="POST">
Methods
Method Purpose
Text
<input type="text">
Password
<input type="password">
Radio Bu on
<input type="radio">
Checkbox
<input type="checkbox">
Submit
<input type="submit">
Reset
<input type="reset">
Bu on
Answer
Name
Value
Required
Answer
Drop-down lists are created using <select> and <op on>.
Example
<select>
</select>
Answer
Example
</textarea>
Used for:
Feedback
Comments
Messages
Answer
Example
<img src="fl[Link]">
src
src="fl[Link]"
alt
Alterna ve text.
alt="Flower Image"
width
width="300"
height
height="200"
Complete Example
<img src="fl[Link]"
alt="Flower"
width="300"
height="200">
Answer
Frames divide the browser window into mul ple sec ons, each displaying a different webpage.
Note: Frames are obsolete in HTML5 but may s ll 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]">
Answer
The <noframes> tag provides content for browsers that do not support frames.
Example
<noframes>
</noframes>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
Name:
<br><br>
Password:
<br><br>
Gender:
<br><br>
Hobbies:
<br><br>
City:
<select>
</select>
<br><br>
<br><br>
<input type="submit">
<input type="reset">
</form>
</body>
</html>
6. Input Types
7. Images (img)
8. Frames and Frameset
9. HTML Comments
CSS is used to control the appearance of HTML elements. It separates the content (HTML) from the presenta on
(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;
Advantages
1. Be er 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 Defini on
A CSS rule consists of a selector and a declara on 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 wri en directly inside the HTML element using the style a ribute.
Example
<h1 style="color:red;">
Welcome
</h1>
Advantages
Quick styling
Disadvantages
Difficult to maintain
Priority
Answer
Internal CSS is wri en inside the <style> tag within the <head> sec on.
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
body{
background-color:yellow;
Background Image
body{
background-image:url("[Link]");
Background Repeat
background-repeat:no-repeat;
Values
Value Meaning
Background Posi on
background-posi on:center;
Values
top
bo om
le
right
center
Answer
Text Color
p{
color:red;
Text Alignment
h1{
text-align:center;
Values
le
right
center
jus fy
Text Decora on
text-decora on:underline;
Values
Value Meaning
underline Underline
none No decora on
Text Transform
text-transform:uppercase;
Values
Value Result
uppercase ABC
lowercase abc
capitalize Abc
Answer
Font proper es control text style.
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 iden fy 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>
CSS:
# tle{
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 ques ons. (MDN Web Docs)
Answer
Example
div p{
color:red;
}
Meaning:
All <p> inside <div> become red.
Answer
Example
div > p{
color:blue;
Answer
Example
h1 + p{
color:red;
Answer
Cascade determines which CSS rule is applied when mul ple rules target the same element. (DevDoc)
Factors
1. Inheritance
2. Specificity
3. Source Order
Answer
Example
body{
color:blue;
Answer
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;
display:none;
Answer
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;
}
Q29. What is the CSS Box Model?
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;
Example
padding:20px;
Individual Sides
padding-top:10px;
padding-right:20px;
padding-bo om:10px;
padding-le :20px;
Shorthand
(top right bo om le )
Answer
Example
Border Style
border-style:solid;
Values:
solid
do ed
dashed
double
Border Width
border-width:3px;
Border Color
border-color:red;
Q34. What is Margin?
Answer
Example
margin:20px;
Individual Sides
margin-top:10px;
margin-right:20px;
margin-bo om:10px;
margin-le :20px;
Answer
Margin Padding
Example
padding:20px;
margin:20px;
Example
width:200px;
padding:20px;
border:5px;
margin:10px;
Calcula on
Total Width =
Margin Le
+ Border Le
+ Padding Le
+ 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 consis ng 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 Introduc on
4. Class vs ID
5. CSS Selectors
7. Background Proper es
8. Text Forma ng
9. Font Proper es
10. Display Property
These topics usually cover the majority of Unit 3 theory and prac cal ques ons.
JavaScript is a programming language used to make web pages interac ve. It can respond to user ac ons, validate
forms, manipulate HTML elements, and perform calcula ons. (MDN Web Docs)
Answer
JavaScript (JS) is a scrip ng language used to add interac vity and dynamic behavior to web pages.
Example
<bu on onclick="alert('Hello!')">
Click Me
</bu on>
Uses
Form valida on
Anima ons
Interac ve bu ons
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
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
Q8. What is Number Data Type?
Answer
Example
Answer
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
Func on 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
Answer
Example
func on show(){
[Link](name);
Accessible everywhere.
Answer
Example
func on show(){
Answer
Syntax
func on name(){
}
Example
func on greet(){
alert("Welcome");
Answer
Example
func on greet(){
alert("Hello");
greet();
Answer
Example
func on add(a,b){
[Link](a+b);
add(5,10);
Output:
15
Answer
Example
func on add(a,b){
return a+b;
Output:
Answer
Example
alert("Welcome");
Output:
Answer
Example
[Link]("Hello");
Answer
Example
[Link]("Welcome");
Output:
Welcome
(Reddit)
Examples
Clicking bu on
Loading page
Submi ng form
Moving mouse
(DevDoc)
Answer
Example
<bu on onclick="show()">
Click
</bu on>
<script>
func on show(){
alert("Bu on Clicked");
</script>
Answer
Example
Answer
Example
<select onchange="alert('Changed')">
<op on>HTML</op on>
</select>
Answer
Example
Hover Here
</p>
Answer
Example
Answer
Example
if(age>=18){
[Link]("Eligible");
else{
[Link]("Not Eligible");
Answer
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){
con nue;
[Link](i);
Output:
1245
Q39. What is JavaScript Object Model (BOM)?
Answer
Main Objects
1. Window
2. Document
3. History
4. Loca on
5. Navigator
Answer
Example
[Link]("Hello");
Answer
Example
[Link]("Welcome");
Answer
Example
[Link]();
Answer
Example
loca [Link];
Answer
Example
[Link];
Example
Method
[Link]
Output:
Answer
Example
Answer
Example
[Link]("Yellow");
Answer
Example
[Link]();
Q49. What is length Property?
Example
[Link]
Example
[Link]();
Example
[Link](4.7);
Output:
Example
Example
Operator Meaning
+ Addi on
- Subtrac on
* Mul plica on
/ Division
Operator Meaning
% Modulus
Example
10 % 3
Output:
Operator Meaning
== Equal value
!= Not equal
> Greater
< Less
Example
5=="5"
Output:
true
5==="5"
Output:
false
Operator Meaning
&& AND
|| OR
! NOT
Example
Output:
false
Q57. Explain Assignment Operators.
Operator Meaning
= Assign
Example
let x = 10;
x += 5;
Output:
15
Answer
Form valida on checks whether user input is correct before submi ng data.
Examples
Email valida on
Password matching
JavaScript valida on commonly uses the onsubmit event. (MDN Web Docs)
Example
<input type="submit">
</form>
<script>
func on 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
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:
<input type="submit">
</form>
<script>
func on 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 prac cal ques ons in exams.
2. Data Types
13. Operators
These topics usually cover the majority of Unit 4 theory and prac cal exam ques ons. (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 applica ons. (GeeksforGeeks)
Part A: jQuery
jQuery is a fast, lightweight JavaScript library that simplifies HTML manipula on, event handling, anima ons, and
AJAX opera ons.
This means tasks that require many lines of JavaScript can o en 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=
"h ps://[Link]/ajax/libs/jquery/3.6.0/[Link]">
</script>
2. Downloading jQuery
<script src="[Link]">
</script>
(GeeksforGeeks)
Q4. What is the Syntax of jQuery?
Answer
$(selector).ac on();
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 a er the webpage is fully loaded.
Syntax
$(document).ready(func on(){
});
Example
$(document).ready(func on(){
$("p").hide();
});
Importance
(GeeksforGeeks)
Answer
Syntax
$(selector)
Answer
Example
$("p")
Answer
Syntax
$("#id")
Example
$("# tle")
Selects:
Welcome
</h1>
Syntax
$(".classname")
Example
$(".note")
Selects:
<p class="note">
Hello
</p>
Answer
Syntax
$("[a ribute]")
Example
$("[href]")
Answer
Examples
Mouse click
Double click
Key press
Form submission
Answer
Example
});
Answer
Example
$("p").dblclick(func on(){
$(this).hide();
});
Answer
Example
$("p").mouseenter(func on(){
alert("Mouse Entered");
});
Answer
Example
$("p").mouseleave(func on(){
alert("Mouse Le ");
});
Q17. What is keypress() Event?
Answer
Example
$("input").keypress(func on(){
alert("Key Pressed");
});
Answer
Example
$("form").submit(func on(){
});
Answer
Example
$("select").change(func on(){
alert("Selec on Changed");
});
Answer
$("p").hover(
func on(){
$(this).css("color","red");
},
func on(){
$(this).css("color","black");
);
<!DOCTYPE html>
<html>
<head>
<script src=
"h ps://[Link]/ajax/libs/jquery/3.6.0/[Link]">
</script>
<script>
$(document).ready(func on(){
$("#btn").click(func on(){
$("p").hide();
});
});
</script>
</head>
<body>
<p>Hello World</p>
<bu on id="btn">
Hide Paragraph
</bu on>
</body>
</html>
Working
1. Page loads.
3. Paragraph hides.
This is one of the most frequently asked jQuery prac cal ques ons. (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
}
Q22. Why is JSON Used?
Answer
4. Is lightweight
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":func on(){}
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 applica ons because it is smaller, faster, and easier to work with. (MDN
Web Docs)
1. Introduc on to jQuery
2. Advantages of jQuery
3. jQuery Syntax
5. jQuery Selectors
6. jQuery Events
8. JSON Introduc on
9. JSON Syntax
12. [Link]()
13. [Link]()
These topics cover the majority of Unit 5 theory and prac cal examina on ques ons. (GeeksforGeeks)