wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

CodeHS Data AP CSP

Total questions: 22

Worksheet time: 21mins

Name
Class
Date
1.

What is stored in variable c?

a)

10

b)

5

c)

15

d)

50

2.

What value is stored in variable B?

a)

1

b)

2

c)

a

d)

3

3.

What is displayed as a result if the user inputs "Karel" to the program?

a)

What is your name? Karel

Hello

Karel

b)

What is your name? Karel

HelloKarel

c)

What is your name? Karel

Hello Karel

d)

Hello Karel

4.

What will display after running the following code?

a)

Welcome!

¡Hola!

¡Hola!

Bonjour!

b)

Welcome! ¡Hola! ¡Hola! Bonjour!

c)

Welcome!

¡Hola!

Welcome!

Bonjour!

d)

Welcome! ¡Hola! Welcome! Bonjour!

5.

What is displayed as a result if the user inputs “P” to the program?

a)

“Enter a character. ” P

“:” “c” P

b)

Enter a character. P

:

c

P

c)

Enter a character. P

: c P

d)

“Enter a character. ” P

“:” “c” symbol

6.

What will the following code segment evaluate to?

a)

29

b)

56

c)

29.0

d)

56.0

7.

What will the following code segment evaluate to?

a)

1

b)

4

c)

2.5

d)

25

8.

What will the following code segment evaluate to?

a)

0

b)

10

c)

-10

d)

-5

9.

What will c evaluate to in the following code segment?

a)

2

b)

3.4

c)

3

d)

5

10.

Suppose we’ve written a function draw_circle that we want to call every time the mouse is clicked. How can we do this?

a)

add_mouse_click_handler(draw_circle(x, y))

b)

add_mouse_click_handler("draw_circle")

c)

add_mouse_click_handler(draw_circle())

d)

add_mouse_click_handler(draw_circle)

11.

What is a callback function?

a)

A function passed to an event handler that is called every time a certain event happens

b)

A function called at the bottom of the program

c)

A function that is never called

d)

A function called every 20 milliseconds

12.

What are the coordinates of the top right corner of the screen?

a)

0, 0

b)

0, get_width()

c)

get_width(), get_height()

d)

get_width(), 0

13.

In the following code, we create a circle and add it to the screen. What is the meaning of the x and y variables?

a)

The position of the center of the circle.

b)

The position of the bottom left of the circle.

c)

The position of the top left of the circle

d)

The radius of the minor and major axis of the oval.

14.

What does the following Python program print?

a)

9

b)

12

c)

15

d)

21

15.

Which of the following operations will output a value of 5?

a)

11 % 6

b)

11/2

c)

float(11)/2

d)

2 + 3 * 2

16.

What function do you need to call to ask the user of the program to enter text?

a)

input

b)

read

c)

text

d)

print

17.

To ask the user of the program for a number, which function should you use?

a)

input

b)

int

c)

text

d)

input inside of a int( ) function

18.

What type is the following variable?


x = "Hi there"

a)

float

b)

interger

c)

boolean

d)

string

19.

What does the following Python program print?

a)

I am 6 feet tall

b)

I am6feet tall

c)

I am

6

feet tall

d)

x

y

z

20.

What is the proper keyword to print to the screen?

a)

write

b)

println

c)

print

d)

output

21.

Which of the following print statements is written correctly?

a)

print “Hello World”

b)

println(“Hello World”)

c)

print(“Hello World”)

d)

print(Hello World)

22.

Which of the following choices is a properly formed Python variable name, meaning it is both legal in the Python language and considered good style?

a)

num_apples

b)

Num_Apples

c)

num_Apples

d)

numApples