wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Fundamentals 1

Total questions: 22

Worksheet time: 13mins

Name
Class
Date
1.

What symbols are Logical Operators?

a)

AND, OR, NOT

b)

=, +=, -=

c)

>=,==,<=,!=

2.

All the rules of Variable names are true EXCEPT:

a)

Cannot Begin with Capital letters

b)

Can Begin with a Letter

c)

Cannot have a spaces in between

d)

All of the Above

3.

Which if statements are incorrect?

a)

if a==a:

b)

if a = b:

c)

if a not in b

d)

if input() = b:

e)

else a != b:

4.

A function is used to store lines of code to be called later.

a)

True

b)

False

5.

A student tried to run a an if statement that was empty. The expected result was:

a)

The script ran without error

b)

The script ran but didn't print anything

c)

The script did not run

d)

The script was ignored

6.

<=,==,>,< are known as:

a)

Arithmetic Operators

b)

Assignment Operators

c)

Comparison Operators

d)

Logical Operators

7.

A function can be executed if:

a)
it is commented out in the code
b)

it is defined

c)

it is called at another part of the program

d)
it is written in a different programming language
8.

"name()" is the keyword of any function:

a)

True

b)

False

9.

If an if statement's conditions are not met, it will:

a)
Not execute the code block
b)
Execute the code block
c)
Print an error message
10.

What is the output of this Script?

a)

'They are not the same'

b)

a = b

c)

Syntax error

d)

elif code block is executed

e)

None of the above

11.

What does this button do in VsCode?

a)

Opens the Terminal

b)

Run and Debug a script

c)

Cleans errors

d)

Checks for viruses

12.

What is this called?

a)

Ribbon

b)

Task Bar

c)

Tabs

d)

Window

13.

A (a)   is the joining of multiple strings.

14.

What kind of software can be used to run and write a script?

a)

Integrated Development Environment (IDE)

b)

Compiler

c)

Text editor

d)

Python

15.

" a = Int(input())" ensures that:

a)
a is being assigned the value of an integer input.
b)

a is being assigned the value of a float input.

c)

a is being assigned "int(input())"

d)

a is being assigned the value of an input.

16.

print("123"+123) outputs:

a)
123123
b)
246
c)

123 123

d)
TypeError
17.

What is the purpose of '' ** '' in python?

a)
Perform exponentiation
b)

Perform Multiplication

c)

Perform Division

d)

Creates a Comment

18.

This is a collection of similar values.

a)

Variable

b)

Container

c)

Object

d)
Set
19.

All of the following is true about string formatting in python except:

a)

String formatting in python is possible using the f operator

b)
String formatting allows for inserting variables into a string
c)

String formatting allows for expressions to be inserted into a string

d)

All of the above

20.

FOR and WHILE are examples of Loops

a)
False
b)
True
21.

What is the output of this script?

a)

H

b)

E

c)

L

d)

L

e)

O

22.

What is a Variable?

a)

A storage location in a computer program

b)

A value in a line of code

c)

A variable is a type of value