Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Basic java script questions

Total questions: 36

Worksheet time: 1hrs 12mins

Name
Class
Date
1.
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)
2.
Which command colors the background of your canvas?
a)
background 
b)
endShape
c)
var = color
d)
fill
3.
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);
4.
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);
5.
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);
6.
What is at the end of a line of code?
a)
#
b)
;
c)
)
d)
>
7.
The command: ellipse( 200,100, 20, 20) will draw:
a)
an ellipse that is 100 pixels wide and 100 pixels high
b)
a circle whose center is 200 pixels across and 100 pixels down
c)
a rectangle that is 200 pixels by 100 pixels wide
d)
a circle that is 200 pixels in diameter
8.
ellipse(212, 206, 283, 318);
ellipse(212, 235, 100, 73);
ellipse(150, 150, 30, 30);
ellipse(278, 150, 30, 30);
The code above represents a snowman with two eyes and a nose. The code that represents the nose is:
a)
ellipse(150, 150, 30, 30);
b)
ellipse(212, 206, 283, 318);
c)
ellipse(212, 235, 100, 73);
d)
ellipse(212, 235, 100, 73);
9.
After running the following code, what will be the value of x?
y = 3;
x = 5 * y;
a)
3
b)
5
c)
15
d)
0
10.
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
11.
The output of the following code will be:
fill(0, 13, 255);
textSize(38);
text("Sophia", 99, 96);
a)
Sophia in colour blue
b)
"Sophia" in white
c)
The number 38
d)
A rectangle
12.
A string is used for storing:
a)
Numbers
b)
Integers
c)
Images
d)
Text
13.
The command: ellipse( 200,100, 20, 20) will draw:
a)
an ellipse that is 100 pixels wide and 100 pixels high
b)
a circle whose center is 200 pixels across and 100 pixels down
c)
a rectangle that is 200 pixels by 100 pixels wide
d)
a circle that is 200 pixels in diameter
14.

What is the correct order of parameters in rect()?

a)

rect(x, y, width, height);

b)

rect(y, x, width, height);

c)

rect(x, y, height, width);

d)

rect(width, height, x, y);

15.

How do you turn off the outline around the shapes?

a)

noStroke();

b)

stroke("transparent");

c)

noFill();

d)

noOutline();

16.
The command: ellipse( 200,100, 20, 20) will draw:
a)
an ellipse that is 100 pixels wide and 100 pixels high
b)
a circle whose center is 200 pixels across and 100 pixels down
c)
a rectangle that is 200 pixels by 100 pixels wide
d)
a circle that is 200 pixels in diameter
17.
What does var stand for?
a)
Variant
b)
Variable
c)
Varies
18.
Variable store values.
a)
True
b)
False
19.

Color is defined by these three colors

a)

Red, purple, orange

b)

Red, Green, Blue

c)

Green, Blue, Orange

20.

To draw an oval with its centre at the origin, width 100, height 150, filled with RED colour, which one is correct?

a)

fill (255, 0, 0); ellipse(0, 0, 100, 150);

b)

fill (0, 0, 0); ellipse (0, 0, 150, 100);

c)

fill (255, 255, 255); ellipse (100, 150, 0, 0);

d)

ellipse (0, 0, 100, 150);

21.

The following variable declaration declares a:

var value = 12;

a)

number

b)

whole number

c)

string

d)

decimal value

22.

What is programming?

a)

Installing program into Computer

b)

Group of Functions

c)

The process of writing computer programs.

23.

What is JavaScript

a)

A programming language

b)

A game

c)

Computer Software

24.

The Java Script command that used to draw a circle is:

a)

Circle

b)

Rect

c)

ellipse

25.

1. When drawing in Javascript, the coordinates for the top left of the screen is:

a)

0,400

b)

400,0

c)

0,0

26.

The command: background( 0,0,0); will draw

a)

A white background

b)

A background with text

c)

A background with an image

d)

A black background

27.

What feature allows you to change the value of coordinates quicker than changing it manually ?

a)

scrubbing

b)

drubbing

c)

number scrubbing

d)

letter scrubbing

28.

When choosing the color for a shape which feature can help you to select color quickly?

a)

Color ticker

b)

Color picker

c)

Color design

d)

Remember the number for the color you wish to use

29.

In which order instructions are executed in java script?

a)

Any order

b)

In the sequence they appear

c)

It doesn't matter

30.

Look at the code below and image and identify which fill() function that has been used to colour the ground color?

background(69, 181, 175);

fill(13, 255, 0);

rect(0, 300, 400, 100);

fill(247, 255, 0);

// The sun

ellipse(80, 64, 100, 100);


fill(234, 247, 247);

ellipse(200, 300, 150, 150);

ellipse(200, 200, 100, 100);

ellipse(200, 120, 75, 75);

a)

fill(13,255,0)

b)

fill(247,255,0)

c)

fill(234,247,247)

31.

Look at the code below and image and identify which fill() function that has been used to colour the sun?

background(69, 181, 175);

fill(13, 255, 0);

rect(0, 300, 400, 100);

fill(247, 255, 0);

ellipse(80, 64, 100, 100);

fill(234, 247, 247);

ellipse(200, 300, 150, 150);

ellipse(200, 200, 100, 100);

ellipse(200, 120, 75, 75);

a)

fill(13,255,0)

b)

fill(247,255,0)

c)

fill(234,247,247)

32.

Look at the code below and image and identify which fill() function that has been used to colour the snowman?

background(69, 181, 175);

fill(13, 255, 0);

rect(0, 300, 400, 100);

fill(247, 255, 0);

ellipse(80, 64, 100, 100);

fill(234, 247, 247);

ellipse(200, 300, 150, 150);

ellipse(200, 200, 100, 100);

ellipse(200, 120, 75, 75);

a)

fill(13,255,0)

b)

fill(247,255,0)

c)

fill(234,247,247)

33.

How does documentation helps you while programming?

a)

If you are stuck you can look into documentation which would show the functions in categories and their parameters and description of what these functions do?

b)

You don't have to memorize the functions

c)

It doesn't help at all.

34.

What function helps you to thicken the edges of the shape?

a)

Fill()

b)

rect()

c)

Strokeweight()

d)

stroke()

35.

Which function colour the edges of the shape?

a)

Fill()

b)

rect()

c)

Strokeweight()

d)

stroke()

36.

in the fill function what does r,g,b stands for? fill(r,g,b)

a)

red,green,blue

b)

red,go,blue

c)

red,green,black

d)

rose,george,bash