WorksheetsIntro to CS - Midterm Review
Total questions: 59
Worksheet time: 42mins
The inputs and outputs that allow a user to interact with a piece of software.
Useful Interchange
User Input
User Interface
User Intention
Data that are sent to a computer for processing by a program.
Output
Screen
Input
User Interface
Any data that are sent from a program to a device.
Input
Output
Outdate
Program
A set of commands, instructions, and other syntax use to create a software program.
User Interface
Encryption
Coding
Programming Language
A command or instruction. Sometimes also referred to as a code statement.
User Interface
Program Statement
Coding
Programming Language
A collection of program statements. Programs run (or “execute”) one command at a time.
Program
Program Statement
Coding
Programming Language
Program statements run in order, from top to bottom.
Sequential Programming
Event Driven Programming
Some program statements run when triggered by an event, like a mouse click or a key press.
Sequential Programming
Event Driven Programming
What will the console log say when this program is run?
"Starting my program!"
"You clicked the button!"
"Ending my program!"
"Starting my program!"
"Ending my program!"
"You clicked the button!"
"You clicked the button!"
"Starting my program!"
"Ending my program!"
"You clicked the button!"
"Ending my program!"
"Starting my program!"
After the program is run, what will the text color of smallButton be?
red
blue
green
yellow
If the user clicks the button, what color will "topButton" be when the program finishes running?
red
green
blue
orange
When this program is run, the user clicks "topButton" then "bottomButton" and then "topButton" again. What will be displayed in the console?
aaa
bbb
ccc
aaa
aaa
ccc
bbb
aaa
ccc
aaa
bbb
aaa
aaa
bbb
aaa
ccc
What is a reason to include comments in a program?
Comments tell the computer what the code is doing.
Comments tell the programmer what the code is doing.
Comments help the user work an app more effectively.
Comments will show up in the console so when the program is run, the programmer know what happens.
How many bits are in a byte?
4
255
0
8
1111 1111
128
255
256
127
What is 1101 1110 in decimal form?
(a)
Convert the decimal number 44 to binary.
(a)
Convert 0101 1100 to decimal form?
(a)
Convert the decimal number 83 to binary.
(a)
What is 1100 1011 in decimal form?
(a)
Convert the decimal number 140 to binary.
(a)
What is 0101 0101 in decimal form?
(a)
Convert the decimal number 14 to binary.
(a)
How are shapes plotted on the screen?
with alphabet letters
with X and Y coordinates
using a touch screen
with width and height values
The x value represents...
How far away from the left of the screen
How far away from the right of the screen
How far away from the top of the screen
How far away from the bottom of the screen
The y value represents...
How far away from the right of the screen
How far away from the left of the screen
How far away from the bottom of the screen
How far away from the top of the screen
What is the origin of a square or rectangle?
The bottom right corner
The bottom left corner
The top right corner
The top left corner
What is the origin of a circle or ellipse?
The bottom left corner
The center
The bottom right corner
The top
In this line of code:
rect(250, 100);
which number is the y value?
rect
250
100
In this line of code: rect(250, 250, 100, 50); what do 100 and 50 represent?
The x and y values
The w and h values
Given rect(x, y, w, h); what are w and h?
width and heavy
width and tallness
width and length
width and height
The line of code: background("red"); will change what red?
Any shapes on the screen
The background
The foreground
Nothing
What line of code will change the color of any shapes coded below it?
color
rect
weight
fill
What does the randomNumber line of code do?
picks the same number every time
picks any number from zero to infinity
picks any number from the minimum and maximum that you set
it doesn't do anything
Can you use the randomNumber line of code to replace a single value, such as a y value?
Yes!
No!
This line of code does what?
var hello = 100
creates a variable
names or labels the variable "hello"
sets the value of the variable hello to 100
All three are correct
Which command matches this block of code?
Creates a new sprite and assigns it to the variable specified.
Declares and assigns an initial value to a variable
Draws an ellipse onto the display centered at x and y and inscribed in a rectangle with sides length w(idth) and h(eight).
Which command matches this block of code?
Declares and assigns an initial value to a variable.
The number of times per second the screen is refreshed.
Returns a random number in the closed range from min to max.
Which command matches this block of code?
Draws an ellipse keeping the height to width ratio the same.
Shrink or grow a sprite keeping the height to width ratio the same.
Draws a rectangle keeping the height to width ratio the same.
Which command matches this block of code?
Displays a group of sprites. If no parameter is specified, draws all sprites in the sketch.
Shrink or grow a sprite keeping the height to width ratio the same.
The lines of code contained inside its block are continuously executed until the program is stopped.
Finding and fixing problems in an algorithm or program.
Bug
Variable
Property
Debugging
A graphic character on the screen with properties that describe its location,
Sprite
Property
Animation
Variable
A series of images that create the illusion of motion by being shown rapidly one after the other
Frame
Animation
Bug
What is x value in the following code?
rect(250, 200, 75, 225);
250
200
75
225
In which direction will the sprite move?
bee.y = bee.y + 2
left
right
up
down
Which sprite property would you change to move the sprite from left to right?
sprite.x
sprite.y
sprite.scale
sprite.rotation
Which sprite property would you change to make the sprite turn in a circle?
sprite.x
sprite.y
sprite.scale
sprite.rotation
What will the console log say when this program is run?
"Starting my program!"
"You clicked the button!"
"Ending my program!"
"Starting my program!"
"Ending my program!"
"You clicked the button!"
"You clicked the button!"
"Starting my program!"
"Ending my program!"
"You clicked the button!"
"Ending my program!"
"Starting my program!"
Which line of code is most likely to return an error?
1
2
3
4
Which command matches this block of code?
Draws an ellipse keeping the height to width ratio the same.
Shrink or grow a sprite keeping the height to width ratio the same.
Draws a rectangle keeping the height to width ratio the same.
Which direction will the sprite move in the code pictured? (Click on picture to enlarge.)
Left
Right
Up
Down
What keyboard key do you need press to move the sprite?
x
y
up arrow
space
What is the name of the sprite variable in the code pictured? (Click on picture to enlarge.)
fly
ladybug
bug
space
This plane looks like someone is smearing a stamp across a paper.
How would you fix this code so that it looks likes the plane is smoothly moving across the scene? (Click on image to enlarge.)
(line 8) increase the speed of the plane in the draw loop.
(line 7) add plane.rotation into the draw loop
(line 4) add a drawSprites
(line 3) move the background code into the draw loop so that it makes a new background each loop
Match the code with the output
Match the code with the output
Which command matches this block of code?
The number of times per second the screen is refreshed.
The lines of code contained inside its block are continuously executed until the program is stopped.
Creates a new sprite and assigns it to the variable specified.
