wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Unit 2 Computer Science Review

Total questions: 27

Worksheet time: 48mins

Name
Class
Date
1.

A set of commands, instructions, and other syntax used to create a software program.

a)

Conditional

b)

Loop

c)

Programming Language

d)

Boolean

2.

Simplified programming language which uses the spoken language.

a)

Pseudo Code

b)

Logic Gate

c)

Declaration

d)

Hig Level Language

3.

A type of control flow statement that allows code to be executed repeatedly.

a)

Loop

b)

Variable

c)

Logic Gate

d)

Boolean Condition

4.

A container which holds a value. These are identified by symbolic but meaningful names by the programmer

a)

Programming Language

b)

Variable

c)

Loop

d)

Boolean

5.

Queries that compare 2 values with each other, such as true/false.

a)

Variable

b)

High Level Language

c)

Pseudocode

d)

Boolean Condition

6.

A way to perform different computations or actions depending on whether a programmer specified boolean condition evaluates as true or false. For example, if-else

a)

Declaration

b)

Pseudocode

c)

Loop

d)

Conditional

7.

Programming languages which use a strong abstraction the the details of the computer, such a block language.

a)

High Level Languages

b)

Low Level Language

c)

Binary

d)

Logic Gate

8.

Which of the following is NOT true about functions in programming?

a)

Functions help break a problem into logical chunks.

b)

Functions cannot make calls to other functions within the same program.

c)

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

d)

Functions help reduce the complexity of writing and maintaining programs.

9.

Which of the following will call the function drawStar?

a)

function drawStar;

b)

drawStar;

c)

drawStar();

d)

function drawStar(){

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

moveForward(100);

turnLeft(36);

}

}

10.

Which of the following is NOT part of defining a function?

a)

Giving the function a name

b)

Giving the parameters a value

c)

Adding code to the body of the function.

d)

Identifying the parameters of the function

11.

In the procedure Mystery below, the parameter number is a positive integer.

PROCEDURE Mystery (number)

{

REPEAT UNTIL (number < 0)

{

number ¨ number - 2

}

IF (number = 0)

{

RETURN ( true )

}

ELSE

{

RETURN ( false )

}

}

Which of the following best describes the results of running the procedure Mystery?

a)

The procedure returns true when the initial value of number is 2, and it otherwise returns false.

b)

The procedure returns true when the initial value of number is greater than 2, and it otherwise returns false.

c)

The procedure returns true when the initial value of number is even, and it otherwise returns false.

d)

The procedure returns true when the initial value of number is odd, and it otherwise returns false.

12.

Which of the following images represents the most likely output produced by the code segment given below?

for (var i=0; i < 15; i++) {

moveForward(randomNumber(15, 75) ) ;

turnRight(90);

}

a)
b)
c)
d)
13.

What is an API?

Read the definitions provided below and then choose the best answer.


Abstract Programming Inheritance - The idea that abstractions in languages get "passed down" in newer versions.


Artificial Parameter Intelligence - The idea that function parameters should be intelligent enough to "know" what you want as a programmer.


Application Program Interface - A well-documented library of functions provided in a programming language that helps to simplify complex programming tasks.


Applied Power Implementation - A process by which functions are given extra override power related to parameters.


Abstract Parameter Interface - A programming construct in which parameters are passed down through levels of abstraction

a)

Abstract Parameter Interface

b)

Artificial Parameter Intelligence

c)

Application Program Interface

d)

Applied Power Implementation

14.

For this scenario related to turtle drawing, indicate whether it is better to write a loop or a function (or a set of functions) to handle the task:


Drawing out the letters of a word "HELLO"

a)

Boolean Command(s)

b)

Loop

c)

Function(s)

d)

Variable(s)

15.

Which of the following blocks is least similar to the others?

a)
b)
c)
d)
16.

Why are parameters useful when programming?

a)

Parameters change the order of operations within a function.

b)

Parameters determine the number of times the function will run.

c)

Parameters allow for more flexible, generalized behaviors in functions.

d)

Parameters are useful for teams of programmers because they help define the boundaries of the problem they are trying to solve.

17.

Which one of the following statements about functions is TRUE

a)

Two functions can be given identical names as long as their code is identical.

b)

Code can be added or removed dynamically from a function while the program is running.

c)

Functions can be called using different names depending on where in the program they are called.

d)

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

18.

Consider the following procedure:

PROCEDURE Mystery (number)

{

REPEAT UNTIL (number < 0)

{

number ¨ number - 2

}

IF (number = 0)

{

RETURN ( true )

}

ELSE

{

RETURN ( false )

}

}


The REPEAT UNTIL command is an example of a(n)

a)

Boolean expression

b)

Loop

c)

Variable

d)

Robot Algorithm

19.

What is one important naming convention of functions?

a)

Function names should be organized alphabetically.

b)

A function name should indicate how long the function takes to run.

c)

Two functions with similar behavior should be given identical names to indicate the relationship between them.

d)

A function name should be as descriptive as possible to indicate what the function does.

20.

Which of the following statements about writing functions and Top-Down Design is NOT true?

a)

Top-Down Design relies upon identifying sub-problems of a larger problem.

b)

Writing functions helps manage complexity in a program.

c)

Top-Down Design leads to programs which feature multiple layers of abstraction.

d)

Two programmers solving the same problem using Top-Down Design should arrive at identical programs.

21.

Choose the two (2) statements that are true about functions

a)

Functions in programming are useful mathematical tools for doing complex computations.

b)

Meaningful function names help people better understand programs.

c)

Functions in programming are names groupings of programming instructions.

d)

Meaningful function names help computers better understand programs.

22.

Programming languages have some similarities and differences to the "natural" language you use in everyday speech. Select the two true statements about programming languages:

a)

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

b)

Ambiguities in natural language necessitate the creation of programming languages for controlling a computer

c)

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

d)

The number of defined words in a programming language is about the same as the number of words in a natural language.

23.

In the program below, the initial value of x is 5 and the initial value of y is 10


IF ( x < 10)

{

DISPLAY ( “FOXTROT”)

}

ELSE

{

IF ( x > y )

{

DISPLAY ( “Hotel” )

}

ELSE

{

IF (y > 0 )

{

DISPLAY (“November” )

}

ELSE

{

DISPLAY ( “Yankee” )

}

}

}


What is displayed as a result of running the program?

a)

Yankee

b)

Foxtrot

c)

Hotel

d)

November

24.

For this scenario related to turtle drawing, indicate whether it is better to write a loop or a function (or a set of functions) to handle the task:


Drawing 100 tiny dots in a line

a)

Loop

b)

Function

25.

For this scenario related to turtle drawing, indicate whether it is better to write a loop or a function (or a set of functions) to handle the task:


Drawing a circle of any size at any point on the screen

a)

Loop

b)

Function

26.

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

a)

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

b)

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

c)

Programmers can use functions created by their partners, relying on the functionality without needing to know the specific details of how the function is implemented.

d)

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

27.

For this scenario related to turtle drawing, indicate whether it is better to write a loop or a function (or a set of functions) to handle the task:


Drawing a hexagon (six-sided shape)

a)

Loop

b)

Function