
JavaScript and CSS Basics Quiz
Authored by R Eveleigh
Computers
9th Grade
Used 3+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is the correct way to define a function in JavaScript?
function = myFunction() {}
function myFunction() {}
def myFunction() {}
function: myFunction() {}
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the `getElementById` method do in JavaScript?
It selects all elements with a specific class name.
It selects the first element with a specific tag name.
It selects the element with a specific id.
It creates a new element with a given id.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can you change the content of an HTML element with the id "demo" to "Hello, World!" using JavaScript?
document.getElementById("demo").innerHTML = "Hello, World!";
document.getElementById("demo").value = "Hello, World!";
document.getElementById("demo").text = "Hello, World!";
document.getElementById("demo").content = "Hello, World!";
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which symbol is used to select a class in CSS?
#
.
$
@
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How would you select an element with the id "main" in CSS?
.main
#main
main
*main
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct way to add a click event handler to a button with the id "myBtn" in JavaScript?
document.getElementById("myBtn").onclick = myFunction;
document.getElementById("myBtn").onClick(myFunction);
document.getElementById("myBtn").addEvent("click", myFunction);
document.getElementById("myBtn").click = myFunction();
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is the correct syntax to select all elements with the class "highlight" in CSS?
#highlight
.highlight
highlight
*highlight
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
15 questions
Microbit (python)
Quiz
•
8th - 10th Grade
10 questions
IGCSE Computer Science - Input Devices
Quiz
•
9th - 11th Grade
12 questions
Python
Quiz
•
7th - 9th Grade
10 questions
QBASIC Programming
Quiz
•
5th - 10th Grade
8 questions
Gathering Evidence
Quiz
•
9th - 12th Grade
10 questions
Motherboard
Quiz
•
9th Grade
10 questions
Active and Passive Voice Exercise (EPS)
Quiz
•
9th - 10th Grade
10 questions
DBMS Quiz 3
Quiz
•
1st - 10th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade