wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Unit 3 Lessons 1-9 (APCSP Code.org)

Total questions: 88

Worksheet time: 2hrs 44mins

Name
Class
Date
1.

1. What does a “FOR LOOP” do? What is the variable, “I”, used for?

a)

a. FOR LOOP repeats a function for a set number of times; I is the number of times repeated

b)

b. I is a parameter of the function, and for only performs an action if certain circumstances are met

c)

c. The FOR LOOP is a function and I the absolute value of the function

d)

d. The FOR LOOP controls the order functions are called on outside of the for loop; I is the number of functions it controls

2.

1. When is a good time to use a parameter?

a)

Choice A: When you need to repeat the same line of code multiple times without re-writing it each time

b)

Choice B: When you need to change the height, length, or size of something you are coding

c)

Both A and B

d)

Neither A nor B

3.

moveForward() is an example of this:

a)

Parameter

b)

Function

c)

Conditional

d)

Library

4.

This is a type of code that allows you to repeat a certain code over and over again without having to manually put it in.

a)

Function

b)

Parameter

c)

Loop

d)

API

5.
What is an example of abstraction?
a)
 a. A loop to draw multiple birds
b)
 b. A function to draw a bird
c)
 c. moveForward (25) 
d)
d. arcLeft (90)
6.

A collection of commands made available to a programmer:

a)

Algorithm

b)

Manual

c)

API

d)

AIG

7.
In programming, an expression that evaluates to True or False. 

a)
Abstraction
b)
Boolean Expression
c)
Aggregate Expression
d)
None of the above
8.
A description of the behavior of a command, function, library, API, etc.
a)
File
b)
Manual
c)
Documentation
d)
Formula
9.

A particular kind of looping construct provided in many languages. Typically, it defines a counting variable that is checked and incremented on each iteration in order to loop a specific number of times.

a)

NOW LOOP

b)

IF LOOP

c)

FOR LOOP

d)

IF/NOW LOOP

10.
A piece of code that you can easily call over and over again.
a)
Function
b)
File
c)
Folder
d)
Frame
11.

A collection of commands / functions, typically with a shared purpose:

a)

Documents

b)

File

c)

Library

d)

Folders

12.

An extra piece of information that you pass to the function to customize it for a specific need:

a)

Packets

b)

Parameter

c)

Chunk

d)

Data

13.

This is known as a precise sequence of instructions for processes that can be executed by a computer and are implemented using programming languages.

a)

Function

b)

Parameter

c)

Algorithm

d)

Command

14.

In the first lesson of the unit, you came up with a clear and precise set of instructions for building a Lego arrangement. These instructions that you were trying to create would be considered an example of an algorithm.

a)

True

b)

False

15.

Which of the following is FALSE regarding algorithms?

a)

Option 1: Different algorithms can be developed to solve the same problem

b)

Option 2: Different code can never be written to implement the same algorithm

c)

Both Option 1 and 2 are true

d)

Both Option 1 and 2 are false

16.

Every algorithm can be constructed on using:

a)

Sequencing

b)

Selection

c)

Iteration

d)

Questions

17.

Which of the following is NOT an example of a high-level language?

a)

JavaScript

b)

Human Machine Language

c)

Java

d)

C++

18.

Which of the following is FALSE on why programming languages have functions?

a)

Enables programmers to write code in larger, more logical chunks

b)

Enables programmers to write code in smaller, less logical chunks

c)

Enables programmers to reuse code segments

d)

Streamlines code into shorter, but more readable (understandable) sequences

19.

When your programming is achieving some desired outcome while minimizing wasted effort or resources, we would say that its:

a)

Top Notch

b)

Comparable

c)

Efficient

d)

Problematic

20.

Looking at the coding that takes place above, why are these functions an example of abstraction?

a)

Creating the code above helps you think of your code at a higher level, making sure you don't get lost in all the little details

b)

You are able to "box up" and name the code necessary to draw the rectangle

c)

Once the function has been tested and it works, you don't have to worry about the details of how it works anymore

d)

All of these choices are true

21.

In creating the snowflake you see above, which of the following function names would probably NOT be used in your code?

a)

drawSnowflake()

b)

drawBranch()

c)

drawCross()

d)

Any of these three (functions can be named however you want)

22.

Which of the following functions are named properly and as such, would more than likely be acceptable for your code?

a)

MyAmazingFunction()

b)

#my1AmazingFunction()

c)

1AmazingFunction()

d)

my1AmazingFunction()

23.

Which of the following is FALSE regarding functions?

a)

Function definitions should appear at the bottom of the program

b)

Using an underscore in a function name is acceptable

c)

Most function names cannot begin with a symbol or number

d)

Called functions should appear at the bottom of your program

24.

An example and appropriate use of camel casing in your function names would be FunctionName()

a)

True

b)

False

25.

Looking at Lines 3 and 5 above, the "IF" statements in these particular parts of the algorithm are constructed with:

a)

Selection

b)

Iteration

c)

Sequencing

26.

Placing Lines 1-9 of your algorithm in a particular order shows which of the following is important?

a)

Sequencing

b)

Selection

c)

Iteration

27.

Looking at the image above, looping (through iteration) can be seen in which of the following lines of this algorithm?

a)

Line 2

b)

Line 7

c)

Line 3

d)

Line 9

28.

You've learned that programmers obviously don't memorize all of a particular programming language. Which of the following is FALSE on how programmers use all of a particular language?

a)

Programmers might read new code in helping to write old code

b)

Through the use of references built into the program programmers are using (such as ABI)

c)

Asking other programmers for help

d)

Through the use of online or print resources

29.
An IF statement can have IF statements inside of it
a)
True
b)
False
30.

Which of the following are FALSE regarding creating comments in your coding?

a)

These blocks of code do not change your program

b)

They allow you to share your coding with other programmers

c)

Allows you to create notes about the current code that you may want either you or another programmer to look at in the future

d)

You should always start off a comment with backslashes \\

31.

Which of the following would NOT be an example of a parameter you could insert into one of your functions?

a)

Width of a pen you are using

b)

Value of Red, Green, or Blue in RGB

c)

Using "Show" or "Hide" with your Pen

d)

Number of degrees with a left arc

32.

Which of the following is CORRECT in the way the parameters should be separated for the arcLeft() command?

a)

arcLeft(360;50)

b)

arcLeft(360,50)

c)

arcLeft(360/50)

d)

arcLeft(360.50)

33.

When using the penRGB(r,g,b,a) command, what is the highest value you can use for either red, green, or blue?

a)

64

b)

144

c)

255

d)

256

34.

When using the penRGB(r,g,b,a) command, what type of parameter does "a" represent?

a)

The color black

b)

Opacity

c)

Pen weight

d)

Amount of dashes in a line

35.

In order to draw the square you see above without using moveForward() and turnLeft(), use the moveTo() command.

a)

True

b)

False

36.
A _____________ expression is an expression that is either true or false. 
a)
boolean
b)
truth
c)
variable
d)
conditional
37.

When would you use loops over functions in your code?

a)

A: When you need repetitious behaviors to solve some sort of problem

b)

B: When you want to manually call functions many times in a row

c)

Both A and B

d)

Neither A nor B

38.

Which of the following is FALSE regarding the above image?

a)

A Loop was used here because an action takes place over and over again without a predetermined ending

b)

A ForLoop was used here because there is a predetermined beginning, ending, and increment

39.

Ambiguities in natural language necessitate the creation of a more precise language - a programming language- for controlling computers

a)

True

b)

False

40.

Compared to the number of words in a natural language, the number of defined words in a programming language is very small.

a)

True

b)

False

41.

There are many possible ways to interpret an instruction written in a programming language.

a)

True

b)

False

42.

Which of the following is not true about functions?

a)

Functions are reusable programming abstractions

b)

Functions can reduce complexity of writing and maintaining programs

c)

Functions cannot make calls to other functions within the same program

d)

Once defined, a function can be called many times from different parts of the program.

43.

Which of the following would be a well-named function IF we are following all important naming conventions?

a)

#drawStar()

b)

Drawstar()

c)

DrawStar()

d)

drawStar()

44.

Two functions in a single program can have different names but contain identical code.

a)

True

b)

False

45.

Which of the following will call the function drawStar?

a)

drawStar;

b)

function drawStar( ){

for (var i = 0; i < 5; i++{

moveForward(100);

turnLeft(36);

}

}

c)

function drawStar;

d)

drawStar( );

46.

To use turtle drawing to form the letters of the word "GAMETIME" you would be better off to write

a)

A loop

b)

Function(s)

47.

To create a turtle drawing of a octagon (eight-sided shape), it would be most efficient to write

a)

A loop

b)

A function

48.

To use turtle drawing to draw 100 tiny dots in a line, it would be best to use

a)

A loop

b)

A function

49.

Using turtle drawing to create a circle of any size at a given point on the screen, it would be best to write

a)

a Loop

b)

a Function

50.

Why are parameters useful when programming?

a)

Parameters change the order of operations within a function.

b)

Parameters help teams of programmers because they define the problems they are trying to solve.

c)

Parameters allow for more flexible, generalized behaviors in functions.

d)

Parameters determine the number of times a function will run.

51.

When programmers work together, what is an example of an abstraction in programming that can promote collaboration?

a)

Team members can rely on one another to explain their code.

b)

Programmers can write functions without needing ot know what they do or how they should work.

c)

Programmers can use functions created by others, relying on the functionality without knowing details of how the function works

d)

In order for programmers to work together, they must be in the same room.

52.

Which of the following best describes one of the benefits of using an iterative and incremental process of

program development?

a)

It allows programmers to implement algorithmic solutions to otherwise unsolvable problems.

b)

It eliminates the need for programmers to test completed programs.

c)

It enables programmers to create programs that use the lowest-level abstractions available.

d)

It helps programmers identify errors as components are added to a working program.

53.

What do parameters used in a procedure provide?

a)

A way to get values into the procedure, making the code more flexible

b)

A way to return values calculated in the procedure back to the calling program

c)

A way to call a procedure from within another procedure

d)

A way to connect an API to the procedure

54.

A collection of commands made available to a programmer

a)

ASCII

b)

Heuristic

c)

API

d)

DNS

55.

An extra piece of information passed to a function to customize it for a specific need

a)

Parameter

b)

Library

c)

Function

d)

Block

56.

The action of doing something over and over again.

a)

Sequencing

b)

Loop

c)

Agregation

d)

Iteration

57.

What is displayed as a result of running the program?

a)

Foxtrot

b)

Hotel

c)

November

d)

Yankee

58.
A piece of code that you can easily call over and over again. 
a)
Repeat
b)
Functions
c)
Procedures
d)
Fractions
59.
A placeholder for a piece of information that can change.  This is also a term in math.
a)
variable
b)
Editor
c)
Item
d)
Information item
60.
Finding and fixing errors in programs
a)
Tech support
b)
Decompose
c)
Debugging
d)
Fixing
61.
An error in a program that prevents the program from running as expected.
a)
Error report
b)
Bug
c)
Mistake
d)
Algorithm
62.
the ordered steps in a program.
a)
Sequence
b)
If...Then...Else
c)
Conditional
d)
Value
63.
is a sequence of instructions (or algorithm) written in a language or code that a computer can understand and put into action. Must be accurate to be correct.
a)
Procedure
b)
Algorithm
c)
Program
d)
Loop/ Repeat
64.

Which of the following best characterizes a high-level programming language?

a)

A language comprised entirely of hardware logic gates

b)

A language in which each instruction corresponds directly to an instruction in a computer’s machine code

c)

A language that is easy for a computer to interpret but difficult for humans to interpret

d)

A language that uses multiple abstractions to manage complexity

65.

A student wants to create an algorithm that can determine, given any program and program input, whether or not the program will go into an infinite loop for that input. The problem the student is attempting to solve is considered an undecidable problem. Which of the following is true?

a)

It is possible to create an algorithm that will solve the problem for all programs and inputs, but the

algorithm can only be implemented in a low-level programming language.

b)

It is possible to create an algorithm that will solve the problem for all programs and inputs, but the

algorithm requires simultaneous execution on multiple CPUs.

c)

It is possible to create an algorithm that will solve the problem for all programs and inputs, but the

algorithm will not run in reasonable time.

d)

It is not possible to create an algorithm that will solve the problem for all programs and inputs.

66.
A red triangle is pictured below in a grid of squares. It is currently facing upward, and can only move using the MoveTriangle procedure, shown below. The triangle can move onto white and gray squares, but not onto the black squares.
PROCEDURE MoveTriangle (numMoves, numTurns)
{ 
REPEAT
numMoves TIMES   

MOVE_FORWARD() 
}
 
REPEAT numTurns TIMES 
{   
TURN_RIGHT() 
}
}
Which of the following instructions will get the red triangle to the gray square?
a)
 
MoveTriangle (1, 1) MoveTriangle (1, 1) MoveTriangle (3, 1) MoveTriangle (3, 0)
b)
MoveTriangle (4, 1)
MoveTriangle (4, 0)
c)
MoveTriangle (1, 1)
MoveTriangle (1, 3)
MoveTriangle (3, 1)
MoveTriangle (3, 0)
 
d)
MoveTriangle (1, 1)
MoveTriangle (1, 3)
MoveTriangle (3, 3)
MoveTriangle (3, 0)
67.
Which of the following statements about abstraction is true?
a)
Abstraction requires users to understand the low-level details of a system.
b)
Abstraction reduces information and detail to facilitate focus on relevant concepts.
c)
Abstraction increases the run-time complexity of a program.
d)
Abstraction compresses a program file to reduce file size.
68.

Starting in the bottom left corner facing right, where will the robot end up after the following code is called with: controlRobot([2, 1, 3, 6])?

a)
b)
c)
d)
69.

The following question uses a robot in a grid of squares. The robot is represented by a triangle, which is initially facing right. Which of the following code segments will move the robot to the gray square?

a)
b)
c)
d)
70.
A programming language that captures only the most primitive operations available to a machine is a(n)?
a)
Algorithm
b)
High Level Programming Language
c)
Low Level Programming Langauge
71.
__________ means to repeat in order to achieve, or get closer to, a desired goal.
a)
Sequence
b)
Iterate
c)
Select
72.
A generic term for a type of programming statement (usually an if-statement) that uses a Boolean condition to determine, or select, whether or not to run a certain block of statements is ______.
a)
Iteration
b)
Selection
c)
Sequencing
73.
Putting commands in correct order so computers can read the commands is 
a)
algorithms
b)
selection
c)
sequencing
74.
___________ programming is a classic method for learning programming with commands to control movement and drawing of an on-screen robot. 
a)
Snail
b)
Robot
c)
Turtle
75.
A(n) ___________ is a simplified representation of something more complex that lets you hide details to help you manage complexity, focus on relevant concepts, and reason about problems at a higher level.
a)
Selection
b)
Abstraction
c)
Function
76.
A(n) __________ is a named group of programming instructions that are reusable abstractions that reduce the complexity of writing and maintaining programs.
a)
Function
b)
Abstraction
c)
Selection
77.
_____________________ is a problem solving approach in which you break down a system to gain insight into the sub-systems that make it up.
a)
Step design
b)
Bottom-Up design
c)
Top-Down design
78.
A collection of commands made available to a programmer is an ____.
a)
Documentation
b)
API
c)
Parameter
79.
A description of the behavior of a command, function, library, API, etc.
a)
API
b)
Library
c)
Documentation
80.
A collection of commands/functions, typically with a shared purpose is a ______.
a)
Documentation
b)
Library
c)
API
81.
A _________ is an extra piece of information passed to a function to customize it for a specific need.
a)
Parameter
b)
Documentation
c)
Library
82.
Why are parameters useful when programming?
a)
Parameters determine the number of times the function will run. 
b)
Parameters allow for more flexible, generalized behaviors in functions.
c)
Parameters are useful for teams of programmers because they help define the boundaries of the problem they are trying to solve. 
d)
Parameters change the order of operations within a function. 
83.
Know how to drive a car without knowing how the engine works is an example of abstraction 
a)
True
b)
False
84.
 Pulling out specific differences to make one solution work for multiple problems.
a)
Top Down Design
b)
Abstraction
c)
variable
d)
none of the above
85.

A problem solving approach (also known as stepwise design) in which you break down a system to gain insight into the sub-systems that make it up.

a)

Top Down Design

b)

Function

c)

Variable

86.

Why are these icons a good use of abstraction?

a)

They tell us what they mean without needing to use the name

b)

They are difficult to understand

c)

They don't explain what they are

87.
What is Abstraction?
a)
•– the use of computers to solve problems.
b)
representing 'real world' problems in a computer using variables and symbols and removing unnecessary elements from the problem
c)
•breaking down a large problem into smaller sub-problems.
d)
•identifying the steps involved in solving a problem.
88.
Top Down Design is when you take a problem and break it down into smaller sub problems or smaller pieces
a)
True
b)
False