Reading Code

Reading Code

3rd - 12th Grade

20 Qs

quiz-placeholder

Similar activities

Grade 9 Checkpoint 1 Revision

Grade 9 Checkpoint 1 Revision

9th Grade

15 Qs

AQA GCSE Computer Science Paper 1

AQA GCSE Computer Science Paper 1

9th - 11th Grade

20 Qs

GCSE Computing: Lists and Arrays

GCSE Computing: Lists and Arrays

10th - 11th Grade

15 Qs

Makecode Intro.

Makecode Intro.

5th - 7th Grade

15 Qs

Javascript

Javascript

10th - 12th Grade

15 Qs

Code.org CSD Unit 3 Lessons 1-12

Code.org CSD Unit 3 Lessons 1-12

3rd - 12th Grade

20 Qs

GCSE J277 - 2.2.3 - Arrays

GCSE J277 - 2.2.3 - Arrays

7th Grade

20 Qs

Java 2D Arrays_Review

Java 2D Arrays_Review

11th Grade

19 Qs

Reading Code

Reading Code

Assessment

Quiz

Computers

3rd - 12th Grade

Hard

Created by

Brenda McLachlin

Used 6+ times

FREE Resource

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does this line of code do?


dist(mouseX, mouseY, 200, 200);

Checks how far the mouse is from the center of the screen

Checks if the mouse is clicking on a round button

Creates a circle with a diameter of 200 on the screen at position mouseX, mouseY

Changes the size of the canvas to 200, 200

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does this line of code do?


fill(random(255), random(255), random(255), 50);

Sets the colour of a shape to a random shade of grey

Sets the colour of a shape to a random transparent colour

Sets the colour of a line to white

Sets the colour of a line to a random transparent colour

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does this line of code do?


for (var i = 0; i < nums.length; i++) {

Repeats for every number that exists

Loops through all the items in the array nums

Counts from zero to the size of the canvas

Nothing - there's an error

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does this line of code do?


speed *= -1;

Changes the sign of the variable "speed"

Changes the variable speed to its logical opposite

Decreases the framerate by 1

Decreases the speed of an animation by 1

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does this line of code do?


var x = i % 2 === 0;

Stores the remainder of i / 2 in the variable x

Makes x true if i is even and false if i is odd

Calculates half of i and stores it in the variable x

Assigns x the value 2 and i the value 0

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does this line of code do?


rect(200, 200, 100, mouseX);

Makes a rectangle that changes width based on the mouse

Makes a rectangle that changes height based on the mouse

Makes a rectangle that follows the mouse

Makes a rectangle that you can only see when the mouse hovers over it

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does this line of code do?


Obj.draw = function() {

Reassigns the method "draw" of object "Obj" to be a new method

Creates a function that runs 60 times per second

Creates a new object prototype

Changes the way the reserved function "draw" works

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?