JavaScript Basics

Quiz
•
Computers
•
9th - 12th Grade
•
Hard
Richard Ghiorse
Used 4+ times
FREE Resource
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!";
Similar Resources on Wayground
10 questions
Text formatting tags

Quiz
•
9th Grade
10 questions
HTML introduction

Quiz
•
8th - 9th Grade
10 questions
HTML Introduction

Quiz
•
3rd Grade - Professio...
10 questions
Quiz 1 - Intro to HTML

Quiz
•
12th Grade
10 questions
HTML Coding

Quiz
•
9th - 11th Grade
10 questions
Evaluasi Javascript 5

Quiz
•
10th Grade
10 questions
TLE Q3 M1-5

Quiz
•
10th Grade
10 questions
HTML Language

Quiz
•
KG - 12th Grade
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
10 questions
1.2 OSI & TCP IP Models Quiz

Quiz
•
10th Grade
20 questions
Digital Citizenship

Quiz
•
8th - 12th Grade
30 questions
Introduction to Computers

Quiz
•
8th - 9th Grade
35 questions
Computer Baseline Examination 2025-26

Quiz
•
9th - 12th Grade
13 questions
Problem Solving Process

Quiz
•
9th - 12th Grade
20 questions
Hardware vs. Software Quiz

Quiz
•
7th - 10th Grade
10 questions
Understanding Algorithms with Pseudocode and Flowcharts

Interactive video
•
9th - 12th Grade