wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

FUNDAMENTAL in PROGRAMMING

Total questions: 52

Worksheet time: 39mins

Name
Class
Date
1.

Is python an interpreter or compiler programming language?

a)

Compiler

b)

Interpreter

2.

Python uses indentation to block code into chunks

a)

True

b)

False

3.

Python correct naming convention for constants is?

a)

firstName

b)

First_Name

c)

FIRST_NAME

d)

firstname

4.

Python correct naming convention for variables is?

a)

new_user25

b)

NewUser25

c)

25_new_user

d)

25NewUser

e)

NEWUSER25

5.
The number or word we give to a variable
a)
Value
b)
Bug
c)
Information
d)
Text
6.

What is the Python built-in function used to display numbers and text on the screen?

a)

print

b)

input

c)

output

d)

command

7.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
8.
What extension must you add to the end of a file when saving?
a)
.xlsx
b)
.pptx
c)
.docx
d)
.py
9.

If you want to create an empty list called colours in Python, which of the following is correct?

a)

colours = [ ]

b)

colours = ( )

c)

colours = { }

d)

colours = <>

10.
What output will this code produce?
a)
4
b)
2
c)
3
d)
5
11.

What will the output be from the following Python code?

print(Hello world!)

a)

Hello world!

b)

SyntaxError

c)

Hello world

d)

print(Hello world!)

12.
print("12"*3)
What would this print?
a)
36
b)
121212
c)
24
d)
12*3
13.

What is the Python built-in function to converts a number to a string?

a)

str()

b)

int()

c)

parseInt()

d)

convert

14.

Which of these is correct Python conditional statement?

a)

IF answer == "Yes":

b)

if answer == "Yes"

c)

if answer == "Yes":

d)

if answer = "yes":

15.
Returns the remainder from division
a)
modulus
b)
exponents
c)
boolean
d)
variables
16.
Surrounds multi-line comments
a)
"""
b)
**
c)
#
d)
%
17.
A line of text that Python won't try to run as code
a)
comment
b)
modulus
c)
variable
d)
boolean
18.
Symbol used for modulus
a)
%
b)
&
c)
#
d)
**
19.
A data type than can have one of two values: True or False
a)
boolean
b)
variable
c)
modulus
d)
interpreter
20.
10= 100
Which of the following is used in Python to calculate ten squared?
a)
10 ** 2
b)
10 * 2
c)
10 % 2
d)
10 ** 10
21.
To solve a problem that requires the user to enter 10 numbers would use what type of iteration?
a)
While loop
b)
For loop
c)
Variable
d)
Selection
22.
A data type consisting of numbers, letters and symbols.
a)
String
b)
Integer
c)
Float
d)
Boolean
23.
Code executed based on a condition being true
a)
Sequence
b)
Selection
c)
Iteration
d)
Variable
24.

Which python operator means 'less than or equal to'?

a)

>=

b)

>

c)

<

d)

<=

25.

What is the value of the expression 100 / 25?

a)

4

b)

4.0

c)

"4.0"

d)

'4.0'

26.

What is the output of the following code :


print 9//2

a)

4.5

b)

4.0

c)

4

d)

3

27.

Which is the correct operator for power(x^y)?

a)

X^y

b)

X**y

c)

X^^y

d)

None of the mentioned

28.

Which one of these is floor division?

a)

/

b)

//

c)

%

d)

None of the mentioned

29.

What is the answer of this expression, 22 % 3 is?

a)

7

b)

1

c)

0

d)

5

30.

x = 4.5

y = 2

print(x//y)

a)

2.0

b)

2

c)

9

d)

9.0

31.

x = 5


print(x > 3 and x < 10)

a)

True

b)

False

32.
This operator means that one value is the same as the other value
a)
==
b)
!=
c)
>
d)
<
33.
This operator means that one value is not equal to another value
a)
==
b)
<=
c)
>=
d)
!=
34.

What is the output?

a)

condition

b)

True

c)

Program has a syntax error.

d)

3 > 2

35.

What is the output?

a)

more than 7

b)

more than 23

c)

spam

d)

7

36.

What is the output?

a)

250.0

b)

200.0

c)

300.0

d)

350.0

37.

What is the output?

a)

next

stop

b)

next

c)

stop

d)

syntax error - program doesn't work

38.

What is the output?

a)

3

b)

3

7

c)

3

5

7

d)

7

39.

What is the output?

a)

level 3

b)

level 3

level 1

c)

level 3

level 1

NIL

d)

level 3

level 2

level 1

NIL

40.

Given the nested if-else below, what will be the value x when the code is executed successfully.

a)

0

b)

4

c)

2

d)

3

41.

Which condition is a logic error (will not run properly)?

a)

x>=1 AND x<=100

b)

1<=x<=100

c)

1>x>100

d)

x<1 OR x>100

42.
To repeat a fixed number of times use a
a)
while loop
b)
for loop
c)
if loop
d)
indentation
43.
The character that must be at the end of the line for if, while, for etc.
a)
:
b)
;
c)
.
d)
,
44.
Converts a number to a string
a)
str()
b)
int()
c)
parseInt()
d)
convert
45.
Python identifies blocks of code by
a)
BEGIN and END keywords
b)
{ and }
c)
aligning up the starts of lines (indentation)
d)
guessing
46.

In a Python program, what would be the ending value of total in the WHILE LOOP code?

a)

0

b)

5

c)

2

d)

20

47.

In a Python program, what would be the ending value for y in the WHILE LOOP code?

a)

5

b)

51

c)

10

d)

3

48.
In programming, what is iteration?
a)
The repetition of steps within a program
b)
The order in which instructions are carried out
c)
A decision point in a program
d)
Testing a program to make sure it works
49.

What will this code do?

a)

Print Numbers 1-11

b)

Print Numbers 1-10

c)

Print Numbers 2-10

d)

Print Error

50.

What will be the output of this code?

a)

1,2,3,4,5,6,7,8,9,10,11,12

b)

0,2,4,6,8,10

c)

2,4,6,8,10,12

d)

2,4,6,8,10

51.

Look at the following code, what will it generate

a)

1,2,3,4,5,6,7,8,9,10,11,12

b)

0,1,2,3,4,5,6,7,8,9,10,11,12

c)

1,2,3,4,5,6,7,8,9,10,11,12,13

d)

0,1,2,3,4,5,6,7,8,9,10,11,12,13

52.

what is the name of the variable used in the following code?

a)

counter

b)

print

c)

for

d)

#