Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

100Devs - LwL - Class 09 - JavaScript Intro

Total questions: 31

Worksheet time: 16mins

Name
Class
Date
1.

According to the golden rule: where does the behavior and interaction goes?

a)

In a separate JavaScript file

b)

inline with the html

c)

On the server only

2.

How many IDs can an element have?

a)

One ID per element

b)

As many as necessary

3.

How many classes can an element have?

a)

As many as necessary

b)

One class per element

4.

What does this represent in JS: || ?

a)

OR

b)

AND

c)

BANG

5.

What does this represent in JS: && ?

a)

AND

b)

BANG

c)

OR

6.

What is the DOM?

a)

It is the rendering of the HTML code by the browser

b)

It is the javaScript code in the JS file

c)

It is code that will be changed in the HTML file

7.

What can JavaScript do with the rendered page (DOM) on the browser?

a)

It can alter the way the element are displayed, amongst other things

b)

It can collect data inputs from the user

c)

It can create new html elements on the browser

d)

All are correct

8.

Which element is being selected on this javascript snippet:


document.getElementById("purple")

a)

The element on the DOM/HTML that has the id purple

b)

The element on the DOM/HTML that has the class purple

c)

Any element that is purple

9.

What is an event listenter?

a)

It is a way for javascript to wait for events, such as a click, to happen. And when they do happen, javascript acts

b)

It is a way for HTML to wait for events, such as a click, to happen. And when they do happen, javascript acts

10.

What are variables?

a)

Variables tell the program to remember a value to be used later on.

b)

Variables is a number that can be changed, like "x" in math

11.

What is one way to declare a variable?

a)

let nameOfTheVariable. let age, let height

b)

just type the nameOfTheVariable. age = 25, height = "1.98m"

12.

How to assign a value to a variable?

a)

age = 25, height = 1.98. But first the variable must be declared.

b)

let age, let height

13.

What is a number or a string or an array?

a)

They are data types

b)

They are variables

14.

What is a string?

a)

It is a piece of text, that are always surrounded by "quotes"

b)

It is a long piece of text, like a <p>

c)

It is a short piece of text, like a <span>

15.

What are integers?

a)

It is a number type of data that has a value is a whole number: 25

b)

It is a number type of data that has a value is a decimal number: 3.14

16.

In JavaScript what are floats?

a)

It is a number that has decimal places: 3.14

b)

It is a number that has no decimals: 25

c)

It is a string: "float"

17.

What are basic arithmetic operations doable in JS?

a)

+ - * / %

b)

+ - * /

c)

addition, subtraction, division and multiplication

18.

What will this operation return? 5 * 2

a)

10

b)

2.5

c)

1

19.

What will this operation return? 5 / 2

a)

2.5

b)

10

c)

1

20.

What will this operation return? 5 % 2

a)

1

b)

10

c)

2.5

d)

52

21.

Which of these is an event listener?

a)

Both are correct

b)

document.querySelector('#pumpkin').addEventListener('click', makeZero)

c)

document.getElementById('purple').onclick = partyPurple

22.

What will this comparison return: 9 === 9

a)

TRUE

b)

FALSE

23.

What will this comparison return: 7 === 3

a)

FALSE

b)

TRUE

24.

What will this comparison return: "hello" === "hello"

a)

TRUE

b)

FALSE

25.

What will this comparison return: 3 == 8

a)

FALSE

b)

TRUE

26.

What will this comparison return: 3 == 3

a)

TRUE

b)

FALSE

27.

What will this comparison return: 3 === "3"

a)

FALSE

b)

TRUE

28.

What will this comparison return: 3 == "3"

a)

TRUE

b)

FALSE

29.

const age = 17

if (age >= 18){

console.log("you can get in")

} else if (age > 16) {

console.log("you're not quite ready")

}else {

console.log("You're too young")

}

What will this code return?

a)

"you're not quite ready"

b)

"you can get in"

c)

"You're too young"

30.

const fishSpecies = "clownfish"

const inhabitat = "anemone"


if (fishSpecies === "clownfish" && inhabitat === "anemone"){

console.log("welcome home, nemo")

} else{

console.log("only clownfish is allowed in the anemone")

}

What will this return?

a)

"only clownfish is allowed in the anemone"

b)

"welcome home, nemo"

31.

if (name === "Leon" &&

hair ==="gorgeous")

{ //run code } What must be true so the code runs?

a)

name must be Leon and hair must be gorgeous

b)

Either name must be Leon or hair must be gorgeous