JavaScript Basics

JavaScript Basics

9th - 12th Grade

5 Qs

quiz-placeholder

Similar activities

HTML Formatting Tags

HTML Formatting Tags

9th - 12th Grade

10 Qs

Programação Front End - Níveis de Tolerância

Programação Front End - Níveis de Tolerância

11th Grade

10 Qs

JavaScript-01

JavaScript-01

12th Grade

10 Qs

Advance JAVASCRIPT STUDY GUIDE

Advance JAVASCRIPT STUDY GUIDE

11th - 12th Grade

10 Qs

Artificial Intelligence Quiz Online

Artificial Intelligence Quiz Online

8th Grade - University

10 Qs

JavaScript Cert Prep

JavaScript Cert Prep

9th - 12th Grade

10 Qs

Java Script

Java Script

10th - 12th Grade

10 Qs

gr11-website design

gr11-website design

11th Grade

10 Qs

JavaScript Basics

JavaScript Basics

Assessment

Quiz

Computers

9th - 12th Grade

Hard

Created by

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!";