wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Grok- Python Quiz

Total questions: 27

Worksheet time: 27mins

Name
Class
Date
1.

Correct Python Code View for Hello, World! is?

a)

Print ('hello, World!')

b)

print ('Hello, World!')

c)

Print (“hello, world!”)

d)

print (Hello World)

2.

Correct Python Code View of What is your name? is?

a)

name = input(“what is your name? ')

b)

name = input('What is your name.)

c)

name = input('What is your name? ')

d)

name=input('What is your name? ')

3.

Correct Python Code View of Hello, Mia is?

a)

print('Hello,', name)

b)

pRint('Hello,', name)

c)

print('Hello,', NAME)

d)

print ('HelloName’)

4.

Correct Python Output View of:


print ("So you call yourself '" + name + "' huh?")

a)

So you call yourself 'Rory' huh?

b)

So You call your self 'Rory' huh?

c)

So you call yourself 'Rory' Huh”

d)

So you call yourself 'Rory' HUH?”

5.

Friend1 = input("Friend: ")

print ("Hello, young " + Friend1)


output view is:

a)

Friend: Trever

Hello, young Trever

b)

friend: Trever

hello, young Trever

c)

Friend Trever

Hello young Trever

d)

FriendTrever

Hello, young Trever

6.

text = input('Enter text: ')

print(len(text))


is an example of:

a)

Enter text: hi

2

b)

Enter text: BOO

4

c)

Enter text: Hello

10

d)

Enter TEXT: Hiiii

2

7.

word = input('What do you want me to say? ')

num = int(input('How many times do you want me to say it? '))

print (word * num)


an example is:

a)

What do you want me to say? Hi

How many times do you want me to say it? 2

HiHi

b)

What do you want me to say? HI

How many times do you want me to say it? 1

HIHIHI

c)

What do you want me to do?

How many times do you want me to say it? 1

8.

What does the term 'debug' mean?

a)

Identify errors and fix them.

b)

Making a calculation

c)

A set of instructions

d)

Looking at code

9.

What does the print function do in python?

a)

It's a variable.

b)

It can input data.

c)

It displays something like a string or integer

d)

It loops

10.

What will the output be from the following code?

print(Hello world!)

a)

Hello world!

b)

SyntaxError

c)

Hello world

d)

print(Hello world!)

11.

What will the output be from the following code?

print(3+4)

a)

3+4

b)

SyntaxError

c)

7

d)

print(3+4)

12.

What will the output be from the following code?

print("3+4")

a)

7

b)

34

c)

SyntaxError

d)

3+4

13.

What will the output be from the following code?

print("Hello" + "world!")

a)

Hello world!

b)

Helloworld!

c)

SyntaxError

d)

"Hello" "world!"

14.

Which Python command is used to output information to the screen?

a)

read

b)

output

c)

print

d)

display

15.

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

16.

A syntax error means your code has a 'grammar' mistake or you used symbols/operations incorrectly

a)

True

b)

False

17.

What will be the output?

name = 'Dave'

print (name)

a)

Dave

b)

'Dave'

c)

name

d)

(name)

18.

What will be the output?

name = 'Dave'

greeting = "Good morning" + name

print (greeting)

a)

Good morning + Dave

b)

Good morning name

c)

Good morning Dave

d)

Good morning 'Dave'

19.

Why is it called 'Python'?

a)

The guy who created it loves snakes

b)

The guy who created it loves Monty Python films

c)

You can create a game on python called snake

d)

It was created by someone called Mr Python

20.

Python is an example of a....

a)

Text-based programming language

b)

Object orientated programming language

c)

language written in java script

d)

Visual-based programming language

21.

If you want more than one option for your code, what do you use (after if)?

a)

elif

b)

else

c)

ifif

d)

after this/

22.

Data type that can only be true or false

a)

string

b)

Integer

c)

boolean

d)

float

23.

A data type consisting of numbers, letters and symbols.

a)

String

b)

Integer

c)

Float

d)

Boolean

24.

A location in memory used to store data that can be changed.

a)

Constant

b)

Value

c)

Variable

d)

Iteration

25.

A variable that can hold a collection of values, often called an array in other programming languages

a)

list

b)

int

c)

string

d)

constant

26.

What does the print function do in python?

a)

It's a variable

b)

It can input data.

c)

It displays something like a string or integer

d)

It loops the code.

27.

What programs can you learn Python through?

a)

Grok / CodeCademy

b)

Word / Grok

c)

Scratch / Microsoft