JavaScript and HTML Quiz

JavaScript and HTML Quiz

12th Grade

10 Qs

quiz-placeholder

Similar activities

JavaScript Quiz | For Beginners

JavaScript Quiz | For Beginners

1st Grade - University

10 Qs

JavaScript-01

JavaScript-01

12th Grade

10 Qs

JavaScript Practices #5

JavaScript Practices #5

12th Grade

12 Qs

FE METER REVIEW 5

FE METER REVIEW 5

12th Grade

15 Qs

Programación Visual

Programación Visual

12th Grade

10 Qs

JavaScript Variables

JavaScript Variables

3rd Grade - University

13 Qs

JavaScript Basics

JavaScript Basics

12th Grade - University

15 Qs

Evaluasi dan Refleksi - 4

Evaluasi dan Refleksi - 4

12th Grade

10 Qs

JavaScript and HTML Quiz

JavaScript and HTML Quiz

Assessment

Quiz

Computers

12th Grade

Medium

Created by

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

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?