Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Intro

Total questions: 50

Worksheet time: 1hrs 15mins

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.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
3.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
4.
When you have an error in your code what is the term to summarise finding and fixing that error?
a)
Error checking
b)
Debugging
c)
Syntax finder
d)
Error finder
5.
The number or word we give to a variable
a)
Value
b)
Bug
c)
Information
d)
Text
6.
What would print (10 + 16) produce?
a)
20
b)
22
c)
24
d)
26
7.
What extension must you add to the end of a file when saving?
a)
.xlsx
b)
.pptx
c)
.docx
d)
.py
8.

What is a correct syntax to output "Hello World" in Python?

a)

print("Hello World")

b)

echo "Hello World"

c)

echo("Hello World");

d)

p("Hello World")

9.

How do you insert COMMENTS in Python code?

a)

//This is a comment

b)

/*This is a comment*/

c)

#This is a comment

10.

Which one is NOT a legal variable name?

a)

_myvar

b)

my_var

c)

Myvar

d)

my-var

11.

How do you create a variable with the numeric value 5?

a)

x = 5

b)

x = int(5)

c)

Both answers are correct

12.

How do you create a variable with the floating number 2.8?

a)

x = 2.8

b)

x = float(2.8)

c)

Both answers are correct

13.

In Python, 'Hello', is the same as "Hello"

a)

False

b)

True

14.

Which operator is used to multiply numbers?

a)

%

b)

#

c)

*

d)

x

15.

How do you start writing an if statement in Python?

a)

if (x > y)

b)

if x > y then:

c)

if x > y:

16.

How do you start writing a while loop in Python?

a)

while x > y:

b)

while (x > y)

c)

while x > y {

d)

x > y while {

17.

Which statement is used to stop a loop?

a)

stop

b)

exit

c)

break

d)

return

18.

Which is the Python logo?

a)
b)
c)
d)
19.
What will the output be from the following code?
print("Hello world!")
a)
SyntaxError
b)
Hello world!
c)
"Hello world!"
d)
print(Hello world!)
20.
What will the output be from the following code?
print("Hello" + "world" + "today")
a)
Helloworldtoday
b)
Hello world today
c)
"Hello" "world" "today"
d)
SyntaxError
21.
What will the output be from the following code?
print("3+4")
a)
7
b)
3+4
c)
34
d)
SyntaxError
22.
Why do we use variables in programming?
a)
edit data
b)
store data
c)
integer
d)
to look good
23.

Gjdk is not a good name for a variable, why?

a)

It starts with a capital letter.

b)

It does not contain any spaces.

c)

There are no vowels.

d)

It's meaningless.

24.
What will be the output?
name = 'Dave'
print (name)
a)
Dave
b)
'Dave'
c)
name
d)
(name)
25.

What is a input?

a)

A function that allows us to ask the user to enter some data.

b)

To plug in something.

c)

Data displayed on a screen.

d)

A function

26.

Which operator checks if a value is equal to another value?

a)

+

b)

=

c)

==

d)

!=

27.

What is the name of the variable in this program?

a)

print

b)

colour

c)

input

d)

" "

28.

a)

1

b)

0

c)

5

29.

___________ is a memory location that stores the data

a)

variable

b)

edit

c)

memory

30.

which of the following type is not supported by Python?

a)

LIst

b)

String

c)

Numbers

31.

the data type of 12.4 is _____

a)

float

b)

str

c)

int

32.

A variable name can consists of alphabets, digits and underscore

a)

true

b)

flase

33.

print() function is used to accept the value of a variable from the user.

a)

False

b)

true

34.

Python keyword cannot be used as a variable name.

a)

true

b)

false

35.

The data type for integers is?

a)

Int

b)

Float

c)

Double

d)

Char

e)

string

36.

Which of the following is a syntax rule in Python?

a)

Must use Tag (<> )

b)

Must use symbol (;) at the end of each script

c)

Case Sensitive

d)

Indentation does not matter

e)

Must use uppercase letters

37.

The symbol # is?

a)

Variable identity

b)

Data type identity

c)

Providing input

d)

Providing comments

e)

Providing commands

38.

What is a character in Python that can be letters, digits, or symbols, starting and ending with quotes?

a)

Statement

b)

Program

c)

String

d)

Syntax

e)

Scratch

39.

What do you know about " " in Python programming? For data type....?

a)

String

b)

Int

c)

Char

d)

Float

e)

Double

40.

What is the data type in Python that can be True (1) or False (0)?

a)

Binary

b)

Hexa

c)

Char

d)

Int

e)

Float

41.

What function is used for looping in Python?

a)

for or while

b)

if or else or elif

c)

arithmetic

d)

choose

e)

lookup

42.

What data structure in Python stores a collection of data in order?

a)

Set

b)

List

c)

Global

d)

True

e)

Dictionary

43.

What does the break command do in a loop?

a)

Continue to the next iteration

b)

Stop the loop

c)

Stop the program

d)

Return a value

e)

Destroy the program

44.

a program that will use a stored decimal value and then convert into an integer and display it

a)

x = 7.8

y = int(x)

print(y)

b)

x = 7.8

y = float(x)

print(y)

c)

x = 7.8

y = int(x)

d)

x = 7.8

y = int(x)

print(x)

45.

Choose the three types of logical operators

a)

and

b)

not

c)

with

d)

or

46.

'5545.2' comes under which data type in Python?

a)

String

b)

Float

c)

Integer

d)

Number

47.

i = 1

while i < 6:

print("i")

i += 1

a)


1
2
3
4
5

b)


1
2
3
4

c)


1
2
3
4
5
6

d)

i

48.

i = 1

while i <6:

print(i)

i += 3

a)

1

4

b)


1
2
3
4

c)


1
3
4

d)

i

49.
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")
50.
What is python?
a)
a programming language 
b)
DTP software 
c)
Spreadsheet software
d)
Computer