What keyword do we use to attach a variable to an instance of an object within the class definition?
a) var
b) attach
c) bind
d) this
Front
d) this
Back
What do you call "colon" ?
a) |
b) ,
c) ;
d) :
Front
d) :
Back
Boolean variables can equal what?
a) yes and no
b) any number
c) any value
d) true or false
Front
d) true or false
Back
What function do we use to load files before sketch() runs?
a) init()
b) load()
c) preload()
d) let()
Front
c) preload()
Back
What do you call "exclamation mark" ?
a) "
b) /
c) !
d) ?
Front
c) !
Back
Which of the following IS NOT a system variable?
a) height
b) width
c) xMouse
d) score
Front
d) score
Back
How would you set the fill color to red?
a) fill(0,255,0);
b) fill(255,0,0)
c) fill(255)
d) fill(0);
Front
b) fill(255,0,0)
Back
If you are writing a custom function, what keyword do you use to return a value?
a) result
b) value
c) return
d) evaluate
Front
c) return
Back
What function do we use to remove an object from an array?
a) splice()
b) pop()
c) remove()
d) push()
Front
a) splice()
Back
class Orb{
constructor(x,y,r=40){
this.x = x;
this.y = y;
this.r = r;
}
}
let myOrb(10,20,30);
In the code above, what is the default value of r?
a) 10
b) 40
c) 30
d) 20
Front
b) 40
Back
To avoid skipping objects, when removing objects from an array, we should:
a) loop through the array forwards
b) don't use a loop
c) loop through the array backwards
d) start looping at index 1
Front
c) loop through the array backwards
Back
What does "fetch" mean in French ?
a) aller
b) aller chercher
c) chercher
d) annuler
Front
b) aller chercher
Back
What do you call "right parenthesis" ?
a) (
b) )
c) "
d) [
Front
b) )
Back
What property will return the size of an array?
a) array.size
b) array.list
c) array.number
d) array.length
Front
d) array.length
Back
What do you call "right brace" ?
a) )
b) ]
c) }
d) /
Front
c) }
Back
What do you call "quotation mark" ?
a) (
b) )
c) "
d) [
Front
c) "
Back
What function returns the number of milliseconds that have passed since the sketch started?
a) milliseconds()
b) millis()
c) millisElapsed()
d) timeElapsed()
Front
b) millis()
Back
What is the keyword used to create a new variable?
a) variable
b) var
c) vrbl
d) v
Front
b) var
Back
What is the symbol for not equal to?
a) *=
b) ||
c) -=
d) !=
Front
d) !=
Back
Given the following array:
var students = ["Amy", "David", "Sue", "Chris", "John"];
What will students[4] return?
a) Chris
b) John
c) Sue
d) Amy
Front
b) John
Back
When you call a function, the values or variables that you pass into the function are called?
a) parameters
b) vars
c) values
d) arguments
Front
d) arguments
Back
What do you call "semicolon" ?
a) |
b) ,
c) ;
d) :
Front
c) ;
Back
What do you call a variable in a function's definition?
a) parameters
b) arguments
c) values
d) vars
Front
a) parameters
Back
What function do you use to set the size of the canvas?
a) createCanvas()
b) canvas()
c) makeCanvas()
d) size()
Front
a) createCanvas()
Back
What do you call "question mark" ?
a) "
b) /
c) !
d) ?
Front
d) ?
Back
Polar coordinates define a point in space in terms of:
a) latitude and longitude
b) x location and y location
c) distance and angle
d) x location, y location, and z location
Front
c) distance and angle
Back
What is the symbol for or?
a) ||
b) *=
c) <
d) !=
Front
a) ||
Back
If I want to call a function repeatedly at some interval, which function should I use?
a) setInterval()
b) millis()
c) setTimeout()
d) setTimer()
Front
a) setInterval()
c) setTimeout()
Back
How does p5.js relate to JavaScript?
a) p5.js doesn't relate to JavaScript at all
b) p5.js is a library of JavaScript
c) p5.js is an applet built with JavaScript
d) JavaScript is a library of p5.js
Front
B) p5.js is a library of JavaScript
Back
What will the following code print to the console?
var phrase = "programming is fun";
console.log(phrase.substring(0, 3));
a) programming
b) rog
c) pro
d) prog
Front
c) pro
Back
What function do we use to load files before sketch() runs?
a) init()
b) load()
c) preload()
d) load()
Front
c) preload()
Back
What do you call "left bracket" ?
a) (
b) )
c) "
d) [
Front
d) [
Back
Give an example of a p5.js function that returns a value.
a) fill()
b) setup()
c) rect()
d) random()
Front
d) random()
Back
What keyword do we use to create a new instance of an object from a class?
a) new
b) var
c) make
d) create
Front
a) new
Back
By default, p5.js uses what measurement for angles?
a) inches
b) degrees
c) pixels
d) radians
Front
d) radians
Back
What is the syntax called used to access the properties and function inside an object?
a) literal syntax
b) constructor syntax
c) dot syntax
d) class syntax
Front
c) dot syntax
Back
If I want to call a function repeatedly at some interval, which function should I use?
a) setInterval()
b) millis()
c) setTimeout()
d) setTimer()
Front
a) setInterval()
Back
What do you call "left parenthesis" ?
a) (
b) )
c) "
d) [
Front
a) (
Back
If you want something to animate, where should you put it in your code?
a) after the draw() function
b) before the setup() function
c) in the setup() function
d) in the draw() function
Front
d) in the draw() function
Back
In p5.js the upper left hand corner of the screen is defined by what x,y coordinates?
a) 100,0
b) 0,100
c) 0,0
d) 100,100
Front
c) 0,0
Back
What is the symbol used to test for equality?
a) -
b) ==
c) =
d) equals
Front
b) ==
Back
What do we call the function we define to create an instance of an object from a class?
a) Maker Function
b) Constructor Function
c) Create Function
d) New Function
Front
b) Constructor Function
Back
What function restores the previous state of all transformations?
a) push()
b) save()
c) restore()
d) pop()
Front
d) pop()
Back
What do you call "backslash" ?
a) \
b) /
c) !
d) ?
Front
a) \
Back
In p5.js/JavaScript, what do we call a list of things?
a) list
b) collection
c) array
d) group
Front
c) array
Back
What does "should" mean in French ?
a) chou
b) sou
c) fou
d) devrais
Front
d) devrais
Back
What do you call "comma" ?
a) |
b) ,
c) ;
d) :
Front
b) ,
Back
What function to we use to add an instance of an object to an array?
a) splice()
b) add()
c) join()
d) push()
Front
d) push()
Back
If I wanted the random function to return a random number between 5 and 10, what would I pass into the function?
a) random(5-10);
b) random(5,10);
c) random(10-5);
d) random(10) - random(5);
Front
b) random(5,10);
Back
By default, the JavaScript functions setInterval() and setTimeout() take what as an argument?
a) milliseconds
b) minutes
c) seconds
d) the frame rate of the sketch
Front
a) milliseconds
Back
Section 2
(37 cards)
How to write an IF statement in JavaScript?
a) if (i == 5)
b) if i == 5 then
c) if i = 5 then
d) if i = 5
Front
a) if (i == 5)
Back
What do you call "slash" ?
a) \
b) /
c) !
d) ?
Front
b) /
Back
What is the correct syntax for referring to an external script called "xxx.js"?
a) <script href="xxx.js">
b) <script name="xxx.js">
c) <script src="xxx.js">
Front
c) <script src="xxx.js">
Back
Is JavaScript case-sensitive?
a) Yes
b) No
Front
a) Yes
Back
What is the correct way to write a JavaScript array?
a) var colors = ["red", "green", "blue"]
b) var colors = 1 = ("red"), 2 = ("green"), 3 = ("blue")
c) var colors = "red", "green", "blue"
d) var colors = (1:"red", 2:"green", 3:"blue")
Front
a) var colors = ["red", "green", "blue"]
Back
How does a FOR loop start?
a) for (i = 0; i <= 5; i++)
b) for (i = 0; i <= 5)
c) for (i <= 5; i++)
d) for i = 1 to 5
Front
a) for (i = 0; i <= 5; i++)
Back
How can you add a comment in a JavaScript?
a) <!--This is a comment-->
b) 'This is a comment
c) //This is a comment
Front
c) //This is a comment
Back
How do you call a function named "myFunction"?
a) myFunction()
b) call function myFunction()
c) call myFunction
Front
a) myFunction()
Back
What will the following code print to the console?
var phrase = "julie,ben,tim,sue,jeff";
var parts = phrase.split(",");
console.log(parts[2]);
a) julie
b) ,
c) tim
d) ben
Front
c) tim
Back
How do you write "Hello World" in an alert box?
a) msg("Hello World");
b) msgBox("Hello World");
c) alert("Hello World");
d) alertBox("Hello World");
Front
c) alert("Hello World");
Back
Whenever we load a local file into our sketch (such as an image, a sound, or a text file) what do we need to do to test our sketch on our computer?
a) use a global variable
b) run a local server
c) use a callback function
d) use JSON
Front
b) run a local server
Back
The loadStrings() function will load a text file as what?
a) an array of strings, split up by each new line in the text file
b) one large string
c) an array of individual words
d) an array of string split up by white space
Front
a) an array of strings, split up by each new line in the text file
Back
What is the correct JavaScript syntax for opening a new window called "w2" ?
a) w2 = window.open("http://www.w3schools.com");
b) w2 = window.new("http://www.w3schools.com");
Front
a) w2 = window.open("http://www.w3schools.com");
Back
How can you detect the client's browser name?
a) browser.name
b) navigator.appName
c) client.navName
Front
b) navigator.appName
Back
The external JavaScript file must contain the <script> tag.
a) True
b) False
Front
b) False
Back
JSON is a:
a) programming language
b) API
c) scripting language
d) data format
Front
d) data format
(JavaScript Object Notation)
Back
What is the command to create a "new line" inside a string?
a) [newline]
b)
c) ew
d) \\
Front
b)
Back
How do you round the number 7.25, to the nearest integer?
a) Math.rnd(7.25)
b) rnd(7.25)
c) round(7.25)
d) Math.round(7.25)
Front
d) Math.round(7.25)
Back
How to write an IF statement for executing some code if "i" is NOT equal to 5?
a) if i =! 5 then
b) if i <> 5
c) if (i != 5)
d) if (i <> 5)
Front
c) if (i != 5)
Back
"API" is an acronym for what?
a) Application Programming Interface
b) Applied Program Interaction
c) Asynchronous Programmable Interface
d) Asynchronous Programming Interaction
Front
a) Application Programming Interface
Back
How to insert a comment that has more than one line?
a) /*This comment has
more than one line*/
b) <!--This comment has
more than one line-->
c) //This comment has
more than one line//
Front
a) /*This comment has
more than one line*/
Back
How do you create a function in JavaScript?
a) function = myFunction()
b) function:myFunction()
c) function myFunction()
Front
c) function myFunction()
Back
What is the correct JavaScript syntax to change the content of the HTML element below?
<p id="demo">This is a demonstration.</p>
a) #demo.innerHTML = "Hello World!";
b)
document.getElementByName("p").innerHTML = "Hello World!";
c) document.getElement("p").innerHTML = "Hello World!";
d) document.getElementById("demo").innerHTML = "Hello World!";
Within an API Query, query parameters are joined together with what character?
a) /
b) +
c) &
d) .
Front
c) &
Back
Inside which HTML element do we put the JavaScript?
a) <scripting>
b) <javascript>
c) <js>
d) <script>
Front
d) <script>
Back
What will the following code return: Boolean(10 > 9)
a) NaN
b) true
c) false
Front
b) true
Back
JavaScript is the same as Java.
a) true
b) false
Front
b) false
Back
In the code below, what is the name of the callback function?
function setup() {
let myData = "data.json";
loadJSON(myData, gotData);
}
a) myData
b) gotData
c) setup
d) data.json
Front
b) gotData
Back
Most API's require what to access their data?
a) API Key
b) your firstborn
c) encrypted password
d) 2 factor authentication
Front
a) API Key
Back
Which event occurs when the user clicks on an HTML element?
a) onmouseclick
b) onchange
c) onclick
d) onmouseover
Front
c) onclick
Back
How do you find the number with the highest value of x and y?
a) ceil(x, y)
b) top(x, y)
c) Math.ceil(x, y)
d) Math.max(x, y)
Front
d) Math.max(x, y)
Back
If I wanted to query an API every 10 seconds, what would be the best function to use?
a) setTimeout()
b) setInterval()
c) preload()
d) draw()
Front
b) setInterval()
Back
Which operator is used to assign a value to a variable?
a) -
b) *
c) x
d) =
Front
d) =
Back
How do you declare a JavaScript variable?
a) v carName;
b) var carName;
c) variable carName;
Front
b) var carName;
Back
How does a WHILE loop start?
a) while (i <= 10; i++)
b) while (i <= 10)
c) while i = 1 to 10
Front
b) while (i <= 10)
Back
Where is the correct place to insert a JavaScript?
a) The <body> section
b) The <head> section
c) Both the <head> section and the <body> section are correct
Front
c) Both the <head> section and the <body> section are correct
Back
CSV stands for:
a) comma separated values
b) comma segmented variables
c) character separated values
d) character standard version