wayground logo

Lembar Kerja Gratis yang Dapat Dicetak

Ukuran huruf

S
M
L
XL
Lembar kerja

Python Programming

Total soal: 40

Worksheet time: 14mins

Nama
Kelas
Tanggal
1.

Which has integer data type?

a)

Phone number

b)

Zip code

c)

HN

d)

Number of students in the class

2.

There are 40 students in a classroom. We would like to get all students whose name starts with "A". Which looping is suitable?

a)

For loop

b)

While loop

3.

You are in the car with traffic jammed at a junction. To cross that junction according to the traffic rules, which one is NOT applicable

a)

While loop

b)

Conditional Statement

c)

For loop

4.

What is a folder?

a)

the name given to a set of recorded information

b)

the name given to the place where files that can be bought

c)

the name given to the place where files that can be stolen

d)

the name given to the place where files that can be stored

5.

Which of the following types of computer languages uses binary code to communicate with the computer?

a)

High-level languages

b)

Assembly languages

c)

Machine language

d)

Database languages

6.

What are the names of the two types of mode that are used in Python? Select two.

a)

Interactive mode

b)

Scratch mode

c)

Imperial mode

d)

Script mode

7.

What is the name of this symbol (>>>)?

a)

Chevrons

b)

Hash tags

c)

Colon

d)

Semi Colon

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

Python is _____ sensitive which means you must use the same indentation every time.

a)

space

b)

colour

c)

code

d)

word

12.
What button do you press to compile (run) your program so that it runs in the shell?
a)
F3
b)
F5
c)
F7
d)
F9
13.
What will the output be from the following code?
print(3*4+5)
a)
27
b)
17
c)
12
d)
SyntaxError
14.
What is the correct definition for a VARIABLE?
a)
a changeable value, such as a score in a computer game.
b)
a value that cannot be changed
15.

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

a)

True

b)

False

16.
what are the advantages of python?
a)
free and open source 
b)
can do the work for you 
c)
easy 
17.
what is 8%2
a)
0
b)
16
c)
24
d)
86
18.
What will be the output?
name = 'Dave'
print (name)
a)
Dave
b)
'Dave'
c)
name
d)
(name)
19.
What will be the output?
name = 'Dave'
greeting = "Good morning" + name
print (greeting)
a)
Good moning 'Dave'
b)
Good morning Dave
c)
Good morning name
d)
Good morning + Dave
20.
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 
21.
Code executed based on a condition being true
a)
Sequence
b)
Selection
c)
Iteration
d)
Variable
22.
Code repeated / looped until a condition has been met or a set number of times.
a)
Sequence
b)
Selection
c)
Iteration
d)
Variable
23.

What does the following code do? myAge = int (myAge)

a)

Converts the var (variable) myAge to a string

b)

Converts the var (variable) myAge to a integer

c)

Converts the var (variable) myAge from a integer to a string

d)

Converts the var (variable) myAge to if statement

24.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
25.
Python identifies blocks of code by
a)
BEGIN and END keywords
b)
{ and }
c)
aligning up the starts of lines (indentation)
d)
guessing
26.
Joining elements together to make a string is called what?
a)
Combining
b)
Connecting
c)
Concatenation
d)
Stringing
27.
If you want more than one option for your code, what do you use (after if)?
a)
elif
b)
else
c)
ifif
28.
Which python operator means 'less than or equal to'?
a)
>
b)
<
c)
>=
d)
<=
29.
What is another word for 'iteration'?
a)
Selection
b)
Variable Assignment
c)
Repetition
d)
Sequencing
30.
How many times will this loop run?
a)
10
b)
9
c)
4
d)
5
31.
I want to allow the program to repeatedly ask the user to enter their guess if it does not equal the answer...Which option do I use?
a)
while guess == answer:
    guess=input()
b)
while answer != guess:
guess=input()
c)
while answer =! guess:
guess=input()
d)
while guess != answer:
guess=input()
32.

Which word completes this sentence: "Iteration makes code more ___________"

a)

Complex

b)

Efficient

c)

Simple

d)

Straightforward

33.

A FOR loop is....

a)

A COUNT controlled loop

b)

A CONDITION controlled loop

34.

A WHILE loop is....

a)

A COUNT controlled loop

b)

A CONDITION controlled loop

35.

What will the output be for the code shown here?

a)

3,2,1,0

b)

0,1,2,3

c)

3,2,1

d)

1,2,3

36.

What would the output be for the code shown here?

a)

0,1,2,3,4,5,6,7,8,9

b)

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

c)

0,2,4,6,8,10

d)

0,2,4,6,8

37.

Anil is writing a "rock, scissors, paper" program. He wants the game to repeat until the user doesn't want to play anymore. What loop should he use?

a)

a FOR loop

b)

a WHILE loop

38.

Clara is writing a program that will print out the first ten numbers of a times table (chosen by the user). Should she use....

a)

a FOR loop

b)

a WHILE loop

39.

Tara has written a "Hide and Seek Simulator" - what will happen when she runs it?

a)

It will print "1,2,3,4,5,6,7,8,9,10 Coming ready or not!"

b)

The program will not run

c)

It will print "1,2,3,4,5,6,7,8,9,11 Coming ready or not!"

d)

It will print ("10 Coming ready or not!")

40.
The character that must be at the end of the line for if, while, for etc.
a)
:
b)
;
c)
.
d)
,