JavaScript and HTML Quiz

JavaScript and HTML Quiz

12th Grade

10 Qs

quiz-placeholder

Similar activities

Code.org List Questions

Code.org List Questions

9th - 12th Grade

10 Qs

BTEC L2 Unit 1 Online World 1-8

BTEC L2 Unit 1 Online World 1-8

11th - 12th Grade

15 Qs

CSS Tags

CSS Tags

12th Grade

10 Qs

CSS Tag

CSS Tag

12th Grade

10 Qs

AP CSP Review on Lists, Loops, and Groups

AP CSP Review on Lists, Loops, and Groups

9th - 12th Grade

9 Qs

Javascript Starter

Javascript Starter

12th Grade

14 Qs

Comandos essenciais JavaScript

Comandos essenciais JavaScript

1st Grade - University

10 Qs

Funkcije u JS

Funkcije u JS

KG - 12th Grade

8 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?