Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

js basics

Total questions: 18

Worksheet time: 9mins

Name
Class
Date
1.

Which one of the following symbols is used for JavaScript comments?

a)

//

b)

\\

c)

*/ */

d)

<!-- -->

2.

What type of variable is var typeOfApples="Fuji"

a)

numeric

b)

boolen

c)

string

3.

How do I declare a new variable?

a)

var newVariable = 5

b)

Variable int = new Variable()

c)

var 5 = myVariable

d)

int var = 5

4.

What surrounds an if/else statement?

a)

Quotations " "

b)

Curly Brackets { }

c)

Parenthesis ( )

d)

Square Brackets []

5.

What surrounds a string or words?

a)

Quotations " "

b)

Curly Brackets { }

c)

Parenthesis ( )

d)

Square Brackets []

6.

Why do we use if/else statements in JavaScript?

a)

To repeat something for a fixed number of times

b)

To either do something if a condition is true or do something else

c)

To break out of some block of code

d)

To repeat something while a condition is true

7.

Indicates the beginning and the end of a JavaScript section.

a)

<html> </html>

b)

<style> </style>

c)

<article> </article>

d)

<script> </script>

8.

A JavaScript file has an extension name of

a)

jscp

b)

.js

c)

.css

d)

.Jp

9.

Which keyword do we need to define a function?

a)

function

b)

method

c)

onclick

d)

functionName()

10.

How can a developer show a pop-up message to the user?

a)

alert

b)

prompt

c)

console.log

d)

<p> tag

11.

What attribute/value do we use to make a button execute JavaScript when clicked?

a)

onclick="doSomething;"

b)

onclick="doSomething();"

c)

on-click="doSomething;"

d)

onclick=doSomething();

12.

What is CSS used for?

a)

styling web pages

b)

formatting script correctly

c)

client side scripting

d)

server side scripting

13.

Which of the following platform(s) can be used to run Javascript Code

a)

Google Chrome

b)

Firefox

c)

Microsoft Edge

d)

all of these

e)

Safari

14.

How do I change the size of an image?

a)

width / height

b)

scale

c)

size

d)

shrink

15.

What is the difference between an HTML Tag and an HTML element?

a)

An HTML Tag is case sensitive and an HTML element is not case sensitive.

b)

An HTML Tag is always paired and an HTML element is an "empty" tag.

c)

An HTML Tag defines content and an HTML Element includes the opening and closing tags and everything in between.

d)

An HTML Tag defines content and an HTML Element gives additional meaning and content.

16.

Karen wants to begin a new line within a paragraph of text on a webpage. Which code should she use?

a)

<li>

b)

<hr>

c)

<h1>

d)

<br>

17.

Ali wants to insert a line break into his webpage. Which code should he use?

a)

<ul>

b)

<br>

c)

<li>

d)

<h1>

18.

What is the proper code to insert an image named "frog.jpg"?

a)

<img src="frog" width="104" height="142">

b)

<img src="frog.jpg" width="104" height="142">

c)

<img="frog.jpg" width="104" height="142">

d)

height="142">

<img ="frog" width="104" height"142">