WorksheetsHTML, CSS, and JavaScript Quiz
Total questions: 30
Worksheet time: 16mins
What does HTML stand for?
Hyper Trainer Marking Language
Hyper Text Markup Language
Hyper Tool Multi Language
Hyperlink Text Markup Language
What tag is used to display an image in HTML?
<img>
<image>
<src>
<picture>
Which HTML tag is used to create a hyperlink?
<link>
<href>
<a>
<url>
What does the class attribute do in HTML?
Specifies a unique id for the element
Assigns CSS styles
Creates a table
Adds a comment
Which CSS property is used to change the text color of an element?
background-color
color
text-color
font-color
How do you select an element with id="header" in CSS?
#header
.header
*header
header
What does the display: flex; property do in CSS?
Makes the element float
Applies a block layout
Applies a flexible box layout
Applies a grid layout
How do you make a list item appear as a bullet point in CSS?
list-type: disc
list-style-type: bullet
list-style: disc
bullet: show
Which of the following is a correct way to declare a variable in JavaScript?
create x = 5;
var x = 5;
x := 5;
int x = 5;
What will be the result of 5 + "2" in JavaScript?
7
52
undefined
NaN
What keyword is used to declare a constant in JavaScript?
const
constant
var
let
What is the result of 10 % 3 in JavaScript?
3
1
0
10
What does the !== operator mean in JavaScript?
Equal
Strictly equal
Not equal and not same type
Assignment
Which of these values is considered falsy in JavaScript?
"false"
1
undefined
"0"
How do you write an if statement in JavaScript?
if (x > 5) then {}
if x > 5 {}
if (x > 5) {}
if x > 5 then {}
What will true && false evaluate to?
true
false
null
undefined
What is the value of 4 + 5 * 2 in JavaScript?
18
14
13
20
How do you increase a variable x by 1?
x++;
+x;
x =+ 1;
++=x;
What will typeof "Hello" return?
object
string
text
character
What is the result of 10 > 5 && 3 =
true
false
10
20
What does || represent in JavaScript?
Bitwise OR
Logical OR
Logical AND
Not Equal
What is the result of the following expression
true && false || true ?
false
true
undefined
Error
What will this condition evaluate to?
(5 > 3 && 2 < 4) || (3 === "3" && 10 > 20)
29. What will the result be?
false && (true || true) || (false && true)
What will this condition evaluate to?
false || false || true
What does this expression return?
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.");
}
Welcome back!
Please complete your profile. (Correct)
Access denied.
Error
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");
}
Entry allowed
Buy a ticket
Not allowed
undefined
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");
}
Excellent
Try again
Good job
Passed
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");
}
Access granted
Wrong password
Unknown user
Error
