unit 3 CP A
Quiz
•
Professional Development
•
9th - 12th Grade
•
Hard
Termell Middlebrooks
Used 1+ times
FREE Resource
Enhance your content in a minute
25 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
The following program should draw a circle on the screen
1 function start(){
2 var circle = new Circle(40);
3 circle.setPosition(getWidth() / 2, getHeight() / 2);
4 circle.setColor(Color.blue); 5 }
JavaScript
But when we run this code, we don’t see the circle. What is missing from our start function?
We never set the circle’s radius. We need to add the line
circle.setRadius(40);
JavScript
After line 4
We are setting the position of the ball to be off the canvas. We need to change line 3 to be
circle.setPosition(0, 0);
We are creating the circle incorrectly. We need to specify the width and height. We need to change line 2 to be
var circle = new Circle(40, 40);
We create the circle and position it correctly on the screen, but we never add it to the screen. We need to add the line
add(circle);
JavaScript
after line 4
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following program: (Assume the user enters ‘Florence’ then ‘Fernandez’.)
var first_name = readLine("What is your first name? "); var last_name = readLine("What is your last name? "); var whole_name = first_name + last_name; println (whole_name);
Fernandez Florence
Florence Fernandez
FlorenceFernandez
Florence Fernandez
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following choices is a properly formed JavaScript variable name, meaning it is both legal in the JavaScript language and considered good style?
user_age
UserAge
userAge
User age
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
If you wanted to use the following code to draw a circle to the canvas with the radius, and x and y coordinates given by the user, how would you ask for this information?
var circle = new Circle(radius); circle.setPosition(x, y); circle.setColor(color); add(circle);
var x = readLine(“What is the x coordinate? “);var y = readLine(“What is the y coordinate? “);var radius = readLine(“What is the radius of the circle? “);
var x = readInt(“What is the x coordinate? “);var y = readInt(“What is the y coordinate? “);var radius = readInt(“What is the radius of the circle? “);
var x = readLine(“What is the x coordinate? “);var y = readLine(“What is the y coordinate? “);var radius = readInt(“What is the radius of the circle? “);
var x = readInt(“What is the x coordinate? “);var y = readInt(“What is the y coordinate? “);var radius = readLine(“What is the radius of the circle? “);
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
If you were given the following variables:
var distance = 2; var time = 30;
What line of code would print the speed in km/hr if the distance is given in km and the time is given in minutes? (Speed = distance/time)
println(distance/(time/60));
println(distance/time);
println(distance*(time*60));
println(distance*time);
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is printed to the screen when the following program is run?
var num = 13 % 3; println(num);
1
2
3
4
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
var userNum = readInt("Enter your favorite number: "); var calculatedNum = (userNum * userNum) + userNum; println(calculatedNum);
5
25
30
50
Create a free account and access millions of resources
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
0 questions
IDT S23 JS Coding Test Review
Quiz
•
0 questions
Accelerated Principles Mid-Term
Quiz
•
0 questions
javaScript RGB, Input, & Graphics
Quiz
•
0 questions
Unit 4 Javascript Graphics Quiz Review
Quiz
•
0 questions
JS and Graphics Unit Review
Quiz
•
0 questions
JavaScript Test
Quiz
•
0 questions
JavaScript Graphics
Quiz
•
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
•
6th - 10th Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
11 questions
How well do you know your Christmas Characters?
Lesson
•
3rd Grade
14 questions
Christmas Trivia
Quiz
•
5th Grade
20 questions
How the Grinch Stole Christmas
Quiz
•
5th Grade
