Back to Must-Know Dashboard

Web Technologies

Must-Know Questions & Answers

HTML5 Fundamentals#1

Which of the following is/are the new feature(s) of HTML5? (Select all that apply)

A
Performs Client-Side validation
B
Enhanced comment lines
C
Supports offline Storage
D
Browser automatically provides space before and after the tag <p>

HTML5 introduced client-side form validation (using attributes like required, pattern, type=email) and offline storage support via localStorage, sessionStorage, and the Application Cache API.

HTML5 Fundamentals#2

HTML stands for __________

A
Hot Mail
B
Hybrid Text Markup Language
C
Hyper Text Markup Language
D
Hot Markup Language

HTML stands for Hyper Text Markup Language — the standard markup language used to create and structure web pages.

HTML5 Fundamentals#3

An application that lets you search and see material on the internet is:

A
Website
B
Homepage
C
Browser
D
Webpage

A Browser (e.g., Chrome, Firefox, Safari) is a software application that retrieves, renders, and lets users navigate content on the internet.

HTML5 Fundamentals#4

Which element is a container for all the head elements, and may include the document title, scripts, styles, meta information, and more?

A
<br></br>
B
<body></body>
C
<title></title>
D
<head></head>

The <head></head> element is a container for metadata and links to external resources like scripts, stylesheets, and meta tags. It is not displayed in the browser.

HTML5 Fundamentals#5

Which of the following is the most appropriate tag in HTML5 to divide a document into logical document groups?

A
<section></section>
B
<span></span>
C
<div></div>
D
<group></group>

The <section> tag in HTML5 is used to define logical sections in a document, such as chapters or thematic groupings of content. It is a semantic element unlike the generic <div>.

HTML5 Fundamentals#6

The following elements are newly added in HTML5: <section>, <article>, <aside>. These elements are called ___________

A
Control elements
B
Graphic elements
C
Multimedia elements
D
Semantic elements

Semantic elements clearly describe their meaning to both the browser and the developer. Tags like <section>, <article>, <aside>, <header>, <footer>, and <nav> are all HTML5 semantic elements.

HTML5 Fundamentals#7

Which of the following is/are true about HTML? (Select all that apply)

A
Some of the tags are self closing while some of the tags must be explicitly closed in HTML5
B
HTML is case sensitive
C
Browser does not throw any error even if we have mistaken in the HTML syntax

In HTML5, some tags like <br>, <img>, <input> are self-closing, while others like <div>, <p> must be explicitly closed. HTML is NOT case sensitive. Browsers are lenient and attempt to render even malformed HTML without throwing errors.

HTML5 Fundamentals#8

If you want to change the color of a link to red when moving the mouse pointer on top of it, which CSS rule do you need?

A
a:hover{ color: red; }
B
a{ color: red; }
C
a:moved{ color: red; }
D
link:visited{ color: red; }

The CSS :hover pseudo-class applies styles when the user's pointer hovers over an element. 'a:hover { color: red; }' changes the link color to red on mouseover.

HTML5 Forms and Input#9

Consider a date input field that shows a dropdown with specific holidays (Republic Day, May Day, Independence Day) and their dates. Which HTML code produces this?

A
<input type="date" id="date" name="date" list="holidays"> <datalist id="holidays"> <option label="Republic Day">2017-01-26</option> <option label="May Day">2017-05-01</option> <option label="Independence Day">2017-08-15</option> </datalist>
B
<select type="date"> <option label="Republic Day">2017-01-26</option> <option label="May Day">2017-05-01</option> <option label="Independence Day">2017-08-15</option> </select>
C
<input type="date" id="date" min="2017-01-26" max="2017-08-15">
D
<input type="date" id="date" name="date" list="holidays"> <select id="holidays"> <option label="Republic Day">2017-01-26</option> <option label="May Day">2017-05-01</option> <option label="Independence Day">2017-08-15</option> </select>

The <datalist> element is linked to an <input> via the 'list' attribute. It provides predefined suggestions while still allowing free text entry. The <select> tag does not pair with a date input, and min/max only sets a range without labels.

HTML5 Forms and Input#10

Match the HTML form field to the correct input type attribute: Webaddress, PANNO, Email-id, Marital Status, Loan tenure, MobileNo

A
Webaddress→url, PANNO→text, Email-id→email, Marital Status→radio, Loan tenure→range, MobileNo→tel
B
Webaddress→URL, PANNO→text, Email-id→email, Marital Status→radio, Loan tenure→range, MobileNo→tel
C
Webaddress→href, PANNO→number, Email-id→mail, Marital Status→select, Loan tenure→range, MobileNo→phone
D
Webaddress→text, PANNO→text, Email-id→email, Marital Status→checkbox, Loan tenure→slider, MobileNo→number

Correct mappings: Webaddress → type="url" (validates web address format), PANNO → type="text" (alphanumeric), Email-id → type="email" (validates email format), Marital Status → type="radio" (mutually exclusive options), Loan tenure → type="range" (slider), MobileNo → type="tel" (telephone number).

HTML5 Forms and Input#11

If the phone number should accept only 10 digit numbers, which of the following options will suit?

A
<input type="text" pattern="[0-9]{10}"/>
B
<input type="number" min="0" max="9" />
C
<input type="text" min="0" max="9" />
D
<input type="number" pattern="[0-9]{10}"/>

The 'pattern' attribute accepts a regex. [0-9]{10} matches exactly 10 digits (0–9). type="text" is correct here since 'pattern' works with text inputs. min/max only constrains numeric range, not digit count.

HTML5 Forms and Input#12

A textbox field should display "Only numbers are allowed" as hint text that disappears automatically when the user starts typing. Which options achieve this? (Select all that apply)

A
<input type="text" value="Only numbers are allowed">
B
<input type="tel" placeholder="Only numbers are allowed">
C
<input type="text" placeholder="Only numbers are allowed">
D
<input type="tel" value="Only numbers are allowed">
E
<input type="tel" default="Only numbers are allowed">

The 'placeholder' attribute displays hint text inside an input field that disappears when the user starts typing. Both type="text" and type="tel" support placeholder. Using 'value' pre-fills the field with actual text that must be manually deleted. 'default' is not a valid HTML attribute for inputs.

HTML5 Forms and Input#13

Ram designed a feedback portal where clicking a 'like' or 'unlike' image redirects to 'thanks.html'. Which HTML code correctly implements this?

A
<form action="thanks.html"> <input type="submit" src="like.jpg"/> <input type="submit" src="unlike.jpg"/> </form>
B
<form action="thanks.html"> <input type="submit"> <img src="like.jpg"/> <img src="unlike.jpg"/> </input> </form>
C
<form action="thanks.html"> <img href="like.jpg" value="submit"/> <img href="unlike.jpg" value="submit"/> </form>
D
<form action="thanks.html"> <input type="image" src="like.jpg" alt="submit"/> <input type="image" src="unlike.jpg" alt="submit"/> </form>

type="image" creates a clickable image submit button that submits the form when clicked. The 'src' attribute points to the image. type="submit" doesn't use src for images, and <img> tags alone cannot submit forms.

JavaScript#14

Sita wishes to greet the user when the user clicks on a 'Greet Me' button. Which event should she use for the JavaScript code?

A
onmouseclick
B
onchange
C
onmouseover
D
onclick

The 'onclick' event fires when an element (like a button) is clicked. 'onmouseclick' is not a valid event. 'onchange' fires when a field value changes. 'onmouseover' fires when the pointer moves over an element.

JavaScript#15

When you want to enclose JavaScript statements in an HTML file, which is the correct tag to use?

A
<HEAD>
B
<SCRIPT>
C
<BODY>
D
<STYLE>

The <SCRIPT> tag is used to embed or reference JavaScript code in an HTML document. It can be placed in the <head> or <body> section.

JavaScript#16

Which of the below JavaScript code helps to change the content of the paragraph tag dynamically? <p id="pid1">Aim Higher.. Sky is your limit</p>

A
document.getElementById("pid1").innerHTML = "Never give up!!";
B
document.getElement("p").innerHTML = "Never give up!!";
C
document.getElementByName("p").innerHTML = "Never give up!!";
D
#demo.innerHTML = "Never give up!!";

document.getElementById() retrieves an element by its id attribute. Setting .innerHTML replaces the inner content. The other options use incorrect or non-existent DOM methods.

JavaScript#17

When a user views a page containing a JavaScript program, which machine actually executes the script?

A
A central machine deep within Netscape's corporate offices
B
Database Server
C
The User's machine running a Web browser
D
The Web server

JavaScript is a client-side scripting language. It is executed by the JavaScript engine inside the user's web browser (e.g., V8 in Chrome, SpiderMonkey in Firefox) on the user's local machine.

JavaScript#18

Which of the below statements is used to write a single-line comment in a JavaScript file?

A
/* this is a comment */
B
<!-- this is a comment -->
C
// this is a comment
D
// this is a comment //

// starts a single-line comment in JavaScript. /* */ is used for multi-line block comments. <!-- --> is the HTML comment syntax and is not used inside JS files.

JavaScript#19

Which of the following operations CANNOT be done with client-side JavaScript?

A
Store the form's contents to a database file on the server
B
Validate a form
C
Display an alert box to the user
D
Send a form's contents by email

Client-side JavaScript runs in the browser and has no direct access to server resources or databases. Writing to a server-side database requires server-side code (e.g., Node.js, PHP). Validation, alerts, and email sending via mailto: are achievable client-side.

JavaScript#20

Which of the below is the correct syntax for executing some code if 'amt' is equal to 5000?

A
if (amt = 5000)
B
if (amt equals 5000)
C
if (amt === "5000")
D
if (amt == 5000)

if (amt == 5000) uses the equality operator (==) which checks value equality with type coercion. if (amt = 5000) is an assignment, not comparison. if (amt === "5000") uses strict equality and would fail since 5000 (number) !== "5000" (string). 'equals' is not valid JS syntax.

Key Topics to Study

Based on our question bank analysis, master these concepts to score high in Web Technologies.

Preparation Tip

"Focus on understanding the logic behind pseudocode loops and selection statements, as they form the bulk of technical assessments."