wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Javascript

Total questions: 105

Worksheet time: 1hrs 1mins

Name
Class
Date
1.
To display writing on the screen you must include this direction;
a)
Document Write
b)
documentWrite
c)
document.write( )
d)
document.write
2.
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
3.
A boolean;
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
4.
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
5.
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
6.
What surrounds an if/else statement?
a)
Quotations
b)
Curly Brackets
c)
Parenthesis
d)
Square Brackets
7.
An array is;
a)
Shapes
b)
Sizes
c)
Options
d)
Lists of data
8.
What surrounds an array?
a)
Quotations
b)
Curly Brackets
c)
Parenthesis
d)
Square Brackets
9.
What surrounds a string?
a)
Quotations
b)
Curly Brackets
c)
Parenthesis
d)
Square Brackets
10.
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
11.
Which command colors the background of your canvas?
a)
background 
b)
endShape
c)
var = color
d)
fill
12.
What command removes the outlines from shapes?
a)
noOutline ();
b)
noColor();
c)
noBorder();
d)
noStroke ();
13.
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);
14.
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);
15.
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);
16.
What is at the end of a line of code?
a)
#
b)
;
c)
)
d)
>
17.
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
18.
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
19.
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
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.
In a programming language, __________ are used to store data values.
a)
tags
b)
codes
c)
files
d)
variables
22.
JavaScript uses the _______ keyword to define variables.
a)
vrb
b)
var
c)
vari
d)
va
23.

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

a)

Parameter

b)

Function

c)

Variable

24.

The "stroke" command means

a)

color inside shape

b)

color outside shape

c)

color of blocks

d)

border

25.

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

26.

Javascript is _________ language.

a)

Programming

b)

Scripting

c)

Application

d)

applet

27.

JavaScript is ______ Side Scripting Language.

a)

JSP

b)

Servlet

c)

Server

d)

Browser

28.

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

29.

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

30.

JavaScript is an ________ language.

a)

compiled

b)

interpreted

31.

JavaScript Code is written inside file having extension __________.

a)

.jsc

b)

.jvs

c)

.js

d)

.javascript

32.

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

33.

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

a)

HTML

b)

CSS

c)

js

d)

java

34.

JavaScript Code can be called by using _________.

a)

RMI

b)

Function / Method

c)

Triggering Event

d)

Preprocessor

35.

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

<script type="text/javascript">

...

</script>

a)

Yes

b)

No

36.

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

a)

True

b)

False.

37.

The simplest data-storing structure in any programming language

a)

Lists

b)

Array

c)

Queue

d)

List

38.

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#

39.

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


example: myFunction(x, y)

a)

Parameter

b)

Literals

c)

Constraints

d)

Variables

40.

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

41.

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

a)

Variables

b)

Loops

c)

Conditional Statement

d)

Stacks

42.

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

43.

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

a)

A

b)

z

c)

_

d)

%

44.

A property that contains a function definition.

a)

Object Properties

b)

Object Attributes

c)

Object Methods

d)

Objects

45.

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()

46.

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

a)

==

b)

!

c)

=

d)

+

47.

Which of the Tag Pair is used to enable JS script writing in HTML?

a)

<br>

b)

<script>

c)

<JS>

d)

<code>

48.

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

a)

\*

b)

\'

c)

\n

d)

\br

49.

in JS, Arrays are considered as what type of programming concept?

a)

Class

b)

Variable

c)

Object

d)

Function

50.

What is the symbol used for the INCREMENT operator in JS?

a)

+

b)

++

c)

=

d)

==

51.

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

a)

if

b)

var

c)

new

d)

this

52.

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

53.

Which of the following is NOT a valid keyword for JS

a)

new

b)

switch

c)

synchronize

d)

void

54.

Conditions return values of which data type?

a)

Integer

b)

boolean

c)

floating-point

d)

string

55.

file extension for external JS files

a)

.javascript

b)

.js

c)

.jscript

d)

.script

56.

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

a)

Arithmetic

b)

Math Object

c)

Operation Object

d)

Mathematics Object

57.

used to write comments

a)

++

b)

=

c)

//

d)

--

58.

Which type of array declaration allows for greater simplicity?

a)

Dynamic array

b)

Array Literals

c)

Standar Array Syntax

d)

Specified array declaration

59.

symbol pair used to code backspace within string value

a)

\b

b)

\bspace

c)

\backspace

d)

\n

60.

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

61.

HOW MANY CSS PROPERTIES CAN BE SET AND MODIFIED USING JS?

a)

1

b)

HALF OF THE TOTAL NUMBER OF PROPERTIES

c)

NONE

d)

ALL PROPERTIES

62.
The conditional statement, in Javascript, begins with the word _______.
a)
Then
b)
Else
c)
If
d)
OK
63.
What syntax follows after an if statement?
a)
parenthesis
b)
curly braces
c)
a colon
d)
square brackets
64.
Which of the following is the correct way to declare a variable?
a)
variable myName
b)
var myName
c)
MY_NAME
d)
VAR myName
65.
Which one of the following is NOT a logical operator?
a)
||
b)
&&
c)
$$
d)
!
66.
Arithmetic Operator
What is a * ?
a)
Addition
b)
Subtraction
c)
Multiplication
d)
Modulo
67.
Arithmetic Operators
What is a / ? 
a)
Addition
b)
Subtraction
c)
Division
d)
Modulo
68.
Arithmetic Operators
What is -- ?
a)
Division
b)
Modulo
c)
Increment
d)
Decrement
69.
Comparision Operators
What is === ? 
a)
Equal to
b)
Equal value and equal type
c)
Not equal
d)
Not equal value or not equal type
70.
Comparison Operators
What is != ?
a)
Equal to
b)
Equal value and equal type
c)
Not equal
d)
Not equal value or not equal type
71.
Comparision Operators
What is ! == ?
a)
Equal to 
b)
Equal value and equal type
c)
Not equal
d)
Not equal value or not equal type
72.
Comparison Operators
What is >= ?
a)
Greater than
b)
Less than
c)
Greater than or equal to
d)
Less than or equal to
73.
Comparison Operator
What is <= ?
a)
Greater than
b)
Less than
c)
Greater than or equal to
d)
Less than or equal to 
74.
Logical Operators
What is && ? 
a)
And
b)
Or
c)
Not
d)
Less than
75.
Logical Operators
What is ! ?
a)
And
b)
Or
c)
Not
d)
Less than
76.
Comparision Operators
What is == ? 
a)
Equal to 
b)
Equal value and equal type
c)
Not equal
d)
Not equal value or not equal type
77.
Arithmetic Operators - 
What is + ?
a)
Addition
b)
Subtraction
c)
Multiplication
d)
Division
78.
Arithmetic Operator
What is a - ?
a)
Addition
b)
Subtraction
c)
Multiplication
Multiplication
d)
Modulo
79.
Arithmetic Operators
What is ++ ?
a)
Modulo
b)
increment
c)
Decrement
d)
Addition
80.

What symbol represents the and operator in JavaScript?

a)

AND

b)

and

c)

&

d)

&&

81.

What symbol represents the or operator in JavaScript?

a)

OR

b)

or

c)

||

d)

|

82.
Which 1 of the following symbols is used for JavaScript comments?
a)
\\
b)
^
c)
?
d)
//
83.
Indicates the beginning  and the end of a JavaScript section.
a)
<html> </html>
b)
<style> </style>
c)
<article> </article>
d)
<script> </script>
84.
Which attribute(s) of the FORM and INPUT tags become the properties of the created object?
a)
value
b)
value and name
c)
name
d)
name and type
85.
How do I declare a new variable?
a)
var newVariable = 5;
b)
Variable int = new Variable();
c)
var 5 = myVariable;
d)
int var = 5;
86.
A JavaScript file has an extension name of
a)
.jscp
b)
.js
c)
.css
d)
.Jp
87.
What type of variable is
var typeOfApples="Fuji";
a)
Int
b)
Float
c)
Boolean
d)
String
88.

What is the correct syntax for referring to an external JavaScript script?

a)

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

b)

<script href="myscript.js"></script>

c)

<js href="myscript.js"></js>

d)

<js src="myscript.js"></js>

89.

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

a)

onclick="doSomething;"

b)

on-click="doSomething;"

c)

onclick="doSomething();"

d)

onclick=doSomething();

90.

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

a)

alert

b)

prompt

c)

console.log

d)

<p> tag

91.
Which message will the user see?
a)
"Hello user"
b)
No message
c)
"Goodbye user"
d)
"message + user"
92.
Which keyword do we need to define a function?
a)
function
b)
method
c)
onclick
d)
functionName()
93.
What is CSS used for?
a)
styling web pages
b)
formatting script correctly
c)
client side scripting
d)
server side scripting
94.
How do we generate a random number?
a)
Math.random()
b)
random.number()
c)
number.random()
d)
Random.math()
95.

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

a)

Google Chrome

b)

Firefox

c)

Microsoft Edge

d)

Safari

96.
How do I change the size of an image?
a)
width / height
b)
scale
c)
size
d)
shrink
97.

What is formatting in HTML?

a)

The HTML contains six types of headings which are defined with the <h1> to <h6> tags.

b)

a process of format the text for a better look and feel

c)

There are some HTML tags that don't need a closing tag.

d)

Content is placed between tags to display data on the web page.

98.

What is a style sheet?

a)

A style sheet is used to build a consistent, transportable, and well-designed style template.

b)

To create a multicolor text on a web page

c)

It is used to define a container for navigation links

d)

It is used to define content aside from the content

99.

Which of the following is not an application of javascript

a)

Client-side validation

b)

Dynamic drop-down menus

c)

Transport data in a network

d)

Displaying clocks

100.

Which of the following is not a feature of javascript?

a)

Lightweight

b)

Good for the applications which are network-centric

c)

Object oriented

d)

Open source

e)

Complementary to HTML

101.

Is JavaScript case sensitive language?

a)

Yes

b)

No

c)

Depends on the browser

d)

Depends on the platform

102.

Identify non-primitive datatype from the following?

a)

String

b)

Array

c)

number

d)

boolean

103.

What is the output of the following script?


function display() { document.writeln(10+20+"30"); } display();

a)

60

b)

30"30"

c)

3030

d)

102030

104.

Which of the following is not a feature of GET method in HTML?

a)

Parameters remain in browser history because they are part of the URL

b)

Can be bookmarked.

c)

More difficult to hack

d)

Easier to hack for script kiddies

e)

GET is less secure compared to POST because data sent is part of the URL. So it's saved in browser history and server logs in plaintext.

105.

Which of the following is not a feature of POST method in HTML?

a)

Can send parameters, including uploading files, to the server.

b)

Binary data is also allowed.

c)

POST is a little safer than GET because the parameters are not stored in browser history or in web server logs.

d)

POST method should not be used when sending passwords or other sensitive information.

e)

POST method variables are not displayed in the URL.