NEW
Font size
WorksheetsHTML, CSS, and JavaScript MCQs
Total questions: 60
Worksheet time: 14mins
What does HTML stand for?
Hyper Text Markup Language
High Tech Machine Learning
Hyperlink Text Management Language
Hyper Transfer Markup Language
Which tag is used to define an unordered list?
<ol>
<ul>
<li>
<list>
The <meta> tag is used for:
Styling the web page
Adding metadata to the document
Embedding videos
Creating tables
Which attribute is used to open a link in a new tab?
href="_blank"
target="_new"
target="_blank"
newtab="true"
The <section>
tag is used for:
Grouping related content
Styling text
Adding links
None of the above
Which input type is used for selecting multiple options?
radio
checkbox
text
submit
What is the purpose of the <label> tag?
Styling text
Associating a text description with an input field
Creating headings
Displaying images
The alt attribute in the <img> tag is used for:
Adding an alternative image
SEO purposes and accessibility
Adjusting image size
Linking an image
Which tag is used for the main heading of a webpage?
<h1>
<title>
<header>
<main>
Which HTML tag is used to create a table?
<tbl>
<td>
<tr>
<table>
The correct way to insert a comment in HTML is:
<!-- This is a comment -->
// This is a comment
/* This is a comment */
{# This is a comment #}
What is the purpose of the <label>
tag?
To define the bottom section of a webpage
To create a navigation bar
To add footnotes
To apply CSS
Which HTML tag is used to create a dropdown list?
<dropdown>
<select>
<list>
<option>
The default alignment of text in an HTML paragraph is:
Center
Right
Justified
Left
What is the purpose of the action attribute in a form?
It specifies the JavaScript function to execute
It defines the destination URL where form data is sent
It styles the form elements
It validates the form data
What does CSS stand for?
Creative Style Sheets
Cascading Style Sheets
Computer Style System
Colorful Styling System
Which CSS property is used to change the text color?
font-color
text-color
color
text-style
Which property controls the spacing between lines of text?
line-height
spacing
letter-spacing
text-indent
How do you apply a background color in CSS?
background-color: red;
color: red;
background: red;
bgcolor: red;
Which CSS unit is relative to the font size of the element?
px
em
%
cm
Which of the following is NOT a valid CSS selector?
#idSelector
.classSelector
*
$specialSelector
What is the default position of an element?
absolute
fixed
relative
static
Which property is used to make text bold?
font-weight
bold
text-weight
font-style
The z-index property is used for:
Adjusting element stacking order
Changing font size
Hiding elements
Adding animations
Which property is used to control element transparency?
opacity
visibility
transparent
alpha
What is the default display property of a
<div> ?
inline
block
inline-block
grid
Which property is used to create rounded corners?
border-radius
corner-radius
border-style
box-radius
What is the CSS transition property used for?
Making animations
Adding hover effects
Smoothly changing properties over time
Positioning elements
How do you select all <p> elements inside a <div>?
div p
div > p
div + p
div ~ p
What is the full form of CSS Grid property fr?
Fraction
Free
Frame
Format
What is JavaScript primarily used for?
Server-side scripting
Styling web pages
Adding interactivity to web pages
Managing databases
How do you declare a variable in JavaScript?
var x;
let x;
const x;
All of the above
Which function is used to print data to the console?
console.print()
log.console()
console.log()
print()
What keyword is used to define a function?
func
function
def
declare
How do you write a comment in JavaScript?
/*Comment
// Comment
/* Comment */
Both b and c
What will typeof null return?
"null"
"undefined"
"object"
"string"
Which symbol is used for strict equality comparison?
=
==
===
!=
How do you declare an arrow function in JavaScript?
function() => {}
() -> {}
() => {}
=> {}
What does the push() method do in JavaScript arrays?
Removes the last element
Adds an element to the end
Removes the first element
Adds an element to the beginning
How do you check if a variable x is an array?
x.isArray()
typeof x === "array"
Array.isArray(x)
x instanceof array
What will 5 + "5" evaluate to?
10
55
Error
NaN
What is the purpose of JSON.stringify()?
Convert a JSON object to a string
Convert a string to JSON
Parse an XML response
None of the above
What will console.log(1 == "1") output?
true
false
Error
NaN
Which JavaScript loop executes at least once even if the condition is false?
for loop
while loop
do...while loop
foreach loop
What is the purpose of the setTimeout function?
Runs a function immediately
Delays execution of a function
Runs a function indefinitely
Stops a function
How do you select an element with the ID "box" in JavaScript?
document.getElementByClass("box")
document.querySelector("#box")
document.query("#box")
document.getElementByTag("box")
How do you prevent the default action of an event?
event.stop()
event.preventDefault()
event.disable()
event.stopPropagation()
Which JavaScript keyword is used to handle errors?
catch
try
throw
try...catch
What will console.log(typeof []) output?
"array"
"object"
"list"
"undefined"
How do you check if a value is NaN in JavaScript?
typeof x === "NaN"
x == NaN
isNaN(x)
x === NaN
Which method is used to join two or more arrays?
merge()
concat()
join()
combine()
How do you create an empty array in JavaScript?
let arr = new Array();
let arr = [];
[]let arr = {};
let arr = null;
Which method is used to add an element to the end of an array?
append()
add()
insert()
push()
Which property is used to change the background color of an element?
bg-color
color
background-color
background-style
How do you round 4.7 down to the nearest integer in JavaScript?
Math.round(4.7)
Math.ceil(4.7)
Math.cut(4.7)
Math.floor(4.7)
Which method is used to add an element to the end of an array in JavaScript?
insert()
append()
add()
push()
What is the correct way to link a CSS file in an HTML document?
<style src="styles.css">
<link href="styles.css" rel="stylesheet">
<link rel="stylesheet" href="styles.css">
<css href="styles.css">
Which method is used to remove the last element from an array in JavaScript?
pop()
remove()
delete()
shift()
What does the 'display' property in CSS control?
How an element is displayed on the page
The size of an element
The color of an element
The position of an element
What does the 'this' keyword refer to in JavaScript?
The global object
The previous function context
The current function context
None of the above
