WorksheetsIntro to JS quiz
Total questions: 26
Worksheet time: 13mins
In the Khan Academy programming environment for Javascript, the bottom left of the drawing window has the coordinates:
(0,0)
(400,0)
(0,400)
(400,400)
The JavaScript function for drawing an ellipse is:
elli
circle
rect
ellipse
The following variable declaration declares a:
var value = 12;
number
whole number
string
decimal value
The following code will :
num +=1
Take 1 away from num
Add 1 to the value of num
Add 2 to the value of num
Take 2 from the value of num
The following code will:
num -= 4
Take 4 from the value of num
Take 1 from the value of num
Add 4 to the value of num
Add 1 to the value of num
Draw = function() {
rect(1,1,4,4);
};
Continuously repeat the drawing of a square
Continuously repeat the drawing of a circle
Draw a rectangle once
draw a rectangle 4 times
What will the following code do?
var x = 0;
draw = function(){
background(1,1,1);
rect(x+=1, 50, 50,50);
};
Draw a rectangle once
Animate a square across the screen (left to right)
Animate a square across the screen (right to left)
Animate a square across the screen (diagonally)
The noStroke() function disables the outline when drawing shapes:
True
False
The following command will:
ellipse(mouseX, mouseY, 30, 30);
draw an ellipse
draw a circle
draw a circle that follows that movement of the mouse
draw a circle 30 pixels by 30 pixels
Each command line in JavaScript should generally end with a :
Capital letter
Semicolon
Full stop
Comma
The following code will:
textSize(30);
text("Sophia", 41, 30);
textSize(30);
text("Sophia", 41, 30); text
Display the name "Sophia" on the screen with the size 30
Display the name "Sophia" on the screen with the size 41
Draw a rectangle
What is the word in the command to create a circle?
oval
circle
ellipse
sphere
What is the word in the command to create a square?
square
rect
quadrilateral
trap
What ends a line of command?
colon
parentheses
curly brace
semi-colon
These surround the text to display in a text command.
quotation marks
parentheses
chevrons
curly braces
This command sets the color for the entire screen.
fill
color
background
paint
To color a specific shape the fill command should go where?
in the shape command
right after the shape command
near the shape command
before the shape command
How many values (numbers) are needed for the triangle command?
3
12
4
6
What repeatedly calls a function during execution?
draw function
repeat function
program restart
reboot
Which two arguments represent the current position of the cursor?
cursorX & cursorY
mouseX & mouseY
pointerX & pointerY
crosshairX & crosshairY
The following is the correct command for a line:
line(x, y, x1, y1)
line(w, x, y, z)
line(a, b, c, d)
line(x1, y1, x2, y2)
Which is the correct way to write a comment in JavaScript?
(#...#)
(!...!)
{{.....}}
//....
RGB stands for what?
REAL GOOD BASICS
RED GREEN BLUE
REFERENCE GOOD BACKGROUNDS
RECTANGLE GOING BLUE
If I want to add a variable for my eyes, which would be the correct line of code.
var eyeSize;
variable = eyeSize!
variable (eyeSize)
var = eyeSize
The "X" parameter
Moves the object left and right
moves the object up and down
changes the width
changes the height
The "Y" parameter
moves the object left and right
moves the object up and down
makes the object wider or thinner
makes the object taller or shorter
