wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CSP CMU Unit 2 - Student Created Questions

Total questions: 62

Worksheet time: 27mins

Name
Class
Date
1.

What do you call the inputs of a fuction while defining it?

a)

Arguments

b)

Function call

c)

Parameters

d)

Label

2.

Which AP Vocab term is defined as the inputed variables of a procedure?

a)

Parameters

b)

Arguments

c)

Body

d)

Calling

3.

def drawOval(size, color):

Oval(200,300,size,size,fill=color)

In the code above what is the function name?

a)

drawOval

b)

(size,color)

c)

def

d)

(200,300,size,size,fill=color)

4.

How do you run a function named foo with no parameters in python?

a)

foo()

b)

foo(a)

c)

foo(a,b)

d)

foo

5.

Why should your parameter names be concise and descriptive?

a)

So that you and others who review your code can understand what it does

b)

for fun

c)

because it is the law

d)

python will give you an error if you do not.

6.

What is a function?

(select all correct answers)

a)

A function is a named group of programming instructions that may have parameters and return values

b)

A function is input variables of a procedure

c)

A function groups together a sequence of statements that we can run when we want

d)

Functions specify the values of the parameters when a procedure is called

7.

What does a function do?

a)

A. Explains the information inside the parenthesis when coding a shape.

b)

B. Groups together a sequence of statements that can run on command

c)

C. Acts as the pseudocode to make it easier to identify errors in the code

8.

What is a named group of programming instructions that may have input variables and return values?

a)

a. parameter

b)

b. argument

c)

c. function

d)

d. definition

9.

Which of the following are the input variables when you define a procedure?

a)

parameters

b)

arguments

c)

functions

d)

test cases

10.

Where will we find a test case in our code?

a)

At the top of the program

b)

on lines that start with hashtags (#)

c)

any time after the function that we are testing is defined

d)

Anywhere in our code

11.

What are the parameters in this code?

a)

drawSquare

b)

width, height, size, color

c)

50,50,100,'red'

d)

b and c

12.

What is the function name of this:
def drawTurtle(color):

a)

A. def

b)

B. drawTurtle

c)

C. color

13.

Which value represents the radius of a star?

a)

Star(5*, 5, 5, 5)

b)

Star(5, 5*, 5, 5)

c)

Star(5, 5, 5*, 5)

d)

Star(5, 5, 5, 5*)

14.

What is the most accurate definition of debugging?

a)

1) To remove a/multiple bug(s) within your code

b)

2) To add a bug to your code

c)

3) To fix a syntax error

d)

4) To fix a logical error

15.

Why do we use functions in coding?
(select all correct answers)

a)

functions can help us reduce the size of our code

b)

functions always makes our code more complex

c)

functions allow us to reuse code and break down our logic into smaller parts

d)

functions help us to identify bugs in our code

16.

What keyword must we use as the first word when we create a function?

a)

func

b)

go

c)

run

d)

def

17.

What symbol do you use to multiply?

a)

A. X

b)

B. \

c)

C. *

d)

D. !

18.

In order to create a function, you must use which of the following terms?

a)

A: Def

b)

B: Define

c)

C: def

d)

D: function

19.

What will be the center of the following shape?

Circle(50 + 50 * 2, 300 / 3 + 100, 50)

a)

(150,200)

b)

(200,200)

c)

(150,100)

d)

(200,250)

20.

Which function statement is correct?

a)

def onMousePress(X, Y):

Circle(X,Y,10, fill='red')

b)

def onMousePress():

Circle(50,40,10, fill='red')

c)

def onMousePress:

Circle(50,40,10, fill='red')

d)

def onMousePress(X,Y)
Circle(X,Y,10,fill='red')

21.

If you forget the colon after the parenthesis in your function definition
what kind of error will you receive?

a)

Function with no parameters

b)

Logical

c)

Stack Trace error

d)

Syntax

22.

What happens when you define a function with no parameters?

a)

You will not receive an error because functions do not have to have parameters.

b)

You will receive a syntax error stating that the parameters are missing.

c)

You will receive a runtime error when the code tries to run the function with no parameters.

d)

You will receive a logical error stating that you have a mismatch of parameters.

23.

In every function, the code must start with....

a)

Def

b)

<functionName>

c)

def

d)

#

24.

True or False? Functions must include a parameter.

a)

True

b)

False

25.

Which symbol indicates division?

a)

/

b)

%

c)

*

d)

^

26.

Which fact about parameters is false?

a)

a) Parameters are optional

b)

b) parameters are input variables of a procedure

c)

c) parameters are the same thing as an argument

d)

d) parameters must have a matching argument when the function is called

27.

in the code "def drawCircle(radius, color):" what is the function name

a)

a. drawCircle

b)

b. radius, color

c)

c. def

d)

d. def drawCircle(radius, color):

28.

What is onMouseMove?

a)

a function that is called when the mouse is released

b)

a function that is called that prints squares where the mouse is pressed

c)

a function that is called when movement of the mouse is detected

d)

a function that is called when the mouse is pressed and held as we move the mouse

29.

Which one is the correct name of a mouse press function?

a)

OnMousePress

b)

mouseWasPressed

c)

MousePress

d)

onMousePress

30.

Are functions and parameters case sensitive?

a)

yes

b)

no

c)

sometimes

31.

Which is the correct format for the function definition?

a)

Def onMousePress(X, Y):

b)

def onMousepress(X, Y):

c)

def onMousePress(X, Y):

d)

def onMousePress(X.Y):

32.

what is the definition of a argument

a)

a global variable that can be called anywhere in the program

b)

variable used in the body of a procedure

c)

the inputted values of the parameter when a procedure is called

33.

How do you use the inspector when using a onMousePress or onMouseRelease function?

a)

1. by hovering over the shapes

b)

2. by looking at the console

c)

3. by pressing down the space bar

d)

4. by pressing the control/ctrl button and hovering over the shapes

34.

Which of the following draws a circle where you click your mouse?

(ignore incorrect indenting)

a)

a. def mouseWasPressed(x, y): Circle(x, y, 20)

b)

b. def onMousePress(mouseX, mouseY):

Circle(mouseX, mouseY, 20)

c)

c. def onMousePress(mouseX, mouseY):

Circle(X, Y, 20)

35.

Which expression could be used to move a shape upwards
when using the function onMousePress?

a)

(x, y+number)

b)

(x, y-number)

c)

c. (x+number, y)

d)

d. (x-number, y)

36.

Fill-in-the-Blank: Arguments must ___ be passed in the same order of parameters.

a)

A. Always

b)

B. Never

c)

C. Sometimes

37.

Which of the following activates something on when you click your mouse

a)

onMouseClick

b)

onMouseDrag

c)

onMouseHold

d)

onMousePress

38.

What can an expression include?

a)

value

b)

Variable

c)

Operator

d)

A procedure call that returns a value

e)

All of the above

39.

A function is the same thing as a procedure.

a)

True

b)

False

40.

What are the arguments in this code

a)

drawSquare

b)

width, height, size, color

c)

50,50,100,'red'

d)

Rect(width,height,size,size,fill=color)

41.

Packets are _____.

a)

Small chunks of information that have been carefully formed from larger chunks of information.

b)

Small packages.

c)

Physical boxes delivered from one computer to another.

d)

None of the above.

42.

A number assigned to any item that is connected to the Internet.

a)

DNS Address

b)

HTTP Address

c)

TCP

d)

IP Address

43.

An easy-to-remember address for calling a web page (like www.code.org).

a)

TCP

b)

HTTP

c)

URL

d)

IP

44.

An easy-to-remember address for calling a web page (like www.code.org).

a)

TCP

b)

HTTP

c)

URL

d)

IP

45.

Having multiple backups to ensure reliability during cases of high usage or failure is __________.

a)

Protocol

b)

Network Redundancy

c)

ASCII

d)

Router

46.

A set of rules governing the exchange or transmission of data between devices.

a)

Protocol

b)

Transfer

c)

Pattern

d)

Phone Call

47.

A way of representing information using only two options.

a)

Binary

b)

Decimal

c)

Hexadecimal

d)

Octal

48.

8 bits

a)

Byte

b)

Nibble

c)

Kilobyte

d)

Megabyte

49.

Error from attempting to represent a number that is too large.

a)

Overflow Error

b)

Roundoff Error

c)

Logic Error

d)

ASCII

50.

This color model uses varying intensities of (R)ed, (G)reen, and (B)lue light added together to reproduce a broad array of colors.

a)

RGB

b)

Hex

c)

ITP

d)

LOC

51.

A process for reducing the number of bits needed to represent something without losing any information. This data compression algorithm allows the original data to be perfectly reconstructed from the compressed data. This process is reversible.

a)

Lossless

b)

Lossy

c)

Tailored

d)

Parallel

52.

A process for reducing the number of bits needed to represent something in which some information is lost or thrown away. This data compression method uses inexact approximations, discarding some data to represent the content. Most commonly seen in image formats like .jpg. This process is not reversible.

a)

Lossless

b)

Lossy

c)

Tailored

d)

Parallel

53.

 It is the exclusive legal right that a creator has to reproduce, publish, sell, or distribute his/her intellectual property (literary, musical, or artistic work).

a)

Intellectual Property

b)

Open Source

c)

Copyright

d)

Creative Commons

54.

how many binary bits are required to store the decimal number 27?

a)

4 bits

b)

5 bits

c)

6 bits

d)

7 bits

55.

An online store uses 6-bit binary sequences to identify each unique item for sale. The store plans to increase the number of items it sells and is considering using 7-bit sequences. Which of the following best describes the result of using 7-bit sequences instead of 6-bit sequences?

a)

2 more items can be uniquely identified.

b)

10 more items can be uniquely identified.

c)

2 times as many items can be uniquely identified.

d)

10 times as many items can be uniquely identified.

56.

What is the best explanation for why digital data is represented in computers in binary?

a)

The binary number system is the only system flexible enough to allow for representing data other than numbers

b)

As a consequence of history: early pioneers of computing were making secret codes in binary, and this simply evolved into modern computing

c)

It's impossible to build a computing machine that uses anything other than binary

d)

It's easier, cheaper, and more reliable to build machines that only have to distinguish between two binary states

57.

The binary number 1001 is equal to what in decimal?

a)

1,001

b)

17

c)

8

d)

9

58.

With 8 bits of data, what is the largest decimal number that can be represented in binary?

a)

256

b)

1111 1111

c)

255

d)

1000 0000

59.

A computer uses 3 bits of data to represent a number. What is the smallest number that would cause an overflow error in this situation?

a)

4

b)

7

c)

8

d)

9

60.

An artist makes an RGB raster image in which each pixel color is encoded with 12-bits --- 4 bits each for red, green and blue.Which of the following correctly shows the hexadecimal value for Red as a 12-bit representation.

a)

F00

b)

00F

c)

FF00

d)

FF0000

61.

How many bits are needed to represent 8 colors?

a)

8 bits

b)

24 bits

c)

1 hex digit

d)

3 bits

62.

Consider the following three binary numbers:

01010

010000

1110

Which of the following lists the numbers in order from least to greatest?

a)

010000

1110

01010


b)

01010

1110

010000


c)

01010

010000

1110


d)

1110

01010

010000