Thẻ ghi nhớ: Interactivity with JavaScript - Week 2 Quiz | Quizlet

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/16

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 1:50 PM on 5/21/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

17 Terms

1
New cards

Which tag is used to let the browser know that it is about to see JavaScript code?

2
New cards

Where can you put JavaScript?

A) In the section

B) In the section

C) In an external file

In B) and C) above

In A), B) and C) above

In A), B) and C) above

3
New cards

Which attribute is used to link to an external JavaScript file?

file; e.g., file = "extFile.js"

src; e.g., src = "extFile.js"

href; e.g., href = "extFile.js"

script; e.g., script = "extFile.js"

src; e.g., src = "extFile.js".

4
New cards

Which word is used to define a function in JavaScript?

function

func

define

function

5
New cards

Which of the following best defines the relationship between defining a function and calling a function?

A function can be defined multiple times in a single file

A function can be called multiple times in a single file.

A function can be called multiple times in a single file

6
New cards

A function can be called multiple times in a single file.

True

False

True

7
New cards

You can call a function without it being defined.

True

False

False

8
New cards

One of the events that the JavaScript API will listen for is onload.

True

B: False

True

9
New cards

You can use single quotes or double quotes when calling a function with an event.

True

False

True

10
New cards

Consider the following code:

This is paragraph one

This is paragraph two

The function Hello() will be called every time:

A) The page is loaded

B) The user clicks on any paragraph on the page

C) The user clicks on the second paragraph on the page

A and C

The function is never called.

A) The page is loaded.

11
New cards

Consider the following code:

This is paragraph one

This is paragraph two

The function Hello() will be called every time:

A) The user clicks on any paragraph on the page

B) The user places his/her mouse over any paragraph on the page

C) The user clicks on the second paragraph on the page

A and C

The function is never called.

The user clicks on the second paragraph on the page

12
New cards

What is syntactically wrong with this function definition?

function Hello();{

alert("Hello");

document.write("Hello on the screen");

}

The semicolon after Hello()

The fact that you are outputting the message twice

You can't use document.write after using an alert.

The semicolon after Hello()

13
New cards

Which is the correct syntax to change the contents of the HTML element below?

This is a quiz.

document.querySelector('#quiz').innerHTML = "New content!";

document.querySelectorAll('p').innerHTML = "New content!";

document.querySelectorAll('p').innerHTML("New content!");

document.querySelector('#quiz').innerHTML ("New content!");

document.querySelector('#quiz').innerHTML = "New content!";

14
New cards

The following is valid JavaScript code:

True

False

True

15
New cards

The following is valid JavaScript code:

True

False

True

16
New cards

Which of the following best defines the difference between defining a function and calling a function?

Defining and calling a function are the same thing

You can call a function without it being defined first.

You can define a function without calling it.

You can define a function without calling it.

17
New cards

Which is the correct syntax to change the contents of the HTML element below?

This is a quiz.

document.getElementsByTagName('p').innerHTML = "New content!";

document.getElementsByTagName('p').innerHTML("New content!");

document.getElementById('quiz').innerHTML ("New content!");

document.getElementById('quiz').innerHTML = "New content!";

document.getElementById('quiz').innerHTML = "New content!";