wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Quiz No. 1 - Functions in JavaScript

Total questions: 25

Worksheet time: 14mins

Name
Class
Date
1.

JavaScript had many names before it became JavaScript, which of the following is NOT part of those names?

a)

LiveScript

b)

Ecma Script

c)

JScript

d)

Java

2.

Which of the following is an example of Declaration?

a)

var studentID;

b)

var studentID = 2015205;

c)

var studentID = 2015205;

console.log("Student ID: " + studentID);

d)

var studentID = 2015205;

alert("Student ID: " + studentID);

3.

Which of the following is an example of Initialization?

a)

var studentID;

b)

var studentID = 2015205;

c)

var studentID = 2015205;

console.log("Student ID: " + studentID);

d)

var studentID = 2015205;

alert("Student ID: " + studentID);

4.

Which of the following is an example of Passing?

(You may select more than one answer)

a)

var studentID;

b)

var studentID = 2015205;

c)

var studentID = 2015205;

console.log("Student ID: " + studentID);

d)

var studentID = 2015205;

alert("Student ID: " + studentID);

5.

Variables can be as short as one character, or they can be as long as you want—think thousands and thousands of characters.

a)

True

b)

False

6.

Variables can start with a letter, underscore, or the $ character. They can also start with a number.

a)

True

b)

False

7.

Outside of the first character, our variables can be made up of any combination of letters, underscores, numbers, and $ characters. We can also mix and match lowercase and uppercase to our heart’s content.

a)

True

b)

False

8.

Values store data, and variables act as an easy way to refer to that data.

a)

True

b)

False

9.

What are Fixed Variables called?

a)

Literals

b)

Variables

10.

Numbers are written with or without decimals

a)

Number Literal

b)

String Literal

c)

Boolean Literal

11.

Strings are text, written within double or single quotes

a)

Number Literal

b)

String Literal

c)

Boolean Literal

12.

Can be true or false

a)

Number Literal

b)

String Literal

c)

Boolean Literal

13.

In JavaScript, it means an empty value and is also a primitive type in JavaScript

a)

Null

b)

Undefined

14.

In JavaScript, it means the variable has been declared, but its value has not been assigned

a)

Null

b)

Undefined

15.

Which is NOT a valid way to declare a variable?

a)

var

b)

let

c)

const

d)

use

16.

is a combination of values, variables, and operators, which computes to a value

a)

expression

b)

computation

c)

combination

d)

calculation

17.

Which of the following is a valid way to comment in JavaScript?

(You may choose more than one answer)

a)

//

b)

/* */

c)

#

d)

"

18.

A browser parses a file from top to bottom.

a)

True

b)

False

19.

The script element can only be added in the body section

a)

True

b)

False

20.

HTML contains CONTENT and JavaScript contains BEHAVIOR

a)

True

b)

False

21.

How do we add the .js file into our .html file?

a)

<script src = "index.js"> </script>

b)

<body src = "index.js"> </body>

c)

<head src = "index.js"> </head>

d)

<html src = "index.js"> </html>

22.

Given the following code:

const square = function (number) {

return number * number; };

const x = square(4);

Which is considered as the function call?

a)

square(4)

b)

return number * number

c)

function (number { .... }

d)

const x and const square

23.

Given the following code:

const square = function (number) {

return number * number; };

const x = square(4);

Which is considered as the function declaration?

a)

square(4)

b)

return number * number

c)

function (number { return number * number; }

d)

const x and const square

24.

Given the following code:

alert("my argument");

The argument is the stuff between your opening and closing parentheses when calling the alert function.

a)

True

b)

False

25.

If a function happens to take arguments and you don't provide any arguments as part of your function call, provide too few arguments, or provide too many arguments, things can still work.

a)

True

b)

False