JS Snippet Quiz

JS Snippet Quiz

9th - 12th Grade

8 Qs

quiz-placeholder

Similar activities

Pensamento Computacional 9º prova 2

Pensamento Computacional 9º prova 2

9th Grade

8 Qs

Javascript DOM

Javascript DOM

9th Grade

11 Qs

Introducción a JavaScript - A1

Introducción a JavaScript - A1

10th Grade

10 Qs

React - JSX e componenti

React - JSX e componenti

9th Grade

10 Qs

Advanced JS Part 1

Advanced JS Part 1

12th Grade

10 Qs

Manipulación del DOM En Java Script

Manipulación del DOM En Java Script

11th Grade

10 Qs

Technical Terms - Internet (A-Z) - DOM

Technical Terms - Internet (A-Z) - DOM

12th Grade

10 Qs

Quiz 14 - Swing Components

Quiz 14 - Swing Components

11th Grade

10 Qs

JS Snippet Quiz

JS Snippet Quiz

Assessment

Quiz

Computers

9th - 12th Grade

Easy

Created by

Hamzah Alnofli

Used 1+ times

FREE Resource

8 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is JavaScript used for?

Styling web pages

Making web pages interactive

Creating web page layouts

Defining web page structure

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you add JavaScript to an HTML file?

<script>

<js>

<javascript>

<code>

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which keyword is used to declare changing variables in JavaScript?

variable

int

var

char

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the innerHTML property do in JavaScript?

Changes the content of an element

Changes the style of an element

Removes an element from the DOM

Adds a new element to the DOM

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you select an element by its ID in JavaScript?

document.getElementByClassName()

document.getElementByName()

document.getElementById()

document.querySelector()

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which method is used to add an event listener in JavaScript?

addEventListener()

attachEvent()

onEvent()

addListenEvent()

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does event.preventDefault() do?

Stops the event from bubbling up the DOM tree

Prevents the default behavior of the event

Removes the event listener from the element

Stops the propagation of the event to other elements

8.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What would be the output in this code segment?

const x = 5;

x = 4;

console.log(x);

error

const

4

5