wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Javascript

Total questions: 71

Worksheet time: 39mins

Name
Class
Date
1.

Which of these is a loop?

a)

if(x<10)

b)

while(x<10)

c)

var x=10;

d)

text(x,10;10)

2.

Which command provides a random color?

a)

Randomizer.color

b)

Randomizer.nextColor()

c)

RandColor;

d)

nextColor.Randomizer()

3.

Which of these will increase the value of the variable X?

a)

increment (x)

b)

x++;

c)

x=x;

d)

x+1;

4.

Which of the following will decrease the value of x?

a)

x--;

b)

x-1;

c)

x=x;

d)

x=-x;

5.

Greater than or equal to

a)

> or =

b)

> || =

c)

>=

d)

<=

6.

His name is Fred and he is less than 16 years old

a)

if (name = "fred" && age < 16 )

b)

if (name === "fred" && age < 16 )

c)

if (name = "fred" || age < 16 )

d)

if (name === "fred" || age < 16 )

7.

Repeat something 10 times

a)

repeat 10

b)

for (var i=0; i<10; i++)

c)

repeat { } until 10;

d)

while (i = 10)

8.

When we are done with a line what do we put at the end?

a)

a colon :

b)

a semi-colon ;

c)

a period .

d)

a quotation mark "

9.

When we surround a word with quotes "David" it's called ?

a)

a program

b)

a loop

c)

a string

d)

a command

10.

A short form writing the word variable is

a)

rav

b)

VAR

c)

var

d)

varia

11.
A string;
a)
Expresses a true false statement
b)
can contain letters, numbers, spaces, and symbols.
c)
takes in an input, does something with it, and then returns an output.
d)
Runs a boolean (true/false) statement based on data entered
12.
What surrounds a string?
a)
Quotations
b)
Curly Brackets
c)
Parenthesis
d)
Square Brackets
13.
To display writing on the screen you must include this direction;
a)
Document Write
b)
documentWrite
c)
document.write( )
d)
document.write
14.
A variable;
a)
Expresses a true false statement
b)
stores a string, number, or boolean, and gives it a specific, case-sensitive name
c)
takes in an input, does something with it, and then returns an output.
d)
Runs a boolean (true/false) statement based on data entered
15.
A function;
a)
Expresses a true false statement
b)
can contain letters, numbers, spaces, and symbols.
c)
takes in an input, does something with it, and then returns an output.
d)
Runs a boolean (true/false) statement based on data entered
16.
An if/else statement;
a)
Expresses a true false statement
b)
can contain letters, numbers, spaces, and symbols.
c)
takes in an input, does something with it, and then returns an output.
d)
Runs a boolean (true/false) statement based on data entered
17.
What surrounds an if/else statement?
a)
Quotations
b)
Curly Brackets
c)
Parenthesis
d)
Square Brackets
18.
An array is;
a)
Shapes
b)
Sizes
c)
Options
d)
Lists of data
19.
What surrounds an array?
a)
Quotations
b)
Curly Brackets
c)
Parenthesis
d)
Square Brackets
20.
What command draws a rectangle?
a)
rec (10, 20, 100, 200);
b)
rect (10, 20, 100, 200)
c)
rect (10, 20, 100, 200);
d)
ellipse (10, 20, 40, 40)
21.
Which command colors the background of your canvas?
a)
background 
b)
endShape
c)
var = color
d)
fill
22.
What command removes the outlines from shapes?
a)
noOutline ();
b)
noColor();
c)
noBorder();
d)
noStroke ();
23.
What command draws a perfect circle?
a)
ellipse (80, 60, 100, 105);
b)
ellipse(80, 60, 100, 100);
c)
circle (80, 60, 80, 60):
d)
ellipse (80, 60, 105, 100);
24.
What command colors a shape?
a)
color (43, 255, 0);
b)
bucket (43, 255, 0);
c)
fill (43, 255, 0);
d)
bucket (43, 255, 0);
25.
What command draws a line?
a)
stroke (200, 220, 275, 220);
b)
line (200, 220, 275, 220);
c)
horizontal (200, 220,  60, 75);
d)
pencil (200, 220, 275, 220);
26.
What is at the end of a line of code?
a)
#
b)
;
c)
)
d)
>
27.

The "stroke" command means

a)

color inside shape

b)

color outside shape

c)

color of blocks

d)

border

28.

What does the "fill" command do

a)

put letters in the shape

b)

put pictures in the shape

c)

put color in the shape

d)

put code in the shape

29.
Any code that is within the following draw function:
draw = function(){
......
}
a)
Will be performed twice
b)
Will not be performed
c)
Will be performed once
d)
Will be repeated over and over again
30.
The following code will:
x++;
a)
Add 1 to the previous value of x
b)
Add 1 to the previous value of y
c)
Subtract 1 from the previous value of x
d)
Give an error message
31.
A variable is used to:
a)
Store a value in memory
b)
Draw a circle
c)
Store a value that does not change
d)
Draw a rectangle
32.
In a programming language, __________ are used to store data values.
a)
tags
b)
codes
c)
files
d)
variables
33.
JavaScript uses the _______ keyword to define variables.
a)
vrb
b)
var
c)
vari
d)
va
34.

This saves a value, which can be then assigned when writing code

a)

Parameter

b)

Function

c)

Variable

35.

Javascript is _________ language.

a)

Programming

b)

Scripting

c)

Application

d)

applet

36.

JavaScript is ______ Side Scripting Language.

a)

JSP

b)

Servlet

c)

Server

d)

Browser

37.

JavaScript is designed for following purpose -

a)

To Style HTML Pages

b)

To Perform Server Side Scripting Opertion

c)

To add interactivity to HTML Pages.

d)

To Execute Query Related to DB on Server

38.

JavaScript is can be written -

a)

directly into JS file and included into HTML

b)

directly into HTML pages

c)

directly on the Server Script

d)

None of these

39.

JavaScript is an ________ language.

a)

compiled

b)

interpreted

40.

JavaScript Code is written inside file having extension __________.

a)

.jsc

b)

.jvs

c)

.js

d)

.javascript

41.

Why JavaScript is called as Lightweight Programming Language ?

a)

because JS can provide programming functionality inside but up to certain extend.

b)

because JS is client side scripting

c)

because JS is available free of cost.

d)

because we can add programming functionality inside JS

42.

Local Browser used for validations on the Web Pages uses __________.

a)

HTML

b)

CSS

c)

js

d)

java

43.

JavaScript Code can be called by using _________.

a)

RMI

b)

Function / Method

c)

Triggering Event

d)

Preprocessor

44.

Is this correct syntax to include JS Code inside HTML Page ?

<script type="text/javascript">

...

</script>

a)

Yes

b)

No

45.

We cannot Place JS Code in the body tag . Say true/false.

a)

True

b)

False.

46.

It can be an assignment operation, a function call, or a control structure

a)

Comments

b)

Case Sensitivity

c)

Data Types

d)

Statements

47.

These are used to put information that can be useful later, and in JavaScript these are ignored by the browser.

a)

Comments

b)

Case Sensitivity

c)

Data Types

d)

Statements

48.

These are used to put information that can be useful later, and in JavaScript these are ignored by the browser.

a)

Comments

b)

Case Sensitivity

c)

Data Types

d)

Statements

49.

Names that refer to commands, functions, variables and keyword should be written correctly, variable “A” and “a” are two different variables.

a)

Comments

b)

Case Sensitivity

c)

Data Types

d)

Statements

50.

It can be Numeric, String, Boolean or Null.

a)

Comments

b)

Case Sensitivity

c)

Data Types

d)

Statements

51.

A type of network that is limited to a school or a similar location.

a)

LAN

b)

MAN

c)

WAN

d)

CAN

52.

Who is the first computer programmer?

a)

Bill Gates

b)

Mark Zuckerberg

c)

Lady Ada Agusta

d)

Charles Babbage

53.

Inside which HTML element do we put the JavaScript?

a)

<js>

b)

<script>

c)

<scripting>

d)

<javascript>

54.

The external JavaScript file must contain the <script> tag

a)

true

b)

false

55.

A programming language used for webpage functionality such as interactivity, data processing, animation, and development of purpose built apps such as mobile and desktop apps and more.

a)

HTML5

b)

CSS

c)

JS

d)

C#

56.

The simplest data-storing structure in any programming language

a)

Lists

b)

Array

c)

Queue

d)

List

57.

These are any variable names listed within a function's argument definition.


example: myFunction(x, y)

a)

Parameter

b)

Literals

c)

Constraints

d)

Variables

58.

Which of the following is NOT a valid starting character for JS variable names?

a)

Uppercase Letter

b)

Lowercase Letter

c)

Dollar Sign

d)

Underscore

59.

This allows JS Scripts and applications to perform different actions based on given conditions.

a)

Variables

b)

Loops

c)

Conditional Statement

d)

Stacks

60.

Which of the following is NOT a valid component of a function declaration?

a)

Function keyword

b)

Function name

c)

Pair of Square Braces

d)

Pair of Curly Braces

61.

Which of the following is a symbol that must NOT be present in any JS Variable?

a)

A

b)

z

c)

_

d)

%

62.

Method used to select the element with a given identifier represented by the HTML element property ID

a)

getElementByClassName() method

b)

getElementById() method

c)

getId()

d)

getElementByTagName()

63.

Which of the following operator is used for the Assignment Operator?

a)

==

b)

!

c)

=

d)

+

64.

What is the symbol pair used to write a new line within a string values?

a)

\*

b)

\'

c)

\n

d)

\br

65.

Using object constructors what specific keyword is used to create new object?

a)

if

b)

var

c)

new

d)

this

66.

Which funtion is used when a JS application must ensure that the user gets the information that is displayed?

a)

Alert box

b)

Prompt Box

c)

Combo Box

d)

Confirm Box

67.

Which of the following is NOT a valid keyword for JS

a)

new

b)

switch

c)

synchronize

d)

void

68.

file extension for external JS files

a)

.javascript

b)

.js

c)

.jscript

d)

.script

69.

built in object in JS that allows a script to perform mathematical task

a)

Arithmetic

b)

Math Object

c)

Operation Object

d)

Mathematics Object

70.

used to write comments

a)

++

b)

=

c)

//

d)

--

71.

Since JS functions allow reusability of code, how many times do written codes need too be DEFINED?

a)

TWICE

b)

THRICE

c)

AS MANY AS POSSIBLE

d)

ONCE