Web & Tech
Web & Tech
(a) Which attribute of <script> tag used to Example :-- $variableName = value;
include an external java script in an HTML (f) What is event bubbling in Java Script ?
document ? Ans :: Event bubbling in JavaScript refers to
Ans: src attribute the process where an event starts from the
target element and propagates upwards to the
(b) What do you mean by paired tag ? outer elements in the DOM hierarchy.
Ans:
A paired tag in HTML (HyperText Markup (g) Which tag is used to set table heading ?
Language) consists of an opening tag and a
closing tag. They work together to encapsulate Ans :: <th>.<tr>,<td>
content within them. (h) What is the use of <hr> tag in HTML ?
Ans : The <hr> tag in HTML is used to insert a
(c) Write the use of strpos ( ) function in PHP. horizontal rule, typically to create a thematic
break or to separate content sections.
Ans : The strpos() function in PHP is used to find
the position of the first occurrence of a substring (i) What What is the use of comment in HTML ?
within a string. It returns the numeric position of Ans :: The use of comments in HTML is to add
the first occurrence of the substring, or false if
the substring is not found. non-displayed notes or explanations within the
(d) What do you mean by “Server side code, which are helpful for developers to
scripting” ? understand or organize the code. Comments are
Ans: Server-side scripting refers to enclosed within <!-- and -->.
programming that is executed on the server,
helping generate dynamic web content before it
is sent to the client's browser. (j)How to include External CSS in the
webpage ?
POST: There is no significant limit on the <p>© 2025 Your Company. All rights
reserved.</p>
amount of data that can be sent, making it
<nav>
suitable for large data transfers.
<a href="/about">About Us</a>
<a href="/contact">Contact</a>
(p)What is the use of <marquee> tag in HTML ?
<a href="/privacy">Privacy Policy</a>
Ans :: The <marquee> tag in HTML is used to
create a scrolling text or image animation on a </nav>
webpage, moving content horizontally or
</footer>
vertically.
(s)Explain cell spacing and cell padding in HTML
Example :- <marquee>Scrolling Text
Example</marquee> with the help of a suitable example.
(q)What is the use of attributes in a tag ? Ans : - Cell Spacing: This refers to the space
between individual table cells. It sets the
Ans :- Attributes in an HTML tag provide
additional information about the element, distance between the borders of adjacent cells.
-Cell Padding: This refers to the space between Boolean: Represents two possible states: true or
the content of a cell and its border. It sets the false.
distance between the cell content and the cell
border.
Array: An ordered collection of values, e.g.,
(t)How can you create an object in JavaScript ? array(1, 2, 3).
Ans : You can create an object in JavaScript
using object literal notation or by using the new
Object() Object: An instance of a class.
2. Formatting Tags: Apply styles to text (e.g., Ans : To define a CSS class, you use a period
<b>, <i>, <u>, <em>). (.) followed by the class name and a set of
curly braces containing the style rules.
3. Content Tags: Define the content within
the document (e.g., <p>, <h1> to <h6>, Ex: .classname {
<a>, <img>, <table>). property: value;
4. Meta Tags: Provide meta-information property: value;
about the document (e.g., <title>, <meta>). }
(14)Write the syntax of eval(), parselnt() and
(12)What is block element and object in CSS ? parseFloat().
Ans : eval(): Evaluates a string as JavaScript
Ans :; Block Element: A block element in code and executes it.
CSS is an HTML element that starts on a new
parseInt(): Parses a string and returns an
line and takes up the full width available,
integer.
stretching out to the left and right as far as it
can. Examples include <div>, <p>, <h1> to parseFloat(): Parses a string and returns a
<h6>, and <section>. Block elements can floating-point number.
contain other block elements and inline (15)What is the significance of pseudo class in
elements. CSS ?
Ans : Pseudo-classes in CSS are used to
Object: In CSS, an object usually refers to define the special states of an element. They
an element that is considered as an entity for allow you to style elements based on their
styling purposes. For example, images state or position in the document tree, without
needing to add extra classes or IDs.
Examples include :hover, :active, :nth-child(), The essence of server-side scripting lies
and :focus. in its ability to:
Ex : a:hover { 1. Generate Dynamic Content: Create and
color: red; /* Changes link color to red when display web pages based on user input,
hovered over */
preferences, and interactions.
}
2. Manage Databases: Interact with
(16)What is event ? State the name of any two
databases to store, retrieve, and
event handler commonly used java script.
manipulate data, enabling functionalities
Ans : Event: An event in JavaScript
represents an action or occurrence detected like user authentication, content
by the browser, such as user interactions management, and data analytics.
(clicks, key presses) or browser actions (page 3. Enhance Security: Process sensitive data
load, resize). Events allow you to execute
securely on the server, reducing exposure
JavaScript code in response to user activities.
to client-side vulnerabilities.
Two common event handlers:
(18)Compare cell spacing and cell padding.
1. onclick: Triggered when an element is
clicked. Ans : Cell Spacing: This is the space
between individual table cells. It controls the
2.onload: Triggered when an element
distance between the borders of adjacent
(typically a page or an image) has finished
cells.
loading.
Ex: <table border="1" cellspacing="10">
(17)What is the essence of server side
<!-- Cell spacing is set to 10 pixels -->
scripting ?
</table>
Ans : Server-side scripting involves
Cell Padding: This is the space between the
running scripts on a web server to
content of a cell and its border. It controls the
generate dynamic web content, manage distance between the cell content and the cell
databases, and handle user interactions. border.
Ex : <table border="1" cellpadding="10">
<!-- Cell padding is set to 10 pixels --> Ans : HTML is a collection of items that are
</table> displayed in a specific order or as a group.
There are three types of lists commonly used
(19)What is Frame ? Distinguish between HTML
in web pages:
Frame and Web page.
1.Ordered List (<ol>): Displays items in a
Ans : Frame: In HTML, a frame is a container
numbered sequence.
that can load and display multiple HTML
documents within a single web page. Frames 2. Unordered List (<ul>): Displays items with
are created using the <frameset> tag, and bullet points.
each frame is defined using the <frame> tag. 3. Definition List (<dl>): Displays items as
- HTML Frame: terms and descriptions.Compare browser
object with DOM.
Created using the <frameset> and <frame>
tags. (21)What is DHTML ? State the essence of
DHTML in web page designing.
Allows for multiple independent documents
to be displayed within a single window. Ans : Dynamic HTML (DHTML) is an umbrella
term for technologies that enable interactive
Can lead to complex navigation and
and animated websites by combining HTML,
bookmarking issues.
CSS, JavaScript, and the DOM.
- Web Page:
Essence of DHTML in web page designing:
A single HTML document displayed in a
Enhances User Experience: Provides
browser.
interactivity and animations, making web
Typically created using the <html>, pages more engaging.
<head>, and <body> tags.
Real-Time Updates: Allows content to
Easier to manage, navigate, and bookmark change dynamically based on user
compared to frames. interactions.
Flexibility: Offers greater control over the
(20)What is list ? State the three types of list presentation and behavior of web elements
commonly used in web page.
(22)What is the essence of PHP in web page Ans : The ** operator in PHP is used for
designing. exponentiation, raising a number to the power
Ans : PHP (Hypertext Preprocessor) is a of another number.
server-side scripting language widely used for Example :-
web development. It is embedded within $result = 2 ** 3; // 2 raised to the power of 3
HTML to create dynamic web pages and echo $result; // Output: 8
applications.
(25)Compare ?: operator with ?? operator of
Essence of PHP in web page designing: PHP.
Server-Side Processing: Handles form Ans : ?: (Ternary Operator): The ternary
submissions, database interactions, and operator is a shorthand for the if-else
other server-side tasks. statement. It evaluates a condition and returns
Dynamic Content: Generates customized one of two values based on whether the
web content based on user input, session condition is true or false.
data, and database queries. ?? (Null Coalescing Operator): The null
Integration: Seamlessly integrates with coalescing operator checks if a variable is set
HTML, CSS, JavaScript, and databases and is not null. If the variable is not set or is
like MySQL to build full-featured web null, it returns a default value.
applications. The ternary operator ?: evaluates a
condition and returns one of two values based
(23)Compare the < > operator with ! = = on the result.
operator in PHP. The null coalescing operator ?? checks if a
Ans :< > Operator: Used as an alternative to ! variable is set and not null, returning a default
= to check if two values are not equal. value if it is not.
Ans : The <hr> tag is used for inserting a (31)What is the need of <MAP> tag in the HTML
horizontal rule (or horizontal line) in an document ?
HTML documenta. Ans : The <map> tag is used to define an
image map, which is a clickable image with
defined areas that act as hyperlinks. Each
area within the <map> tag can be associated
with different URLs or actions.
(28)what is CSS?
Example: <img src="image.jpg"
Ans : CSS (Cascading Style Sheets) is a usemap="#imagemap">
stylesheet language used to define the
presentation and layout of web pages. It allows <map name="imagemap">
you to control the appearance of elements, <area shape="rect" coords="34,44,270,350"
including colors, fonts, spacing, and positioning, href="page1.html">
separately from the HTML content.
<area shape="circle" coords="130,136,60"
(29)What is the difference between href="page2.html">
CELLSPACING and CELLPADDING attriutes of
</map>
<TABLE> ?
Ans : CELLSPACING: Specifies the space
between the borders of adjacent table cells.
(32)<DIV> .... </DIV> tag used to divide a web Ans : alert(): Displays an alert box with a
page into seg- ments which can be positioned specified message.
anywhere on the page. Whether TRUE or
parseInt(): Parses a string and returns an
FALSE. Justify your answer.
integer.
Ans : TRUE. The <div> tag is a block-level
Math.random(): Returns a random number
element used to create sections or divisions
between 0 (inclusive) and 1 (exclusive).
within a web page. These segments can be
styled and positioned using CSS to appear (36)State, how we can receive user input with
anywhere on the page. an dialog box in Java Script.
(33)State the differences between == and === in Ans : You can use the prompt() function to
the Java Script. display a dialog box that prompts the user for
input.
Ans : ==(Equality Operator): Compares two
values for equality, performing type Example : var userInput = prompt("Please
conversion if necessary. enter your name:");
javascript
To place text in a browser, you can use HTML
document.getElementById("myElement").onmo elements such as <p>, <h1> to <h6>, and
useover = function() { <span>
this.style.color = "red";
paragraph (<p>): Used for regular paragraphs
}; of text.
onload: Triggered when an element
Headings (<h1> to <h6>): Used for headings,
(typically the window or an image) has finished
with <h1> being the largest and <h6> the
loading. smallest.
javascript
window.onload = function() { Span (<span>): Used for inline text to apply
styles or scripts.
alert("Page has loaded!");
(40)State the three types of dialog box used in (41)What is the essence of Java Script DOM ?
Java Script.
Ans : The Document Object Model (DOM) is a
Ans : Three types of dialog box used in programming interface for web documents. It
JavaScript: represents the structure of a document as a
tree of objects, allowing scripts to access,
1. Alert Box (alert): Displays a message to
manipulate, and update the content, structure,
the user with an OK button.
and style of a web page. The essence of the
javascript DOM lies in its ability to:
alert("This is an alert box!"); Dynamically update content and structure.
2. Confirm Box (confirm): Displays a Respond to user interactions.
message with OK and Cancel buttons,
Manipulate HTML and CSS elements
allowing the user to confirm or cancel an
programmatically.
action.
javascript
(42)In the case of DHTML, what is the
if (confirm("Do you want to proceed?")) {
significance of <LAYER>tag.
// User clicked OK
Ans : The <layer> tag was used in early web
} else { development for positioning and layering
// User clicked Cancel content on a web page, primarily in Netscape
Navigator. It allowed elements to be positioned,
}
shown, and hidden dynamically. However, it is
3. Prompt Box (prompt): Displays a message now obsolete and has been replaced by more
asking the user for input, with an input field, modern techniques like CSS positioning and
OK, and Cancel buttons. JavaScript.
var userInput = prompt("Please enter your (43)State the syntax of for each loop used in
name:"); PHP.
Ans : The foreach loop in PHP is used to echo $displayName; // Output: Guest
iterate over arrays. It simplifies looping
through array elements.
(45)State any four mathematical functions, that
Example:
are used in PHP.
php
Ans : abs(): Returns the absolute value of a
$array = array("apple", "banana", "cherry"); number.
foreach ($array as $value) { Ex : - echo abs(-10); // Output: 10
echo $value . "<br>"; round(): Rounds a floating-point number to the
nearest integer.
}
Ex :- echo round(4.6); // Output: 5
Alternatively, with key-value pairs:
sqrt(): Returns the square root of a number.
php
Ex : -echo sqrt(25); // Output: 5
$associativeArray = array("a" => "apple", "b"
=> "banana", "c" => "cherry"); pow(): Raises a number to the power of another
number.
foreach ($associativeArray as $key => $value)
){echo “$key : $value<br>”;} Ex :-echo pow(2, 4); // Output: 16
(44)What is the use of ??operator in PHP ?
Ans : The ?? (null coalescing) operator in PHP is
used to check if a variable is set and not null. It
returns the variable's value if it is set; otherwise, it
returns a default value.
Example:
$name = null;
$defaultName = "Guest";
$displayName = $name ?? $defaultName;