wayground logo

Lembar Kerja Gratis yang Dapat Dicetak

Ukuran huruf

S
M
L
XL
Lembar kerja

Introduction to Python Quiz

Total soal: 52

Worksheet time: 34mins

Nama
Kelas
Tanggal
1.

To output hello world! which would be the correct python line of code

a)

output("Hello World!)

b)

Print("Hello World!)

c)

print("hello world!")

d)

print("hello world")

2.

What is the variable in the code shown

a)

variable

b)

Name

c)

print

d)

name

3.

Pick a syntax error in the code

a)

Capital P for print

b)

Missing brackets

c)

Missing comma

d)

Missing speech marks

4.

What is the output of the following code if raining was entered

a)

Take a brolly!

b)

Have a great day

c)

The code would not run

5.

What is the output of the following code if Raining was entered

a)

Take a brolly!

b)

Have a great day

c)

The code would not run

6.

If you have a syntax error will the code run?

a)

Yes

b)

No

7.
To create a newline at the end of prompt, you can use which of the following expressions?
a)
\new
b)
\n
c)
\break
d)
\return
8.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
9.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
10.
A syntax error means your code has a 'grammar' mistake or you used symbols/operations incorrectly
a)
True
b)
False
11.
What is the name of the programming language we are learning?
a)
Scratch
b)
Python
c)
Pie thin
d)
Scribble
12.

What will be the output?
name = "Dave"
print (name)

a)
Dave
b)
'Dave'
c)
name
d)
(name)
13.
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
14.
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
15.
What would print (10 + 16) produce?
a)
20
b)
22
c)
24
d)
26
16.
What is the answer to print (12/6)?
a)
1
b)
2
c)
6
d)
10
17.
How do you display text?
a)
input
b)
output
c)
print
d)
variable 
18.

What is the name of the site that we use to write programs and then test them out?

a)
Shell
b)
Window
c)

Online Python

d)
CLI
19.
What will the output be from the following code?
print(3+4)
a)
3+4
b)
7
c)
SyntaxError
d)
print(3+4)
20.
What will the output be from the following code?
print("3+4")
a)
7
b)
3+4
c)
34
d)
SyntaxError
21.
What would print (10 + 16) produce?
a)
20
b)
22
c)
24
d)
26
22.
Which Python command is used to output information to the screen?
a)
read
b)
output
c)
print
d)
display
23.

A computer ________________ is a detailed, step-by-step set of instructions telling a computer exactly what to do.

a)

program

b)

algorithm

c)

function

d)

language

24.
What data type is a in this code : a = "5"
a)
integer
b)
float
c)
boolean
d)
string
25.
What does the statement 'print' do?
a)
Output a hard copy of a program to a printer
b)
Output a message on the screen
c)
Print a hard copy of a flowchart to a computer
26.

Which 2 data types have we been using?

a)

String

b)

list

c)

float

d)

Integer

27.

Which line of code would output the following:

a)

b)

c)

d)

28.

What are the 2 rules for creating a variable name?

a)

A variable name cannot start with a number

b)

A variable name must begin with a capital letter

c)

A variable name must not contain any spaces

d)

A variable name must not be more than 5 characters in length

29.

What is the name of the variable in this Python code

a)

name

b)

input

c)

print

d)

("What is your name")

30.

Which of these operators means EQUAL TO?

a)

'='

b)

'=>'

c)

'<='

d)

'=='

31.

What does == mean?

a)

Assign a value to a variable

b)

Nothing, it's an error caused by typing == instead of =

c)

Check that the value on the right of the == matches the value on the left

32.

What can a variable not start with?

a)

A special character

b)

A capital letter

c)

A number

d)

A lower case letter

33.

What is the name of the variable in this program?

a)

print

b)

colour

c)

input

d)

" "

34.

What will this code print?

a)

access denied

b)

access granted

c)

error

d)

password

35.

If the user enters 60, what is the output?

a)

You are old!

b)

You are middle-aged!

c)

You are young!

d)

Error message

36.
What does “==” represent in Python programming?
a)
less than
b)
equal to
c)
greater than
d)
not equal to
37.
Choose the correct Python code.
if age is less than 20 then
a)
if age > 20:
b)
if age < 20:
38.

What symbol must you place at the end of an if statement?

a)

)

b)

:

c)

;

d)

}

39.
Stores a piece of data, and gives it a specific name
a)
variable
b)
whitespace
c)
interpreter
d)
modulus
40.

float, integer, boolean, and string are all examples of what?

a)

Variables

b)

Data Types

c)

Words

d)

Concatenation

41.

Which of the following name will be a good practice if i want to store my age in variable?

a)

Prada

b)

Age

c)

Name

d)

FIFA

42.
What does “==” represent in Python programming?
a)
less than
b)
equal to
c)
greater than
d)
not equal to
43.
Choose the correct Python code.
if age is less than 20 then
a)
if age > 20:
b)
if age < 20:
44.

1==0

a)

True

b)

False

45.

What is an indentation in Python?

a)

A line of code that returns a value

b)

A subroutine

c)

A block of code that creates a variable

d)

A code block (body of a function, loop etc.) starts with indentation and ends with the first unintended line.

46.
Stores a piece of data, and gives it a specific name
a)
variable
b)
whitespace
c)
interpreter
d)
modulus
47.

What is the purpose of the tab key in Python programming?

a)

To save the file

b)

To run the program

c)

To indent a line

d)

To delete a line

48.

What is a definition of SELECTION?

a)

A variable expression

b)

A precise set of step-by-step instructions written in a programming language

c)

When the program checks the conditions and chooses the path based on the outcome

49.

Which condition represents 'X is greater than Y'

a)

X == Y

b)

X > Y

c)

X < Y

50.

Why is there an error in Line 1 of the code?

a)

No brackets

b)

No speech marks

c)

print should be changed to input

d)

Brackets should be square

51.

Why is there an error in line 6 of this Python code?

a)

No speech marks

b)

No brackets

c)

No full stop

d)

No comma

52.

What is the missing instruction?

a)

Print

b)

print

c)

(print)

d)

"Print"