
JavaScript and HTML Quiz

Quiz
•
Computers
•
12th Grade
•
Medium
Waqqad Rasheed
Used 1+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can you change the source of an image in JavaScript?
document.getElementById("image1").innerHTML = "newImage.jpg";
document.getElementById("image1").src = "newImage.jpg";
document.getElementById("image1").textContent = "newImage.jpg";
document.getElementById("image1").setAttribute("alt", "newImage.jpg");
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which JavaScript property would you use to change the font color of a paragraph?
document.getElementById("p1").style. Font = "red";
document.getElementById("p1").style. color = "red";
document.getElementById("p1").fontColor = "red";
document.getElementById("p1").setTextColor("red");
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the following JavaScript code do?
document.getElementById("p1").style.fontSize = "x-large";
Changes the font size of the paragraph with ID "p1" to extra-large.
Makes the text bold.
Changes the font to Arial.
Centers the text in the paragraph.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a valid variable declaration in JavaScript?
var 1name = "John";
var first-name = "John";
var firstName = "John";
var first name = "John";
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will the following JavaScript code output?
var age = "20"; var newAge = Number(age); alert(newAge);
"20"
NaN
20
undefined
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct way to convert a boolean value to a number in JavaScript?
var num = Boolean(1);
var num = String(true);
var num = Number(true);
var num = Convert.toBoolean(1);
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is NOT a valid data type in JavaScript?
String
Boolean
Character
Number
Create a free account and access millions of resources
Similar Resources on Wayground
9 questions
4.TR - SJiWP - CSS - 04

Quiz
•
12th Grade
9 questions
Unit 5 -- Lists, Loops, Traversals

Quiz
•
9th - 12th Grade
13 questions
BE METER REVIEW #4

Quiz
•
12th Grade
10 questions
Arrays Javascript (CodeCademy)

Quiz
•
9th - 12th Grade
15 questions
Web Design #3

Quiz
•
9th - 12th Grade
10 questions
Operator JavaScript

Quiz
•
9th - 12th Grade
10 questions
Android Studio Basic

Quiz
•
12th Grade
11 questions
JS: Conditionals!

Quiz
•
6th Grade - University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

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

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade