wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

APCSP Unit 1

Total questions: 20

Worksheet time: 11mins

Name
Class
Date
1.

Which of the following is an important step to take before beginning to write the code for a program?

a)

Plan the logic and anticipated input/output of the code

b)

Randomly generate the variable names to be used in the program

c)

Plan an update and maintenance schedule for the program

d)

Write on paper or a whiteboard all the code you intend to type

2.

Which of the following could be considered part of the beginning “state” of a Scratch program?

a)

Visibility of sprites

b)

The background image

c)

The value of a variable

d)

All of the above

3.

As part of the lifecycle of a program, after a computer programmer writes the code, it is then compiled and usually used to create an executable file to be run on the CPU. The code that is run through the compiler is known as what?

a)

Machine Code

b)

Source Code

c)

Binary Code

d)

RAM

4.

Subana is writing a program which will calculate the mean average of a set of numbers by adding the numbers and dividing the result by the amount of numbers. She will use a variable, avg, to store this average. Which variable type would be most suitable for avg?

a)

Floating point (float)

b)

Boolean

c)

Integer

d)

String

5.

Tom created the following code segments in Scratch, which are intended to create a short piece of music between them.

When the green flag is clicked, each of the three scripts is intended to run in turn, however, due to a mistake in the code, this does not happen. Which of the following changes could Tom make to ensure that all three of the scripts run as intended?

a)

Delete the block

"Set volume 100 %"

b)

Replace the block "broadcast sound3" with the block "broadcast sound2"

c)

Both of the above options

d)

None of the above options

6.

Many tasks, large and small, can be solved by performing a specific set of actions and making a particular set of decisions in very precise ways. These sets of actions and decisions are known as what?

a)

Abstraction

b)

Algorithms

c)

Building Blocks

d)

Processes

7.

Which of the following could be represented by a boolean variable?

a)

The direction a car proceeds in at a 4-way intersection

b)

The number of tech support requests made in a day

c)

Whether a guest at a wedding is allergic to peanuts

d)

The weight of a truck as recorded at a weigh-station

8.

Peter wrote the following code in scratch to make a sprite perform a series of coordinated moves, forming a “dance routine.”

The code will be used for a competition, and Peter does not want to reveal the moves performed by the sprite in his program. Currently the path taken by the sprite is traced on the screen. Which of the following changes to the code will change this and allow Peter to keep the path taken by his sprite hidden?

a)

Removing the "pen down" block

b)

Removing the "set x to 0" block

c)

Removing the "thing O-la-la for 2 seconds" block

d)

Removing the "change color effect by 25" block

9.

Which of the following types of languages is optimized for machine processing and may be written and expressed as a series of binary digits (e.g., ones and zeros), making it difficult for humans to read and write?

a)

Natural language

b)

Pseudocode

c)

High-level programming language

d)

Low-level programming language

10.

Consider constructing an algorithm for a robot that can only perform the following three predefined operations.

Which of the following algorithms will successfully cause the robot to trace out a square-shaped path, with the robot ending up in its original position and facing in its original direction?

a)

b)

c)

d)

11.

The code segments for making a Scratch program which simulates a conversation between the user and a sprite on-screen are given below.

Which of the following orders is most suitable if the program is to run without errors and produce the most realistic appearing conversation?

a)

5-1-4-3-2

b)

5-2-1-3-4

c)

5-3-1-4-2

d)

3-1-4-2-5

12.

Which of the following statements about high-level programming languages when compared to low-level programming languages is true?

a)

High-level programming languages provide programmers with more abstractions and are easier for people to read

b)

High-level programming languages provide programmers with more abstractions but are more difficult for people to read

c)

High-level programming languages provide programmers with less abstractions but are easier for people to read

d)

High-level programming languages provide programmers with less abstractions and are more difficult for people to read

13.

Joanna wishes to create a variable in her scratch game which records the number of seconds until the game ends. Which of the following would be the most appropriate name for this variable?

a)

Variable1

b)

t

c)

amountOfTimeRemainingInTheGame

d)

time_left

14.

A group of high school students is participating in a mobile application development contest. They have a limited time frame and would like to add many features. Which of the following strategies will allow them to create the best app they can in the time allotted?

a)

Strategy I only

b)

Strategy II only

c)

Strategy I and Strategy II will both allow the students to create a quality application.

d)

Neither Strategy I nor Strategy II will allow the students to create a quality application

15.

An entrepreneur has hired a programmer to design software to take user input and convert it to appear a certain way. The programmer is not clear on the assignment, so he asks the entrepreneur to elaborate. Which of the following would be most helpful for the programmer to ask the entrepreneur to do to make the assignment clearer?

a)

Give some examples of user input and what the result should look like

b)

Write some sample code to show the programmer exactly what he wants

c)

Sit side-by side throughout the debugging process

d)

Select the most appropriate language for the application

16.

For her 4th of July weather report, a local meteorologist wishes to predict the likelihood of the scheduled fireworks show being rained out by analyzing the most recent weather trends in the local vicinity. Which of the following sources of data would be the most appropriate for helping her make the prediction?

a)

A floating-point value representing the daily rainfall total for July 4th of the previous year

b)

A floating-point value representing the highest daily rainfall total over the last 365 days

c)

A list of integers representing the previous years in which it has rained in the area on the 4th of July

d)

A list of floating-point values representing the daily rainfall totals for the previous 10 days (June 24th through July 3rd)

17.

Imagine you are programming a simple calculator using Scratch and you want to create a feature which adds a fixed number to an existing variable named “balance”. Which of the blocks below will be the most appropriate to use for this feature?

a)

b)

c)

d)

18.

Which of the following is an advantage that block-based programming languages (e.g. Scratch) have over text-based programming languages (e.g. Processing)?

a)

Block-based programming languages allow programmers to write programs in English and other natural languages.

b)

Block-based programming languages do not require the programmer to worry about syntax, capitalization, or punctuation.

c)

Programs written in block-based programming languages do not require debugging.

d)

Block-based programming languages offer programmers more detailed control over lower-level functionality when writing a program.

19.

Which of the following best represent examples of abstraction?

Select two answers

a)

A courier has to follow a detailed set of precise and detailed instructions to get to her destination. The directions given are followed one at a time in the order they appear.

b)

A set of crochet instructions describes in full how to complete a certain type of named stitch at the start. Throughout the rest of the instructions, the stitch is referred to by its name without the full instructions being repeated.

c)

Source code is copied from one program to another so that code to perform a particular operation does not need to be rewritten.

d)

A single command in a high-level programming language actually requires the CPU to perform multiple different operations, each of which would be represented by a different command in machine code.

20.

Cardel is using Java to write a SaaS program for an educational technology company. He chooses to keep his code private and to protect his work from imitation but may wish to modify or update the code in the future. Which of the following will be most likely to make it easier for him to edit his code in the future?

Select two answers.

a)

Syntax of the language

b)

Testing of the code with various inputs

c)

Naming conventions

d)

Adequate and appropriate comments