APCS Final Exam Review

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

What is the proper operator for "not equals" in JavaScript?

!=

What hexadecimal number best describes the dog on Blue's Clues

#0000ff

What is printed by the following program? function printNumbers(two, one, zero){ println(two); println(one); println(zero); } function start(){ var zero = 0; var one = 1; var two = 2; printNumbers(zero, one, two); }

0 1 2

What is the range of values (expressed in decimal) that each color channel can have?

0 to 255

Consider the following numbers: The decimal value 10(10) The binary value 1001(2) Hexadecimal value C(16) Which of the following lists the number in order from least to greatest?

10012, 1010, C16

What is the binary equivalent of 29 base 10

11101

What is the decimal value of 1101 base 2?

13

What is the value of E base 16 in decimal

14

What is the output of the following program? function start(){ var x = 5; sumTo(x); println(x); } function sumTo(num){ var sum = 0; for(var i = 0; i <= num; i++){ sum += i; } println(sum); }

15 5

How many different symbols can be used for one digit in the Hexadecimal number system?

16

In the following code, what will be the last number to print to the screen before the program finishes? for (var i = 0; i < 10; i++) { if (i % 2 == 0) { println(i); } else { println(2 * i); } }

18

What is the number base of the binary number system?

2

The following code creates a circle in JavaScript. What is the radius of the circle? function start(){ var circle = new Circle(30); circle.setPosition(100, 50); circle.setColor(Color.blue); }

30

How many possible values can be created with 2 bits

4

How many times will the following code print "hello"? for (var i = 0; i < 8; i += 2) { println("hello"); }

4

In the binary value 1002, what is the place value of the 1?

4"s place

How many times will the following code print "hello"? for (var i = 3; i < 8; i++) { println("hello"); }

5

What is printed by the following program? function product(x, y){ return x * y; } function difference(x, y){ return x - y; } function start(){ var x = 2; var y = 5; var value1 = product(x, y); var value2 = difference(y, x); var result = difference(value1, value2); println(result); }

7

how many different values can be represented using 3 bits

8

How many bits are used to encode a character according to the ASCII encoding scheme?

8 bits

What is the proper way to compare if two values are equal in a boolean expression in JavaScript?

==

What is a pixel?

A single tiny dot, or square, of color in a digital image.

Which number system is used to store information digitally in a computer?

Binary (base 2)

What statement can we use inside of a loop to end it?

Break

A student is transferring photos from her camera to her computer. The student notices that the saved photos on her computer are lower quality than the original raw photo on her camera. Which type of compression was used?

Lossy Compression

Which of the following instructions would brighten a pixel? Assume R is the red value of the pixel, G is the green value, and B is the blue value.

R = Math.min(R + 50, 255); G = Math.min(G + 50, 255); B = Math.min(B + 50, 255);

What are the 3 color channels that make up a pixel according to the RGB color scheme?

Red, Green, Blue

var RED = 0; var GREEN = 1; var BLUE = 2; function filter(pixel) { pixel[RED] = 255 - pixel[RED]; pixel[GREEN] = 255 - pixel[GREEN]; pixel[BLUE] = 255 - pixel[BLUE]; return pixel; } Which of the following best describes the result of applying this filter to every pixel in the image?

The image will be inverted, bright pixels will become dark and dark pixels will become bright.

What is data abstraction?

The process of simplifying complicated data into manageable chunks

In the following code, we create a circle and add it to the screen. What is the meaning of the x variable? var x = 20; var circle = new Circle(x); add(circle);

The radius of the circle

var size = 20; var x = 100; var y = 200; var ball = new Circle(size); ball.setPosition(x, y); What is the meaning of the x variable?

The x coordinate of the center of the circle

How many times will this program print "hello"? var i = 5; while (i < 100) { println("hello"); }

This code will loop infinitely

After the following code runs, what is the value of isWeekend? var isSaturday = true; var isSunday = false; var isWeekend = isSaturday || isSunday;

True

function start(){ var circle = new Circle(40); circle.setPosition(getWidth() / 2, getHeight() / 2); circle.setColor(Color.blue); } But when we run this code, we don't see the circle. What is missing from our start function?

We need to add the line add(circle); after line 4

which color is represented by the hexadecimal of #ffffff

White

Example of encoding information

all of the above

Why do we use constant variables?

all of the above

In a graphics canvas, what are the coordinates of the bottom right corner of the window?

getWidth(), getHeight()

What function do you need to call to get the width of the screen?

getWidth();

What kind of statement allows us to run one block of code if one condition is true, and a separate block of code otherwise?

if/else statement

In the following code: var MAX_NUMBER = 10; function sum(x, y){ var result = x + y; //Point A return result; } function start(){ var num1 = Randomizer.nextInt(0, MAX_NUMBER); var num2 = Randomizer.nextInt(0, MAX_NUMBER); println( sum(num1, num2) ); } Which variables exist at point A? In other words, which variables are in scope at point A? Which variables could you type at point A and the program would still work?

result, x, y, and MAX_NUMBER

In the following function printThreeTimes: function printThreeTimes(word){ println(word); println(word); println(word); } What is the parameter of the function?

word


Ensembles d'études connexes

PROTOCOLS: TRAUMA RESUSCITATION, PROTOCOLS: Trauma, PROTOCOLS: additional Trauma

View Set

History 1700 possible questions final exam 2

View Set

CH 12. CNS Depressants and Muscle Relaxants

View Set

Real Estate Law & Regs - Section 5

View Set