The result of running this code:
println(12/3)
What is 4?
2 kinds of loops
what are for and while
var p = image.getPixel(27, 50);
What is get the pixel color values from location x=27 and y=50 and assign them as an array to variable p?
nums[5] = nums[5] + 5
What is add the number 5 to the contents of the 5th element of array nums?
The data type for this value: 128
What is integer?
The result of running this code:
println("a" + "b")
what is "ab"
A loop that executes code a specific number of times
What is a for loop?
image.setRed(45, 90, 0)
What is set the pixel at x=45, y = 90 to have no red.
if nums[x] <5
nums[x] = nums[x] + 8;
}
What is: add 8 to the element of of array nums at index 8, IF that element is already less than 5.
The term to describe a and b, the variables, in the following statement:
function magic(a, b){
What are parameters or arguments?
println(2**8)
what is 256?
What will this print?
var w = 5;
while (w<10){
println(w*5);
}
What is an infinite loop that prints 25 over and over again.
function mystery(image, x, y){
var p = image.getPixel(x, y);
p[[1] = p[1] + 25;
image.setGreen(x, y, p[1]);
}
What is brighten the Green component of the pixel at (x, y) by 25?
var n = [18, 22, 5, 9];
n.push(22);
println(n);
What is [18, 22, 5, 9, 22]
The data type for this value: 13.75
What is float?
The result of running this instruction:
println(1%17);
What is 1?
What will this print?
var w = 5;
while (w<10){
println(w*5);
w = w + 1;
}
What is print:
25
30
35
40
45
var p = image.getPixel(27, 200);
p[1] = p[1] + 25;
image.setGreen(27,200,p[1]);
What is brighten the intensity of green in the pixel at x=27 and y=200 in image?
for (var x = 0; x < values.length;x++){
values[x] = values[x] + 5;
}
Add 5 to each element in the array values[]
for (var j = 0; j<8;j++){
println(2**j);
}
What is print the binary place values?
The result of running this code:
println(16%4)
What is 0?
for (var x = 0; x < image.getWidth(); x++){
for (var y = 0; y < image.getHeight(); y++){
// some code
}
}
What is the code to cycle through all the pixels in an image?
The data type for this value:
TRUE
What is boolean?