Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python

Total questions: 29

Worksheet time: 15hrs 30mins

Name
Class
Date
1.
What is a variable?
a)
A box(memory location) where you store values
b)
a type of graphics
c)
Data type
d)
a type of memory
2.
A syntax error means your code has a 'grammar' mistake or you used symbols/operations incorrectly
a)
True
b)
False
3.
Which statement correctly assigns the string "Tanner" to the variable name?
a)
name  = print( "Tanner")
b)
input("Tanner")
c)
name = "Tanner"
d)
name = input("Tanner")
4.
What does the print function do in python?
a)
It's a variable.
b)
It can input data.
c)

It displays an output

d)
It loops the code.
5.
In python the ' STRING data type' can be defined as...?
a)
holds alphanumeric text
b)
hold whole numbers
c)
holds numbers with a decimal point
d)
holds either a true or false value
6.
In python the ' BOOLEAN data type' can be defined as...?
a)
holds alphanumerical data
b)
holds whole numbers
c)
holds a number with a decimal point
d)
holds either true or false
7.
what is correct code for INTEGER in python?
a)
in
b)
ing
c)
int
8.

Какую логическую операцию нужно добавить в программу вместо многоточия, чтобы значение переменной «a» после выполнения фрагмента программы стало равно 3?

a = 10

b = 5

if a > 1 ... a < b:

a = a - 7

else:

a = a + 7

(a)  

9.

. 

Определите значение переменной a после выполнения алгоритма:

a = 4

b = 6

b = 8 + a* b

a = b / 4 *a

В ответе укажите одно целое число – значение переменной a.

(a)  

10.

Чему будет равна переменная «c» после выполнения этой программы:

a = 28

b = 7

c = a % b + b

(a)  

11.

Чему будет равна переменная «c» после выполнения этой программы:

a = 22

b = 4

c = a // b + a

(a)  

12.

 

Чему будет равна переменная «c» после выполнения этой программы:

a = 20

b = 3

b = a // b

c = a % (b + 1)

(a)  

13.

Выберите правильную запись присвоения переменной A значения, введенного с клавиатуры..

a)

А=input()

b)

A:=input()

c)

A=int(input())

d)

A=print()

14.
What will the output be from the following code?
print("Hello world!\nHello world!")
a)
Hello world! Hello world!
b)
Hello world!
Hello world!
c)
SyntaxError
d)
Hello world!
15.
What will the output be from the following code?
print("Hello" + str(2) + "world!")
a)
Hello world! Hello world!
b)
Hello2world!
c)
Hello Hello world! world!
d)
SyntaxError
16.
What is syntax?
a)
Syntax is the word used to describe an error
b)
Syntax is the rules of the programming language
c)
It is used to read information
d)
It is used to output information 
17.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
18.
What will the output be from the following code?
print("Hello world!" * 2)
a)
TypeError
b)
Hello world world!
c)
Hello world!Hello world!
d)
Hello world! * 2
19.

people = ["John", "Rob", "Bob"]

print (people[1])

what would this result be?

a)
John
b)
Rob
c)
Bob
20.

people = ["John", "Rob", "Bob"]

print (people[-1])

what would this result be?

a)
John
b)
Rob
c)
Bob
21.

people = ["John", "Rob", "Bob"]

print (people[4])

what would this result be?

a)
John
b)
Rob
c)
Bob
d)
Error
22.

What Is The Output Of The Following Code Snippet?


def func(message, num = 1):

print(message * num)


func('Welcome')

func('Viewers', 3)

a)

Welcome

Viewers

b)

Welcome

ViewersViewersViewers

c)

Welcome

Viewers,Viewers,Viewers

d)

Welcome

23.

What is the index of the name 'Paula' in the following list:

names = ["Paul","Phillip","Paula","Phillipa"]

a)

0

b)

1

c)

2

d)

3

24.

The result of this program:

Friday = False

if Friday:

print "Jeans day!"

else:

print "Uniform day"

a)

Jeans day

b)

Today is Friday

c)

Uniform day

d)

Not Friday

25.

What is the output?

a)

True

b)

False

c)

condition1

d)

condition2

26.

Extension of Python

a)

py

b)

.py

c)

.PYS

d)

.PYE

27.

What is the output of the following code?


var1 = 1

var2 = 2

var3 = "3"


print(var + var2 + var3)

a)

6

b)

33

c)

133

d)

Error. Mixing operators between numbers and strings are not supported

28.

19 % 2 in python

a)

1

b)

2

c)

9

d)

None of these

29.

Which of the following operators is the correct option for power(ab)?

a)

a ^ b

b)

a**b

c)

a^^b

d)

a ^ * b