Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

HTML, CSS, and JavaScript Quiz

Total questions: 30

Worksheet time: 16mins

Name
Class
Date
1.

What does HTML stand for?

a)

Hyper Trainer Marking Language

b)

Hyper Text Markup Language

c)

Hyper Tool Multi Language

d)

Hyperlink Text Markup Language

2.

What tag is used to display an image in HTML?

a)

<img>

b)

<image>

c)

<src>

d)

<picture>

3.

Which HTML tag is used to create a hyperlink?

a)

<link>

b)

<href>

c)

<a>

d)

<url>

4.

What does the class attribute do in HTML?

a)

Specifies a unique id for the element

b)

Assigns CSS styles

c)

Creates a table

d)

Adds a comment

5.

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

a)

background-color

b)

color

c)

text-color

d)

font-color

6.

How do you select an element with id="header" in CSS?

a)

#header

b)

.header

c)

*header

d)

header

7.

What does the display: flex; property do in CSS?

a)

Makes the element float

b)

Applies a block layout

c)

Applies a flexible box layout

d)

Applies a grid layout

8.

How do you make a list item appear as a bullet point in CSS?

a)

list-type: disc

b)

list-style-type: bullet

c)

list-style: disc

d)

bullet: show

9.

Which of the following is a correct way to declare a variable in JavaScript?

a)

create x = 5;

b)

var x = 5;

c)

x := 5;

d)

int x = 5;

10.

What will be the result of 5 + "2" in JavaScript?

a)

7

b)

52

c)

undefined

d)

NaN

11.

What keyword is used to declare a constant in JavaScript?

a)

const

b)

constant

c)

var

d)

let

12.

What is the result of 10 % 3 in JavaScript?

a)

3

b)

1

c)

0

d)

10

13.

What does the !== operator mean in JavaScript?

a)

Equal

b)

Strictly equal

c)

Not equal and not same type

d)

Assignment

14.

Which of these values is considered falsy in JavaScript?

a)

"false"

b)

1

c)

undefined

d)

"0"

15.

How do you write an if statement in JavaScript?

a)

if (x > 5) then {}

b)

if x > 5 {}

c)

if (x > 5) {}

d)

if x > 5 then {}

16.

What will true && false evaluate to?

a)

true

b)

false

c)

null

d)

undefined

17.

What is the value of 4 + 5 * 2 in JavaScript?

a)

18

b)

14

c)

13

d)

20

18.

How do you increase a variable x by 1?

a)

x++;

b)

+x;

c)

x =+ 1;

d)

++=x;

19.

What will typeof "Hello" return?

a)

object

b)

string

c)

text

d)

character

20.

What is the result of 10 > 5 && 3 =

a)

true

b)

false

c)

10

d)

20

21.

What does || represent in JavaScript?

a)

Bitwise OR

b)

Logical OR

c)

Logical AND

d)

Not Equal

22.

What is the result of the following expression
true && false || true ?

a)

false

b)

true

c)

undefined

d)

Error

23.

What will this condition evaluate to?
(5 > 3 && 2 < 4) || (3 === "3" && 10 > 20)

a)
True
b)
False
24.

29. What will the result be?
false && (true || true) || (false && true)

a)
True
b)
False
25.

What will this condition evaluate to?
false || false || true

a)
True
b)
False
26.

What does this expression return?

a)
True
b)
False
27.

let isLoggedIn = true;

let hasProfile = false;

if (isLoggedIn && hasProfile) {

console.log("Welcome back!");

} else if (isLoggedIn || hasProfile) {

console.log("Please complete your profile.");

} else {

console.log("Access denied.");

}

a)

Welcome back!

b)

Please complete your profile. (Correct)

c)

Access denied.

d)

Error

28.

let age = 20;

let hasTicket = true;

if (age >= 18 && hasTicket) {

console.log("Entry allowed");

} else if (age >= 18 && !hasTicket) {

console.log("Buy a ticket");

} else {

console.log("Not allowed");

}

a)

Entry allowed

b)

Buy a ticket

c)

Not allowed

d)

undefined

29.

let score = 85;

let passed = score >= 50;

if (passed && score >= 90) {

console.log("Excellent");

} else if (passed && score >= 70) {

console.log("Good job");

} else {

console.log("Try again");

}

a)

Excellent

b)

Try again

c)

Good job

d)

Passed

30.

let user = "admin";

let password = "1234";

if (user === "admin" && password === "1234") {

console.log("Access granted");

} else if (user === "admin" && password !== "1234") {

console.log("Wrong password");

} else {

console.log("Unknown user");

}

a)

Access granted

b)

Wrong password

c)

Unknown user

d)

Error