
JavaScript Basics
Authored by Richard Ghiorse
Computers
9th - 12th Grade
Used 4+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
5 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following will change the entire body of the HTML on a webpage to the text "Hacked by JavaScript"
document.innerHTML = "Hacked by JavaScript";
document.body = "Hacked by JavaScript";
document.body.innerHTML = "Hacked by JavaScript";
body = "Hacked by JavaScript";
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following JavaScript commands will change the HTML associated with any id "title" to the text "ECS is Fun".
document.title.innerHTML = "ECS is Fun";
document.getElementById("title").innerHTML = "ECS is Fun";
document.getElementById(title).innerHTML = ECS is Fun;
document.getElementById("title") = "ECS is Fun";
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following correctly uses a JavaScript variable that is initialized to 42?
var num = 42;
num = 42;
var 42;
var 42 = num;
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following stores all the HTML elements with the tag h2 into a variable called headings?
var headings = document.getElementsByTagName("h2");
var headings = getElementsByTagName("h2");
var headings = document.getElementsByTagName(h2);
headings = document.getElementsByTag(h2);
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Suppose we have the following JavaScript variable to retrieve all the paragraphs on a webpage:
var paragraphs = document.getElementsByTagName("p");
Which of the following changes the text of the second paragraph to "The second paragraph has been hacked!"
paragraphs[2] = "The second paragraph has been hacked!";
paragraphs[1] = "The second paragraph has been hacked!";
paragraphs[2].innerHTML = "The second paragraph has been hacked!";
paragraphs[1].innerHTML = "The second paragraph has been hacked!";
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
10 questions
Internet Technologies
Quiz
•
12th Grade
10 questions
Programacion Orientada a Objetos
Quiz
•
12th Grade - University
10 questions
PF Unit 10
Quiz
•
9th Grade - University
9 questions
Test Excel
Quiz
•
10th - 12th Grade
10 questions
Activity 1: How well do you know Java?
Quiz
•
9th Grade
10 questions
Elementos de diseño web
Quiz
•
12th Grade
10 questions
kur2-Mblok
Quiz
•
9th - 10th Grade
10 questions
Evaluación Final UNDECIMO 11
Quiz
•
11th 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