100% found this document useful (1 vote)
228 views

HTML Question Bank

HTML is the standard markup language used to create web pages and display content on the internet. Some new features of HTML5 include video and audio tags to embed media, SVG for vector graphics, new semantic tags like <section> and <main> to make pages more readable, and APIs for geolocation, drag-and-drop, and canvas drawing.

Uploaded by

Pranav Paste
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
228 views

HTML Question Bank

HTML is the standard markup language used to create web pages and display content on the internet. Some new features of HTML5 include video and audio tags to embed media, SVG for vector graphics, new semantic tags like <section> and <main> to make pages more readable, and APIs for geolocation, drag-and-drop, and canvas drawing.

Uploaded by

Pranav Paste
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

HTML

1) Define HTML5? List and explain the new features of HTML5.


a) HTML stands for Hypertext Markup Language.
b) HTML is the standard markup language used to create web pages and display content
on the internet.
c) There are some new features of HTML5:
d) Video and Audio
i) Video and audio are the new tags which allow to embed a video in the website
ii) A new tag is also available in HTML5 and that is audio tag. Which is used to
embed any audio in the web.
e) Svg
i) The svg element is used for the scalable vector graphics in the html 5, we can
create any kind of graphical animation with use of the svg tag, such as circle,
square or rectangle etc.
f) Semantic tags in HTML5
i) Semantic tags are very useful to make human and search engine friendly websites
and apps. Earlier developers were using div tag only to make columns, rows, and
new sections in a web page.
g) Section
i) Section tag is used to divide a document or in parts or sections. For example: an
article can have many sections like header, footer, latest news and section for
main content etc.
h) Main
i) main is a tag which is used to contain the main content of the page and it contains
unique content. More than one main tag is not accepted in the document
i) canvas
i) The <canvas> element allows for dynamic rendering of 2D graphics and
animations directly in the browser using JavaScript.
j) geolocation API
i) The HTML Geolocation API is used to locate a user’s position.
k) drag/drop API
i) In HTML, any element can be dragged and dropped.

2) What is CSS? What is a marquee in HTML?


a) CSS
i) CSS stands for Cascading Style Sheets
ii) CSS describes how HTML elements are to be displayed on screen, paper, or in
other media
iii) CSS saves a lot of work. It can control the layout of multiple web pages all at once
iv) External stylesheets are stored in CSS files
b) Marquee in HTML
i) An HTML marquee is a scrolling piece of text displayed either horizontally across
or vertically down depending your webpage settings.
ii) This is created by using HTML <marquees> tag.
iii) Syntax:
<marquee attribute_name = "attribute_value"....more attributes>
i) Following is the list of important attributes which can be used with <marquee>
tag.
ii) Width :- This specifies the width of the marquee. This can be a value like 10 or
20% etc.
iii) Height:- This specifies the height of the marquee. This can be a value like 10 or
20% etc.
iv) Direction:- This specifies the direction in which marquee should scroll. This can
be a value like up, down, left or right.
v) Loop :- This specifies how many times to loop.

2) How to declare variables in java script ?


a) In JavaScript, you can declare variables using the var, let, or const keywords. Here's
how to declare variables with each of these keywords:
i) Using var
var variableName = "This is a variable declared with var";
Variables declared with var are function-scoped, and they are hoisted to the top of
their containing function or the global scope. This means they are accessible
throughout the function or global scope.
ii) Using let
let variableName = "This is a variable declared with let";
Variables declared with let are block-scoped, meaning they are only accessible
within the block (enclosed by curly braces) where they are defined. They can be
reassigned.
iii) Using const
const constantName = "This is a constant variable declared with const";
Variables declared with const are also block-scoped, but they cannot be
reassigned after their initial value is assigned. However, for objects and arrays
declared with const, their properties or elements can still be modified.

3) What is an Arithmetic operator in java script? What are the different types of
Arithmetic operators used in java script?
a) In JavaScript, arithmetic operators are used to perform mathematical operations on
numeric values.
b) These operators allow you to perform addition, subtraction, multiplication, division,
and more. Here are some common arithmetic operators in JavaScript:
i) Addition (+): The addition operator is used to add two or more numeric values
together.
var sum = 5 + 3; // sum is now 8
ii) Subtraction (-): The subtraction operator is used to subtract one numeric value
from another.
var difference = 10 - 4; // difference is now 6
iii) Multiplication (*): The multiplication operator is used to multiply two numeric
values.
var product = 6 * 7; // product is now 42
iv) Division (/): The division operator is used to divide one numeric value by another.
var quotient = 20 / 4; // quotient is now 5
v) Modulus (%): The modulus operator returns the remainder of the division of one
number by another.
var remainder = 17 % 5; // remainder is 2
vi) Increment (++) and Decrement (--): These operators are used to increase or
decrease the value of a variable by 1.
var x = 5;
x++; // Increment x by 1 (x is now 6)
var y = 10;
y--; // Decrement y by 1 (y is now 9)

4) Explain Php variable in detail.


a) Variables in a program are used to store some values or data that can be used later in
a program.
b) The variables are also like containers that store character values, numeric values,
memory addresses, and strings.
c) PHP has its own way of declaring and storing variables.
d) There are a few rules, that need to be followed while dealing with variables in PHP:
i) Variable names in PHP must start with a dollar sign ($) followed by a letter or
underscore.
ii) Variable names can contain letters, numbers, and underscores.
iii) Variable names are case-sensitive, which means $myVar and $myvar are treated
as different variables.
iv) Variable names should be chosen to be descriptive and meaningful to improve
code readability.
e) Data types used by PHP to declare or construct variables:
i) Integers
ii) Doubles
iii) NULL
iv) Strings
v) Booleans
vi) Arrays
vii) Objects
viii) Resources

5) What is the full form of php ? What are the Arithmetic operators in php?
a) The full form of PHP is "Hypertext Preprocessor."
b) It is a popular server-side scripting language used for web development to create
dynamic web pages.
c) PHP includes several arithmetic operators for performing mathematical operations in
your code. Some of the basic arithmetic operators in PHP are:
i) Addition: + (e.g., $a + $b)
ii) Subtraction: - (e.g., $a - $b)
iii) Multiplication: * (e.g., $a * $b)
iv) Division: / (e.g., $a / $b)
v) Modulus (remainder): % (e.g., $a % $b)
vi) Exponentiation: ** (e.g., $a ** $b)
6) Describe html tags. What is the role of the <head> tag in HTML?
a) HTML (Hypertext Markup Language) tags are used to structure and define the
elements and content of a web page.
b) HTML tags are enclosed in angle brackets ("<" and ">") and come in pairs, with an
opening tag and a closing tag.
c) The opening tag contains the tag name, and the closing tag is the same as the opening
tag but with a forward slash ("/") before the tag name. Here's a basic structure of an
HTML tag:
d) Some common HTML tags include:
i) <html>: Defines the beginning and end of an HTML document.
ii) <head>: Contains meta-information about the HTML document and typically
includes elements like <title>, <meta>, and <link>.
iii) <title>: Sets the title of the web page that appears in the browser's title bar or tab.
iv) <p>: Defines a paragraph.
v) <a>: Creates hyperlinks to other web pages or resources.
vi) <img>: Embeds images in the document.
e) The <head> element is a container for metadata (data about data) and is placed
between the <html> tag and the <body> tag.
f) It does not display any visible content on the web page but provides important details
for the browser and search engines.

7) How to insert CSS in an html page?


a) We can insert CSS (Cascading Style Sheets) into an HTML page using various
methods, depending on our requirements and preferences. Here are some common
ways to include CSS in an HTML page:
b) Inline CSS:
i) we can apply CSS directly to a specific HTML element using the style attribute.
ii) This is the simplest and most direct way to apply CSS to an element.
iii) While inline CSS is straightforward, it's not the best practice for larger projects
because it mixes HTML and CSS and can make the code less maintainable.
c) Internal CSS:
i) We can embed CSS within the <style> element in the <head> section of your
HTML document.
ii) This method allows us to define CSS rules for multiple elements within the same
HTML document.
iii) Internal CSS is useful for smaller projects, and it keeps the CSS within the same
document, making it easier to manage.
d) External CSS:
i) For larger and more organized projects, it's common to create a separate CSS file
and link it to your HTML document.
ii) this promotes code reusability and maintainability.

8) Explain the new features of HTML in brief.


a) Question no 1
9) Describe image tag in HTML? How to create an image on a web page with
examples.
a) The image tag in HTML is represented by the <img> element, and it is used to embed
images in a web page.
b) The <img> element does not have a closing tag; instead, it uses attributes to specify
the source (URL) of the image and additional attributes for customization.
<!DOCTYPE html>
<html>

<head>
<title>HTML Tag</title>
</head>

<body>
<img src = "https://www.tutorialspoint.com/images/html.gif"
alt = "HTML Tutorial" height = "150" width = "140" />
</body>

</html>
c) The <img> element is used to display images.
d) The src attribute specifies the source URL of the image file.
e) The alt attribute provides alternative text for the image
f) The width and height attributes allow you to define the dimensions of the image in
pixels, which can be useful for controlling the image's size.

10) What is Java Script? Explain its benefits.


a) JavaScript is a popular programming language used in web development to make
websites interactive and dynamic.
b) It allows developers to add interactivity, manipulate web page content, and create
dynamic features on websites.
c) Interactivity: JavaScript allows you to create features like forms, buttons, and
animations that respond to user actions, making websites more engaging.
d) Lightweight: You can write and run JavaScript directly in web browsers, no complex
setup required.
e) Open Source: It's open-source with a rich ecosystem of libraries and frameworks,
simplifying development.
f) Cross-Platform: It's not limited to web browsers; you can use it with technologies
like Node.js for server-side applications.
g) Community and Support: JavaScript has a large developer community with
abundant resources and documentation.
h) Integration: JavaScript easily works with HTML and CSS, enhancing the structure
and design of web pages.
11) Elaborate on different tags which are used for search engine optimization.
a) Search Engine Optimization (SEO) is the practice of optimizing web content to
improve its visibility and ranking on search engine results pages, such as Google
b) Here are some HTML tags commonly used for SEO:
i) Title Tag (<title>): The title tag is one of the most critical elements for SEO. It
defines the title of the web page and appears in search engine results and the
browser's title bar.
ii) Meta Description (<meta name="description">): While not a visible tag on the
web page, the meta description provides a brief summary of the page's content in
search results.
iii) Header Tags (<h1>, <h2>, <h3>, etc.): Header tags are used to structure the
content on a page. They indicate the hierarchy of headings, with <h1>
representing the main heading and <h2>, <h3>, etc., for subheadings. Search
engines use header tags to understand the content's organization.
iv) Anchor Text (<a>): The anchor text in hyperlinks (links) provides context to the
linked page. Using descriptive and keyword-rich anchor text can improve SEO,
both for internal and external links.
v) HTML Sitemap (<ul> and <li>) and XML Sitemap: Creating HTML sitemaps
for users and XML sitemaps for search engines helps improve the discoverability
of your content.

12) What is PHP? Explain while loop in php.


a) The full form of PHP is "Hypertext Preprocessor."
b) It is a popular server-side scripting language used for web development to create
dynamic web pages.
c) A "while" loop in PHP is a control structure that allows you to execute a block of
code repeatedly as long as a specified condition is true.
d) The basic syntax of a while loop in PHP is as follows:
while (condition) {
// Code to be executed as long as the condition is true
}
e) The "condition" is a Boolean expression or a condition that you specify. As long as
this condition is true, the code inside the while loop will continue to execute.
f) The code block within the curly braces { } is the set of instructions that you want to
repeat while the condition is true.

13) Explain break and switch statements in php.


a) In PHP, the break statement and the switch statement are control structures that help
control the flow of a program, especially within conditional logic.
b) Break Statement:
i) The break statement is used to exit a loop or switch statement prematurely.
ii) It is often used within loops (e.g., while, for, foreach) or within a switch
statement to control the program's flow.
iii) In loops, a break statement allows you to exit the loop before it reaches its normal
termination condition. For example:
$i = 1;
while ($i <= 10) {
if ($i == 5) {
break; // exit the loop when $i is 5
}
echo $i . " ";
$i++;
}
c) Switch Statement:
i) The switch statement is used to evaluate a variable or expression against multiple
possible values and execute different code blocks based on the value of the
variable.
ii) It provides a more efficient way to handle multiple conditional cases than a series
of if and else if statements.
$day = "Tuesday";
switch ($day) {
case "Monday":
echo "It's Monday!";
break;
case "Tuesday":
echo "It's Tuesday!";
break;
case "Wednesday":
echo "It's Wednesday!";
break;
default:
echo "It's some other day.";
}

14) What is the difference between HTML and CSS?


HTML CSS
HTML stand for Hypertext Markup CSS stand for Cascading Style Sheets.
Language.
HTML is used for structuring the content. CSS is used for styling and presentation of
web pages.
It is used for structuring the content and It defines how HTML elements should
defining the elements that make up a web appear on the screen or in print, including
page's structure, including text, images, aspects like layout, colors, fonts, spacing,
links, forms, headings, and more. and more
HTML uses markup tags (enclosed in CSS uses rules to target HTML elements
angle brackets) to define elements and and apply styles to them. A CSS rule
their properties. These tags provide a consists of a selector (identifying which
semantic structure to the content, HTML elements to style) and a set of
indicating the meaning and hierarchy of property-value pairs (defining how those
different elements. elements should look).
HTML focuses on content and its CSS separates the content from the
organization, defining the layout of a web presentation, allowing web designers
page's structure.
It tells the browser what elements are on developers to control the visual
the page, but it doesn't specify how they appearance of a web page without altering
should be styled or presented. the HTML structure.

15) Explain boolean operator and assignment operators.


a) In JavaScript, boolean operators, also known as logical operators, are used to perform
logical operations on boolean values (true or false) or expressions that evaluate to
boolean values.
i) AND (&&):The AND operator returns true if both the left and right operands are
true. If either operand is false, the result is false.
ii) OR (||): The OR operator returns true if either the left or right operand is true. If
both operands are false, the result is false
iii) NOT (!): The NOT operator negates the value of an operand. If the operand is
true, it becomes false, and if it's false, it becomes true.
b) Assignment operators in JavaScript are used to assign values to variables. Here are
some common assignment operators:
i) Basic Assignment (=): This operator assigns the value on the right side to the
variable on the left side.
ii) Addition Assignment (+=): This operator adds the value on the right side to the
variable on the left side and assigns the result to the variable.
iii) Subtraction Assignment (-=): This operator subtracts the value on the right side
from the variable on the left side and assigns the result to the variable.
iv) Multiplication Assignment (*=): This operator multiplies the variable on the left
side by the value on the right side and assigns the result to the variable.

16) What is CSS? How to create an Internal style sheet in HTML.


17) How do you add buttons in HTML?
a) The <button> tag defines a clickable button.
b) We can add buttons in HTML using the <button> element or the <input> element
with a type attribute set to "button."
c) There are several methods to create an HTML button that acts as a link. Some of
them are discussed below:
i) Using onclick Event: The onclick event attribute works when the user click on
the button. When mouse clicked on the button then the button acts like a link
and redirect page into the given location.
ii) Using button tag inside <a> tag: This method create a button inside anchor tag.
The anchor tag redirect the web page into the given location.
iii) Using form tags: This method uses form tag and button tag. When button is
clicked then the form action attribute is called and web page redirect into the
given location.
iv) Adding styles as button to a link: This method create a simple anchor tag link
and then apply some CSS property to makes it like a button.
18) Describe boolean operator and assignment operators.
a) Question no 15
19) How do you add colour to the text in HTML?
a) We can add color to text in HTML by using the CSS (Cascading Style Sheets)
property called color.
b) . The color property allows you to specify the text color, and you can use a variety of
methods to define colors in HTML. Here's how to do it:
i) Using Named Colors: HTML and CSS support a set of predefined color names
that you can use. For example, you can set the text color of an element like this:
<p style="color: red;">This text is red.</p>
ii) Using Hexadecimal Color Codes: You can use hexadecimal color codes to
specify a more extensive range of colors. For example:
<p style="color: #00ff00;">This text is green.</p>
iii) Using RGB Color Values: RGB (Red, Green, Blue) color values allow you to
define colors by specifying the amount of red, green, and blue in the color. For
example:
<p style="color: rgb(255, 0, 0);">This text is red.</p>
iv) Using RGBA Color Values: Similar to RGB, you can also use RGBA (Red,
Green, Blue, Alpha) values to define colors with an additional alpha channel for
transparency. For example:
<p style="color: rgba(0, 0, 255, 0.5);">This text is semi-transparent
blue.</p>

20) How do you add bg color in HTML?


a) To set the background color in HTML, use the style attribute, with the CSS property
background-color inside the body tag of the HTML document.
b) HTML5 do not support the <body> tag bgcolor attribute, so the CSS style is used to
add background color. The bgcolor attribute deprecated in HTML5.
c) Syntax
<body style="background-color:aquamarine;">
d) Following is the example program to set background color in HTML.
<hmtl>
<body style+”background-color:aquamarline:”
<h1>HTML Articles</h1>
</body>
</html>

21) Advantages and Disadvantages of AJAX.


a) Advantages:
i) Reduced Server Load: AJAX requests are typically smaller in size compared to
full page requests, which can reduce the server load and improve overall website
performance.
ii) Real-time Updates: AJAX is often used for real-time features like chat
applications, notifications, and live updates, allowing users to receive immediate
feedback.
iii) Cross-browser Compatibility: AJAX is supported by most modern web browsers,
making it a reliable choice for web development.
iv) Interactive Forms: AJAX can be used to validate and submit form data without
refreshing the entire page, providing a smoother form submission process.
b) Disadvantages:
i) SEO Challenges: Search engine optimization (SEO) can be more challenging with
AJAX-driven websites because search engines may not index content loaded via
AJAX, potentially affecting a site's search engine rankings.
ii) Complexity: AJAX can add complexity to web applications, especially as they
become more feature-rich, making them harder to maintain and debug.
iii) Accessibility: AJAX-based content updates can be less accessible for users with
disabilities if not implemented with proper accessibility features in mind.
iv) Back Button and Bookmarking Issues: AJAX-based applications may not work
well with browser navigation features like the back button, and bookmarking can
be problematic when content is loaded dynamically.

22) How to insert CSS in an html page?


a) Question no 7
23) What is the role of the <head> tag in HTML?
a) The <head> element is a container for metadata (data about data) and is placed
between the <html> tag and the <body> tag.
b) HTML metadata is data about the HTML document. Metadata is not displayed.
c) Metadata typically define the document title, character set, styles, scripts, and other
meta information.
d) The HTML <head> element is a container for the following
elements: <title>, <style>, <meta>, <link>, <script>, and <base>.

24) How do you align list elements in an HTML file?


25) Differentiate between an Ordered list and an Unordered list?
Ordered List Unordered List
An ordered list is used to create a list of An unordered list is used to create a list of
items that should appear in a specific items that do not have a specific order or
order or sequence. sequence.
List items in an ordered list are typically List items in an unordered list are
numbered (1, 2, 3, etc.) by default, typically displayed with bullet points or
other markers (e.g., squares, circles) by
default,
Ordered lists are created using the <ol> Unordered lists are created using the <ul>
tag tag
We can use type attribute for <ol> tag to We can use type attribute for <ul> tag to
specify the type of numbering we like. specify the type of bullet we like.

<ol type = "1"> - Default-Case Numerals. <ul type = "square


<ol type = "I">- Upper-Case Numerals. <ul type = "disc">
<ol type = "i"> - Lower-Case Numerals. <ul type = "circle">
<ol type = "A"> - Upper-Case Letters.
<ol type = "a"> - Lower-Case Letters

26) How do you use a hyperlink in HTML? Explain features of HTML.


a) To create a hyperlink in HTML, you use the <a> (anchor) element.
b) A hyperlink allows you to link to other web pages, documents, or resources. Here's
how you can use the <a> element in HTML: <a href="URL">Link Text</a>
c) <a>: This is the opening anchor tag.
d) href: This attribute specifies the "hypertext reference," which is the URL or location
to which the link should point
e) "URL": Replace "URL" with the actual web address (e.g.,
"https://www.example.com") or relative path to the resource you want to link to.
f) Features of HTML:
i) It is easy to learn and easy to use.
ii) It is platform-independent.
iii) Images, videos, and audio can be added to a web page.
iv) Hypertext can be added to the text.
v) It is a markup language.

27) Write a note on return statement in java script


a) In JavaScript, the return statement is used within functions to specify the value that
the function should return when it's called.
b) It allows a function to compute a result and send it back to the caller for further use.
c) Syntax: The return statement is followed by an expression or value that you want to
return.
return expression;
d) Purpose: The primary purpose of the return statement is to exit the function and
provide a value as the result of the function's execution. This value can be used in the
calling code.
e) Multiple return Statements: A function can contain multiple return statements, but
only one of them is executed. The choice of which return statement to execute
depends on the function's control flow. Once a return statement is executed, the
function exits immediately, and no further code within the function is executed.
f) Returning Different Data Types: JavaScript functions can return values of various
data types, including numbers, strings, objects, arrays, and even other functions.

28) Describe Features and benefits of php.


a) Features
i) Open Source: PHP is open-source and freely available, making it cost-effective
for web development projects.
ii) Ease of Learning: PHP is known for its relatively simple and intuitive syntax,
making it accessible to beginners.
iii) Security Features: PHP includes security features like data validation,
encryption, and built-in functions to protect against common web vulnerabilities,
such as SQL injection and cross-site scripting (XSS).
iv) Cross-Platform Compatibility: PHP runs on various operating systems,
including Windows, macOS, and Linux, making it highly versatile.
v) Extensive Community and Documentation: There is a large and active PHP
community, and extensive documentation and resources are available online,
which makes it easy to find help and solutions to common problems.
b) Benefits
i) Cross-Browser Compatibility: PHP-generated HTML is typically compatible
with all major web browsers, ensuring a consistent user experience.
ii) Cost-Effective: Being open-source, PHP helps reduce development costs, making
it an attractive choice for businesses and developers.
iii) High Performance: With the right optimization and caching techniques, PHP can
deliver good performance, even for high-traffic websites.
iv) Dynamic Content: PHP can generate dynamic content based on user input and
database interactions, allowing for personalized user experiences.

29) Explain AJAX in detail. How will it be helpful for web development ?
a) AJAX (Asynchronous JavaScript and XML) is a set of web development techniques
that enables web applications to communicate with a web server asynchronously,
without requiring a full page refresh. It helps web development by:
b) Improving User Experience: AJAX allows for smoother and more responsive web
applications, reducing the need for full page reloads.
c) Reducing Server Load: AJAX requests are typically smaller, reducing server load
and improving website performance.
d) Bandwidth Efficiency: AJAX saves bandwidth and reduces data transfer costs,
important for mobile users.
e) Real-time Updates: AJAX is used for real-time features like chat, notifications, and
live updates.
f) Cross-browser Compatibility: AJAX is supported by most modern browsers,
ensuring broad compatibility.
g) Interactive Forms: AJAX can validate and submit form data without refreshing the
entire page, offering a smoother user experience.

30) What are the different types of headings in HTML?


a) In HTML, there are six levels of headings, which are specified using the <h1> to
<h6> tags.
b) hese headings create a hierarchical structure for your webpage's content, with <h1>
being the highest (most important) level and <h6> being the lowest (least important)
level.
c) <h1> - Heading 1: This is the highest-level heading and is typically used for the main
title or heading of your webpage.
d) <h2> - Heading 2: This is the second-level heading and is used for subsection titles. It
represents a lower level of importance compared to <h1>.
e) <h3> - Heading 3: <h3> represents the third level of headings and is used for sub-
subsection titles. It signifies a lower level of importance compared to <h2>.
f) <h4> - Heading 4: <h4> is used for even lower-level headings, typically for sub-sub-
subsections or specific content within sections.
g) <h5> - Heading 5: <h5> represents the fifth level of headings and is used when
further subdivision of content is necessary.
h) <h6> - Heading 6: This is the lowest-level heading and is used for the least important
headings or subheadings within content.
31) How do you align list elements in an HTML file?
a) Question no 24

You might also like