Interactivity with JavaScript Quiz

Interactivity with JavaScript Quiz Answer. In this post you will get Quiz Answer & Assignment Of Interactivity with JavaScript

 

Interactivity with JavaScript Quiz

Offered By ”University of Michigan”

Enroll Now

Week One

1.
Question 1
Every valid web page can be represented as a tree. This tree is referred to as the

1 point

  • API
  • DOM
  • JavaScript

=================================================

 

2.
Question 2
JavaScript uses what kind of interface to access the DOM structure?

1 point

  • HTML5
  • an API
  • CSS3

=================================================

 

3.
Question 3
Which of these is not valid? (Hint, pay attention to if the method should return one thing, or many things…)

1 point

  • document.getElementsByClassName(className)
  • document.getElementsById(idName)
  • document.getElementsByTagName(tagName)

=================================================

 

4.
Question 4
Which of the following is not a valid method for generating output to the screen?

1 point

  • document.write
  • print
  • prompt
  • alert

=================================================

 

5.
Question 5
Which of these options does NOT require the use of parentheses?

1 point

  • alert
  • document.write
  • innerHTML
  • prompt
  • console.log

=================================================

 

6.
Question 6
Which of the following does not generate output directly to the screen?

1 point

  • element.innerHTML = message;
  • console.log(message);
  • document.write(message);

=================================================

 

7.
Question 7
How does prompt differ from alert?

1 point

  • The alert will return a value, prompt does not.
  • The prompt will return a value, alert does not.
  • Only prompt uses parentheses.
  • Only alert uses parentheses.

=================================================

 

8.
Question 8
Variables allow you to save data.

1 point

  • True
  • False

=================================================

 

9.
Question 9
In JavaScript the keyword ___________ is used to declare a variable.

1 point
Enter answer here

var

=================================================

 

10.
Question 10
What does it mean that variables are case-sensitive?

1 point

  • That all variables must use lowercase letters
  • That all variables must use uppercase letters
  • That the computer does not think that the variables name and Name are the same thing.

=================================================

 

11.
Question 11
Which of the following is not a valid variable name?

1 point

  • oneVariable
  • 1variable
  • variable1
  • variableOne

=================================================

 

12.
Question 12
Which of the following is not a valid variable name?

1 point

  • variable_2
  • variable$2
  • variable-2

=================================================

 

13.
Question 13
What does mnemonic mean?

1 point

  • That variable names should start with lowercase letters and use uppercase letters if the variable has multiple parts, e.g. firstName.
  • That variable names should help describe the value being stored.
  • That variable names should be as short as possible, preferably with no more than two or three characters.

=================================================

 

14.
Question 14
What is wrong with this code?

12
var name = “Mike”;
“Colleen” = name;
1 point

  • It is illegal to change the value stored in a variable.
  • This code is illegal and it doesn’t make sense to have a non-variable (also called a constant) in the left-hand side (LHS) of an assignment statement.
  • The variable declaration is illegal.

=================================================

 

15.
Question 15
What value is stored in name if the person hits the Cancel button on a prompt?

1
var name = prompt(“What is your name?”);
1 point
Enter answer here

null

 

16.
Question 16
What value is stored in name if the person hits the Okay button on a prompt before entering anything?

1
var name = prompt(“What is your name?”);
1 point

  • an empty string (“”)
  • undefined
  • exception

=================================================

 

17.
Question 17
To create a String variable, use quotes around the value you want to save.

1 point

  • True
  • False

=================================================

 

18.
Question 18
Boolean variables store either true or false.

1 point

  • True
  • False

=================================================

 

19.
Question 19
When a function returns a node from the DOM, it is of type

1 point

  • Boolean
  • Object
  • Number
  • String

=================================================

 

20.
Question 20
A function that wants to return multiple values at once (such as document.getElementsByTagName) will return a/an

1 point

  • Array
  • String
  • Number

=================================================

 

21.
Question 21
Which of the following is not a valid operator?

1 point

  • =+
  • ++
  • +=
  • ==

=================================================

 

22.
Question 22
What value is returned by 9 % 5?

1 point
Enter answer here

4

=================================================

 

 

23.
Question 23
What is the difference between == and === ?

1 point

  • The === operator only checks for equivalent values, not equivalent type too.
  • The == operator only checks for equivalent values, not equivalent type too.
  • The == operator is the assignment operator, while === is the equality operator.

=================================================

 

24.
Question 24
What is the logical operator for AND?

1 point
Enter answer here

&&

=================================================

 

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

1 point

  • <script>
  • <head>
  • <javascript>

=================================================

 

26.
Question 26
JavaScript code must be placed in the <head> section of the document.

1 point

  • True
  • False

 

 

Week- 2

Peer-graded Assignment: JavaScript Interactive Photo Gallery

Download

[Attention]: To get any assignment File you must need to click here to subscribe to YouTube and after that fill up this google form]

Week- 3

JavaScript Review

 

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

1
<p id = “quiz”>This is a quiz. </p>

1 point

document.getElementById(‘quiz’).innerHTML(“New content!”);

document.getElementsByTagName(‘p’).innerHTML(“New content!”);

document.getElementsByTagName(‘p’).innerHTML = “New content!”;

document.getElementById(‘quiz’).innerHTML = “New content!”;

=================================================

 

2.
Question 2
Where can you put JavaScript?

1 point

In the head and body section

Just in the <head> section

Just in the <body> section

=================================================

3.
Question 3
Built-in JavaScript functions (alert, prompt, etc) cannot be mixed in with other HTML code unless you use the <script> tag.

1 point

True

False

=================================================

 

4.
Question 4
Which of the following is the proper way to link to an external JavaScript file?

1 point

<script file = “file.js”></script>

<script>”file.js”</script>

<script src = “file.js”></script>

<script href=“file.js”></script>

<script = “file.js”></script>

=================================================

 

5.
Question 5
Which word is used to define a function in JavaScript?

1 point

function

script

func

define

=================================================

 

6.
Question 6
If a function is defined twice, the first declaration will be called when used.

1 point

True

False

=================================================

 

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

1 point

True

False

=================================================

 

8.
Question 8
You can define a function without calling it.

1 point

True

False

=================================================

 

9.
Question 9
You can call a function without it being defined.

1 point

True

False

=================================================

 

10.
Question 10
Conditional statements change the flow of execution in a program — the “next” line of code in the program is not always the next one that is executed.

1 point

True

False

=================================================

 

11.
Question 11
What is true about this code?

12345
<a href = “http://www.umich.edu” onclick = “return true”>University of Michigan</a><br/>

<a href = “#” onclick = “alert(this.href)”>University of Michigan </a><br/>

<a href = “page2.html” onclick = “alert(this.href)”>University of Michigan </a><br/>
1 point

Only the first link will take you to the University of Michigan website .

Only the second link will take you to the University of Michigan website.

Only the third link will take you to the University of Michigan website.

None of the links will take you to the University of Michigan website.

=================================================

 

12.
Question 12
What is true about this code?

12345
<a href = “http://www.umich.edu” onclick = “alert(this.href)”>University of Michigan</a><br/>

<a href = “#” onclick = “alert(this.href)”>University of Michigan </a><br/>

<a href = “page2.html” onclick = “alert(this.href)”>University of Michigan </a><br/>
1 point

Only the first link will produce the alert “http://www.umich.edu/“.

Only the second link will produce the alert “http://www.umich.edu/“.

Only the third link will produce the alert “http://www.umich.edu/“.

None of the links will produce the alert “http://www.umich.edu/“.

=================================================

 

13.
Question 13
Assume you have a page with four paragraph tags, one of which has the id “second”. What is the proper JavaScript code to change the content of that paragraph to “What does the Fox say?”

Note:

The quotes shouldn’t be part of the value.

Please end the line of code with a semicolon.

Note, you can’t assume that this is the second paragraph.

1 point
Enter answer here

document.getElementById(‘second’).innerHTML = “What does the Fox say?”.

=================================================

 

 

14.
Question 14
Assume you have a page with four paragraph tags. What is the proper JavaScript code to change the content of the second paragraph to “What does the Fox say?”

1 point

document.getElementById(‘second’).innerHTML = “What does the Fox say?”

document.getElementByTagName(‘p’)[2].innerHTML = “What does the Fox say?”

document.getElementsByTagName(‘p’)[1].innerHTML = “What does the Fox say?”

document.getElementById(‘p’)[2].innerHTML = “What does the Fox say?”

document.getElementsByTagName(‘p’).innerHTML = “What does the Fox say?”

=================================================

 

15.
Question 15
How do you properly access the third element in an array variable named “fruit”?

1 point

[fruit]3

fruit[3]

fruit_3

None of the above

 

 

Week- 4

Peer-graded Assignment: Autocomplete with JavaScript

Download

[Attention]: To get any assignment File you must need to click here to subscribe to YouTube and after that fill up this google form]

Other Questions Of This Category