wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

HTML, CSS, and JavaScript MCQs

Total questions: 60

Worksheet time: 14mins

Name
Class
Date
1.

What does HTML stand for?

a)

Hyper Text Markup Language

b)

High Tech Machine Learning

c)

Hyperlink Text Management Language

d)

Hyper Transfer Markup Language

2.

Which tag is used to define an unordered list?

a)

<ol>

b)

<ul>

c)

<li>

d)

<list>

3.

The <meta> tag is used for:

a)

Styling the web page

b)

Adding metadata to the document

c)

Embedding videos

d)

Creating tables

4.

Which attribute is used to open a link in a new tab?

a)

href="_blank"

b)

target="_new"

c)

target="_blank"

d)

newtab="true"

5.

The <section>

tag is used for:

a)

Grouping related content

b)

Styling text

c)

Adding links

d)

None of the above

6.

Which input type is used for selecting multiple options?

a)

radio

b)

checkbox

c)

text

d)

submit

7.

What is the purpose of the <label> tag?

a)

Styling text

b)

Associating a text description with an input field

c)

Creating headings

d)

Displaying images

8.

The alt attribute in the <img> tag is used for:

a)

Adding an alternative image

b)

SEO purposes and accessibility

c)

Adjusting image size

d)

Linking an image

9.

Which tag is used for the main heading of a webpage?

a)

<h1>

b)

<title>

c)

<header>

d)

<main>

10.

Which HTML tag is used to create a table?

a)

<tbl>

b)

<td>

c)

<tr>

d)

<table>

11.

The correct way to insert a comment in HTML is:

a)

<!-- This is a comment -->

b)

// This is a comment

c)

/* This is a comment */

d)

{# This is a comment #}

12.

What is the purpose of the <label>

tag?

a)

To define the bottom section of a webpage

b)

To create a navigation bar

c)

To add footnotes

d)

To apply CSS

13.

Which HTML tag is used to create a dropdown list?

a)

<dropdown>

b)

<select>

c)

<list>

d)

<option>

14.

The default alignment of text in an HTML paragraph is:

a)

Center

b)

Right

c)

Justified

d)

Left

15.

What is the purpose of the action attribute in a form?

a)

It specifies the JavaScript function to execute

b)

It defines the destination URL where form data is sent

c)

It styles the form elements

d)

It validates the form data

16.

What does CSS stand for?

a)

Creative Style Sheets

b)

Cascading Style Sheets

c)

Computer Style System

d)

Colorful Styling System

17.

Which CSS property is used to change the text color?

a)

font-color

b)

text-color

c)

color

d)

text-style

18.

Which property controls the spacing between lines of text?

a)

line-height

b)

spacing

c)

letter-spacing

d)

text-indent

19.

How do you apply a background color in CSS?

a)

background-color: red;

b)

color: red;

c)

background: red;

d)

bgcolor: red;

20.

Which CSS unit is relative to the font size of the element?

a)

px

b)

em

c)

%

d)

cm

21.

Which of the following is NOT a valid CSS selector?

a)

#idSelector

b)

.classSelector

c)

*

d)

$specialSelector

22.

What is the default position of an element?

a)

absolute

b)

fixed

c)

relative

d)

static

23.

Which property is used to make text bold?

a)

font-weight

b)

bold

c)

text-weight

d)

font-style

24.

The z-index property is used for:

a)

Adjusting element stacking order

b)

Changing font size

c)

Hiding elements

d)

Adding animations

25.

Which property is used to control element transparency?

a)

opacity

b)

visibility

c)

transparent

d)

alpha

26.

What is the default display property of a

<div> ?

a)

inline

b)

block

c)

inline-block

d)

grid

27.

Which property is used to create rounded corners?

a)

border-radius

b)

corner-radius

c)

border-style

d)

box-radius

28.

What is the CSS transition property used for?

a)

Making animations

b)

Adding hover effects

c)

Smoothly changing properties over time

d)

Positioning elements

29.

How do you select all <p> elements inside a <div>?

a)

div p

b)

div > p

c)

div + p

d)

div ~ p

30.

What is the full form of CSS Grid property fr?

a)

Fraction

b)

Free

c)

Frame

d)

Format

31.

What is JavaScript primarily used for?

a)

Server-side scripting

b)

Styling web pages

c)

Adding interactivity to web pages

d)

Managing databases

32.

How do you declare a variable in JavaScript?

a)

var x;

b)

let x;

c)

const x;

d)

All of the above

33.

Which function is used to print data to the console?

a)

console.print()

b)

log.console()

c)

console.log()

d)

print()

34.

What keyword is used to define a function?

a)

func

b)

function

c)

def

d)

declare

35.

How do you write a comment in JavaScript?

a)

/*Comment

b)

// Comment

c)

/* Comment */

d)

Both b and c

36.

What will typeof null return?

a)

"null"

b)

"undefined"

c)

"object"

d)

"string"

37.

Which symbol is used for strict equality comparison?

a)

=

b)

==

c)

===

d)

!=

38.

How do you declare an arrow function in JavaScript?

a)

function() => {}

b)

() -> {}

c)

() => {}

d)

=> {}

39.

What does the push() method do in JavaScript arrays?

a)

Removes the last element

b)

Adds an element to the end

c)

Removes the first element

d)

Adds an element to the beginning

40.

How do you check if a variable x is an array?

a)

x.isArray()

b)

typeof x === "array"

c)

Array.isArray(x)

d)

x instanceof array

41.

What will 5 + "5" evaluate to?

a)

10

b)

55

c)

Error

d)

NaN

42.

What is the purpose of JSON.stringify()?

a)

Convert a JSON object to a string

b)

Convert a string to JSON

c)

Parse an XML response

d)

None of the above

43.

What will console.log(1 == "1") output?

a)

true

b)

false

c)

Error

d)

NaN

44.

Which JavaScript loop executes at least once even if the condition is false?

a)

for loop

b)

while loop

c)

do...while loop

d)

foreach loop

45.

What is the purpose of the setTimeout function?

a)

Runs a function immediately

b)

Delays execution of a function

c)

Runs a function indefinitely

d)

Stops a function

46.

How do you select an element with the ID "box" in JavaScript?

a)

document.getElementByClass("box")

b)

document.querySelector("#box")

c)

document.query("#box")

d)

document.getElementByTag("box")

47.

How do you prevent the default action of an event?

a)

event.stop()

b)

event.preventDefault()

c)

event.disable()

d)

event.stopPropagation()

48.

Which JavaScript keyword is used to handle errors?

a)

catch

b)

try

c)

throw

d)

try...catch

49.

What will console.log(typeof []) output?

a)

"array"

b)

"object"

c)

"list"

d)

"undefined"

50.

How do you check if a value is NaN in JavaScript?

a)

typeof x === "NaN"

b)

x == NaN

c)

isNaN(x)

d)

x === NaN

51.

Which method is used to join two or more arrays?

a)

merge()

b)

concat()

c)

join()

d)

combine()

52.

How do you create an empty array in JavaScript? 

a)

let arr = new Array();

b)

let arr = [];

c)

[]let arr = {};

d)

let arr = null;

53.

Which method is used to add an element to the end of an array?

a)

append()

b)

add()

c)

insert()

d)

push()

54.

Which property is used to change the background color of an element?

a)

bg-color

b)

color

c)

background-color

d)

background-style

55.

How do you round 4.7 down to the nearest integer in JavaScript?

a)

Math.round(4.7)

b)

Math.ceil(4.7)

c)

Math.cut(4.7)

d)

Math.floor(4.7)

56.

Which method is used to add an element to the end of an array in JavaScript?

a)

insert()

b)

append()

c)

add()

d)

push()

57.

What is the correct way to link a CSS file in an HTML document?

a)

<style src="styles.css">

b)

<link href="styles.css" rel="stylesheet">

c)

<link rel="stylesheet" href="styles.css">

d)

<css href="styles.css">

58.

Which method is used to remove the last element from an array in JavaScript?

a)

pop()

b)

remove()

c)

delete()

d)

shift()

59.

What does the 'display' property in CSS control?

a)

How an element is displayed on the page

b)

The size of an element

c)

The color of an element

d)

The position of an element

60.

What does the 'this' keyword refer to in JavaScript?

a)

The global object

b)

The previous function context

c)

The current function context

d)

None of the above