wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Programming Reviewer by MEDS

Total questions: 50

Worksheet time: 33mins

Name
Class
Date
1.

Which of these will be stored as a float?

a)

"hello"

b)

143

c)

8.4

d)

True

2.

Fill in the blank to output 5 raised to the 3rd power.

print (5__3)

a)

/*

b)

**

c)

^

d)

*

3.

Fill in the blank to take user input, assign it to a variable, and output it:

text=___

print(___)

a)

input(), user

b)

text, input()

c)

user, input()

d)

input(), text

4.

Fill in the blanks to prompt the user with a message and assign the input to the variable “name”:

___=___(“___”)

a)

input, name, “What is your Name?”

b)

“What is your Name?, name, input

c)

name, input, “What is your Name?”

d)

name, “What is your Name?, input

5.

What are the two Boolean values in Python?

a)

Yes and No

b)

True and False

c)

true and false

d)

Truth and Dare

6.

It is a loop use for two dimensional value of data.

a)

For loop

b)

While loop

c)

Nested for loop

d)

All of the Above

7.

What’s the result of this code?

x=“a”

x*=3

print(x)

a)

a3

b)

aaa

c)

3aaa

d)

aaa3

8.

Simplest form of structure in programming, since the flow of the program is linear.

a)

Repetition Control Structure

b)

Selection Control Structure

c)

Iterative Control Structure

d)

Sequential Control Structure

9.

Fill in the blanks to produce a valid code, which takes the values of the x and y variables from the input and outputs their sum.

=___(__(__))

a)

Input, int, y

b)

Input, double, x

c)

Int, input, y

d)

Int, y, input

10.

Which line of code will cause an error?

a)

Line 4.

b)

Line 3

c)

Line 2

d)

Line 1

11.

Is a table-like series of elements which is the best representation for matrices or any form of tabular elements.

a)

2D List

b)

Multi List

c)

One Dimensional Array

d)

Stack

12.

What is the output of this code?

print((4+8)/2)

a)

6

b)

6.0

c)

“6”

d)

“6.0”

13.

What is the output?

from array import *

arr1 = array(‘I’, [1,2,3,4,5])

print (arr1[0])

print (arr1[2])

a)

1 and 2

b)

1 and 3

c)

2 and 3

d)

1 and 4

14.

What is the output?

from array import *

arr1 = array(‘I’, [1,2,3,4,5])

arr1.insert(1,6)

for x in arr1:

print(x)

a)

1,6,2,3,4,5

b)

1,2,6,3,4,5

c)

1,2,3,6,4,5

d)

1,2,3,4,6,5

15.

The given python code is an example of

a)

Sequential Control

b)

Selection Control

c)

Sequential Control

d)

Decision Control

16.

What’s the output of this code?

spam = “eggs”

print(spam*3)

a)

eggseggseggs

b)

spamspamspam

c)

“eggseggseggs”

d)

“spamspamspam”

17.

What is the output of this code?

print( 8 ** (1/3) )

a)

3.0

b)

2.0

c)

3

d)

2

18.

What’s the output of this code?

print(7 != 8)

a)

True

b)

False

c)

0

d)

1

19.

What is the output of this code?

print(1 + 2 + 3 + 4.0 + 5)

a)

15

b)

15.0

c)

“15”

d)

“15.0”

20.

What is the correct answer to output 12?

x = 5

y = __

print(x+y)

a)

7

b)

=7

c)

“7”

d)

‘7’

21.

What is the output of this code?

x=4

x*=3

print(x)

a)

12

b)

12.0

c)

“12”

d)

“12.0”

22.

Which of these is a valid variable name in Python?

a)

a-variable%name

b)

123

c)

A_VARIABLE_NAME

d)

While

23.

What part of an if statement should be indented?

a)

All of it

b)

The statements within it

c)

The first line

d)

There is no indention

24.

What will be the output of this code?

x= “2”

y= “4”

z=int(x)+int(y)

print(z)

a)

6

b)

6.0

c)

“6”

d)

“6.0”

25.

Fill in the blanks.

letters = [‘a’,’b’,’z’]

_ “z” _ letters:

print(“yes”)

(a)  

26.

What will be the output?

a)

A

b)

B

c)

C

d)

D

27.

What will be the output?

a)

A

b)

B

c)

C

d)

D

28.

A shorter option for an “else if” statement is:

(a)  

29.

What's the output of this code?

(a)  

30.

What's the output of this code?

(a)  

31.

What's the result of this code?

(a)  

32.

Fill in the blank.

(a)  

33.

What's the result of this code?

(a)  

34.

Fill in the blanks to print "Welcome"

(a)  

35.

Fill in the blank to create a loop that increments the value of x by 2 and print the even values.

(a)  

36.

If rc="5". What is the output?

(a)  

37.

What is the output?

(a)  

38.

What is the output of the given code?

(a)  

39.

What is the output of the given code?

(a)  

40.

What is the output of the given code?

(a)  

41.

Fill in the blanks.

(a)  

42.

Fill in the blanks.

(a)  

43.

What's the result of this code?

nums=[5,4,3,2,1]

print(nums[1])

a)

5

b)

4

c)

3

d)

2

e)

1

44.

What's the output of this code?

x=[2,4]

y=[2,4,6]

print(x[1]/y[0])

a)

2

b)

2.0

c)

4

d)

4.0

45.

What is the output of the code.

a=[1,2,3]

b=[2,4,6]

print(b+a)

a)

[1,2,3,4,6]

b)

[1,2,3,2,4,6]

c)

[2,4,6,1,2,3]

d)

[2,4,6,1,3]

46.

What is the output of this code.

nums=[10,9,8,7,6,5]

nums[0]=nums[1]-5

if 4 in nums:

print(nums[3])

else:

print(nums[4])

a)

5

b)

6

c)

7

d)

8

47.

is a free-hand drawing that is used to create shapes, pictures or images by providing the user a virtual canvas.

a)

Tkinter

b)

Turtle

48.

It is a standard GUI (Graphical User Interface) of python that creates different gui like checkbox, canvas or button using the widget.

a)

Tkinter

b)

Turtle

49.

is a data structure consisting of related data items of the name and the same data type.

a)

Array

b)

Python

c)

Turtle

d)

List

50.

is a collection of data of either the same or different data types, it is use in data structure that is a mutable, or changeable, ordered sequence of elements.

a)

Array

b)

Python

c)

Turtle

d)

List