16 questions · 49 marks · 9 papers. Try each one before checking.
Solve them and check answers →Read the notes first
24 Mar 2024
Question 16 MSQ · 4.5 marks
Consider the following HTML document and select the correct option(s).
<!DOCTYPE html>
<html>
<head>
<title>Form Validation</title>
<script>
function validateForm() {
var username = document.forms["myForm"]["username"].value;
var password = document.forms["myForm"]["password"].value;
if (username == "") {
alert("Username must be filled out");
return false;
}
if (password.length < 8) {
alert("Password must be at least 8 characters long");
return false;
}
}
</script>
</head>
<body>
<form name="myForm" onsubmit="validateForm()">
<label for="username">Username:</label>
<input type="text" name="username">
<label for="password">Password:</label>
<input type="password" name="password" required>
<input type="submit" value="Submit">
</form>
</body>
</html>
- The JavaScript function,
'validateForm' performs the backend processing of form data. - The JavaScript function,
'validateForm' carries out the client side validation of form data. - If the password field is left empty, on submission, the user will get a prompt "Please fill out this field." near the password field.
- If the password field is left empty, on submission, the user will get a prompt "Password must be at least 8 characters long" from the browser.
04 Aug 2024
Question 19 MSQ · 4.5 marks
Consider the following HTML Document and select the correct statement(s) from the following if a user types the password “mad1password” in the password field letter by letter.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Login Form</title>
<style>
input[type="password"]:valid{
background-color: green;
}
input[type="password"]:invalid{
background-color: red;
}
</style>
</head>
<body>
<div class="login-form">
<h2>Login</h2>
<form>
E-mail: <input type="email" id="email" name="email" required>
Password: <input type="password" id="password" name="password"
required minlength="5" maxlength="8">
<input type="submit" value="Login">
</form>
</div>
</body>
</html>
- The HTML form is integrated with backend validation.
- The HTML form is integrated with Frontend HTML5 validation.
- The background colour of the password field remains red for the first 4 letters,then turns green for the next 4 letters, and then again turns red for the remaining letters.
- The background colour of the password field remains red for the first 4 letters,then turns green for the next 4 letters, and then remains green for the remaining allowable letters.
01 Dec 2024
Question 15 MSQ · 2 marks
Which of the following statements are correct?
- HTML defines the styling, while CSS defines the content
- HTML defines the content, while CSS defines the styling
- JavaScript is always the core part of an application's frontend
- JavaScript provides additional functionality at the frontend
16 Mar 2025
Question 3 MCQ · 2 marks
Which of the following best describes the primary advantage of asynchronous updates in web applications?
- It ensures that all elements of a web page are loaded at the same time.
- It improves performance by allowing parts of a webpage to update withoutrequiring a full reload.
- It forces the client to wait until the server responds before interacting with thepage.
- It requires a high-speed internet connection to function correctly.
03 Aug 2025
Question 5 MCQ · 2 marks
What is the right syntax to use an external JavaScript file(.js) into the current html file?
<script src="jsfile.js"></script><script href="jsfile.js"></script><import src="jsfile.js"></import><import link="jsfile.js"></import>
Question 10 MCQ · 4.5 marks
Consider the following HTML code.
Filename: main.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Greetings</title>
</head>
<body>
<button onclick="alert('Hello, welcome')">Greet1!</button><br>
<button onclick="console.log('Hello, welcome')">Greet2!</button><br>
<button onclick="document.write('Hello, welcome')">Greet3!</button><br>
<button onclick="console.error('Hello, welcome')">Greet4!</button>
</body>
</html>
Rendered HTML output below:
[Image Description: Four stacked HTML buttons labeled "Greet1!", "Greet2!", "Greet3!", and "Greet4!".]
Which of the above “Greet” buttons will print greetings on the dialogue box?
- Greet4
- Greet3
- Greet2
- Greet1
14 Aug 2026
Question 6 MCQ · 3 marks
A recipe webpage needs to display two distinct sections:
- A list of ingredients where the order does not matter.
- A sequence of cooking steps that must be followed in order.
Which combination of HTML list container tags is most appropriate for these sections?
Ingredients: <ol> | Cooking Steps: <ol>Ingredients: <ul> | Cooking Steps: <ul>Ingredients: <dl> | Cooking Steps: <ul>Ingredients: <ul> | Cooking Steps: <ol>
Question 15 MSQ · 2 marks
Which of the following statements is/are true about Document Object Model (DOM)?
- It is the programming interface for web documents.
- It is the abstract model of the document.
- Its structure is rigid and cannot be changed once created.
- It can only be manipulated with the help of JavaScript.
Question 11 MCQ · 2 marks
In the context of asynchronous updates, which of the following statements is correct?
- It updates a web page without reloading the whole page
- It leads to better user experience as it involves quick response on the main page with minimal data to refresh
- Both It updates a web page without reloading the whole page and It leads to better user experience as it involves quick response on the main page with minimal data to refresh are correct
- None of these
July 2022
Question 14 MCQ · 4.5 marks
Consider the HTML document given below:
<!DOCTYPE html>
<html>
<head>
<style>
[id~=out] {
border: 10px solid red;
}
[class~=out]{
border: 5px solid yellow;
}
</style>
</head>
<body>
<h2>Hello World!</h2>
<h1 id="out">Hey!</h1>
<p id="out-text">My name is Fred.</p>
<p class="outcontent">I am learning to develop applications.</p>
<p id="out"> Are you also willing to learn?</p>
<p class="out">Welcome to the world of Application development!</p>
<h3>Have a nice day!!</h3>
</body>
</html>
Which of the following statements is true for the above HTML document when rendered by the browser?
- The headings, i.e., 'Hello World!' and 'Hey!', both will have red border color.
- The paragraph with class='out', will get a yellow color border.
- The paragraph with id='out' will get a yellow color border.
- The two paragraphs with contents, 'My name is Fred.' and 'I am learning todevelop applications.', will both get a red color border and yellow color border.
Question 9 MCQ · 3 marks
Consider the following HTML file with embedded JavaScript.
Filename: index.html
<!DOCTYPE html>
<html>
<body>
<h2>Creating a Json Object </h2>
<p id="jsonobj"></p>
<script>
const txt = '{"name":"icecream","type":"cup", "flavor":"vanilla"}'
const obj = JSON.parse(txt);
document.getElementById("jsonobj").innerHTML = obj.name + ", " + obj.flavor + ", " + obj.type;
</script>
</body>
</html>
How will the browser render the above HTML file?
- Creating a Json Object
undefined, undefined, undefined
- Creating a Json Object
vanilla, icecream, cup
- Creating a Json Object
cup, vanilla, icecream
- Creating a Json Object
icecream, vanilla, cup
Aug 2023
Question 7 MCQ · 3 marks
Consider the following HTML Document file given below.
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
<style>
input:invalid {
background: red;
}
input:valid {
background: green;
}
</style>
</head>
<body>
<form>
<label for="uname">Enter a valid e-mail:</label>
<input type="text" name="uname" minlength="8">
</form>
</body>
</html>
Suppose the index.html is rendered on the browser. What will be the background color of the input box when the user enters the name “madcourse.mail.com"?
- red
- white
- green
- insufficient information
Question 15 MSQ · 3 marks
Which of the following is/are valid JSON format.
{
"Age": 27,
"firstName": "John",
"lastName": "Pollard",
"married": false,
"phone_numbers": ["212-555-1234", "212-666-5678"]
}
{
"RollNumber": 11,
"firstName": "Nick",
"lastName": "Paul",
"phone_numbers": [2125551234, "2124441234"]
}
{
"firstName": "Will",
"lastName": "Smith",
"address": [
"addressLine": "Lake Union Hill Way",
"city": "Atlanta",
"zipCode": 50005
]
}
{
"firstName": "Hannah",
"lastName": "Smith",
"cities": ["Dallas", "San Antonio", "Irving"],
"phone_numbers": ["212-555-1234", "212-666-5678"]
}
06 Apr 2026
Question 7 MCQ · 3 marks
Consider the following HTML/CSS code.
<!DOCTYPE html>
<html>
<head>
<style>
p { color: blue; }
.text { color: green; }
#para { color: red; }
</style>
</head>
<body>
<p id="para" class="text" style="color: black;">
IITM BS Degree Program
</p>
</body>
</html>
What will be the output when the above HTML file is rendered?
[Image Description: The four options show the text "IITM BS Degree Program" rendered in four different font colors corresponding to the CSS rules: blue, green, red, and black.]
- IITM BS Degree Program (in blue color)
- IITM BS Degree Program (in green color)
- IITM BS Degree Program (in red color)
- IITM BS Degree Program (in black color)
Question 12 MCQ · 4 marks
Consider the following HTML code.
<!DOCTYPE html>
<html>
<body>
<ol id="lst">
<li>App Dev-1</li>
</ol>
</body>
<script>
let lst_items=document.getElementsByTagName("li");
document.getElementById("lst").innerHTML += "<li>App Dev-2</li><li>App dev projects</li>";
console.log(lst_items.length);
</script>
</html>
What will be the output in the console window when the above HTML doc is rendered on the browser ?
- 1
- 2
- 3
- 4
Question 2 MCQ · 2 marks
Which of the following enables asynchronous communication between client and server without loading the entire web page?
- CGI
- FTP
- SMTP
- AJAX
Check your answers →
Weeks covering this topic
Other MAD 1 topics