wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Pre-Test Praktikum

Total questions: 50

Worksheet time: 24mins

Name
Class
Date
1.

Yang manakah yang merupakan code untuk menambahkan comment dalam python?

a)

//

b)

#

c)

<comment>!

d)

/*

2.

Apakah python perlu menggunakan tanda titik koma (;) pada akhir codenya?

a)

Ya

b)

Tidak

3.

Yang manakah file python?

a)

.ptn

b)

.pyt

c)

.pytn

d)

.py

4.

Type data yang menunjukan sebuah bilangan desimal adalah ...

a)

string

b)

float

c)

int

d)

bool

5.
In Python indexes start at 
a)
1
b)
0
6.
If there is " " this means that it is a 
a)
string
b)
variable
7.
3 % 2 will return
a)
1
b)
3%
8.
To make an exponent in Python, the code is 
a)
10**2
b)
10^2
9.
To comment out multiple lines use
a)
"""
b)
#
10.
Stores a piece of data, and gives it a specific name
a)
variable
b)
whitespace
c)
interpreter
d)
modulus
11.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
12.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
13.

What will be the output?

name = "Dave"

print (name)

a)

Dave

b)

'Dave'

c)

name

d)

(name)

14.

If you want to create an empty list called colours in Python, which of the following is correct?

a)

colours = [ ]

b)

colours = ( )

c)

colours = { }

d)

colours = <>

15.
What letter will be printed on the screen after running this code:
a)
e
b)
x
c)
t
d)
Nothing prints
16.
What is the position of the name "Robert" in the following list:
a)
0
b)
1
c)
2
d)
3
17.
In the following code, "city" is an example of a what?
a)
List
b)
Loop
c)
Variable
d)
Array
18.

What will the output be from the following code?

print(3+4)

a)

3+4

b)

7

c)

SyntaxError

d)

print(3+4)

19.
print("12"*3)
What would this print?
a)
36
b)
121212
c)
24
d)
12*3
20.

What will the output be from the following Python code?

Print("Hello world!")

a)

NameError

b)

Hello world!

c)

"Hello world"

d)

Print(Hello world!)

21.

What will the output be from the following Python code?

print(Hello world!)

a)

Hello world!

b)

SyntaxError

c)

Hello world

d)

print(Hello world!)

22.

What is the Python built-in function to converts a number to a string?

a)

str()

b)

int()

c)

parseInt()

d)

convert

23.

Which of these is correct Python conditional statement?

a)

IF answer == "Yes":

b)

if answer == "Yes"

c)

if answer == "Yes":

d)

if answer = "yes":

24.
What output will this code produce?
a)
Exeter
b)
4
c)
6
d)
city
25.

What is a Count-Controlled loop?

a)

for loop

b)

while loop

26.

A count controlled loop will..

a)

Repeat code until a condition is met

b)

Repeat code a specific amount of times

c)

Repeat code a random amount of times

d)

None of the above

27.

Which of these is NOT a loop in python?

a)

for loop

b)

while loop

c)

nested loop

d)

if loop

28.

Which of these operators means EQUAL TO?

a)

'='

b)

'=>'

c)

'<='

d)

'=='

29.
Look at this code, what is the variable? 
a)
0
b)
4
c)
for
d)
i
30.
In Python, a subroutine, function or procedure is created by using which key word?
a)
sub
b)
fun
c)
def
d)
pro
31.

What is a list in python?

a)

A collection of variables

b)

A collection of items assigned to a single variable

c)

A statement that cant be changed

d)

A Christmas list

32.

Which of these codes is correct for creating a list of numbers?

a)

num = ('10','29','37','109')

b)

num = ['10','29','37','109']

c)

num == ('10','29','37','109')

d)

num = ['10 29 37 109']

33.

What is the index number for 'Spain'?

['England','Brazil','Spain','France']

a)

0

b)

1

c)

2

d)

3

34.

How do i remove something from a list?

a)

variable.append()

b)

variable.delete()

c)

variable.remove()

d)

variable=(new variable)

35.

What is used to separate elements in a list?

a)

Bracket

b)

Comma

c)

Full Stop

d)

Space

36.

variable.sort() will do what?

a)

Sort the list into alphabetical order

b)

Sort the list into reverse order

c)

Create a new list

d)

Error

37.
The second part of if, that is executed when the condition is false
a)
if
b)
else
c)
for
d)
input
38.
symbol used for modulo
a)
%
b)
&
c)
#
d)
**
39.
10= 100
Which of the following is used in Python to calculate ten squared?
a)
10 ** 2
b)
10 * 2
c)
10 % 2
d)
10 ** 10
40.

1. Examples for list data type

a)

[1,2,3,4,5]

b)

['S','H','R','U','T','H','I']

c)

{1:"a",2:"b",3:"c",7:"d"}

d)

('A','B','C','D')

41.

What’s the main difference between Python lists and tuples?

a)

Lists can hold any data type and tuples can only contain int and str objects.

b)

Lists are immutable and tuples are mutable.

c)

Lists are mutable and tuples are immutable.

d)

Lists are faster and tuples are slower.

Check Your Answer »

42.

kata = "SWEforML"

print(kata[-4:])

a)

forM

b)

SWEf

c)

orML

d)

Efor

43.

Apa output dari kode program berikut?

print("Hello" + str(2) + "world!")

a)

Hello world! Hello world!

b)

Hello Hello world! world!

c)

Hello2world!

d)

SyntaxError

44.

perhatikan program dibawah ini :


list1 = ['fisika', 'kimia', 1993, 2017]

print ("list1[0]: ", list1[0])


jika di run akan menghasilkan...

a)

list1[0]: fisika

b)

list1[0]: kimia

c)

list1[0]: 1993

d)

list1[0]: 2017

45.

Simbol yang digunakan pada tipe data Tuple adalah...

a)

[ ]

b)

( )

c)

{ }

d)

{ } dan [ ]

46.

Jika kita ingin menulis lebih dari satu statement dalam satu baris pada bahasa Python, maka kita harus memisahkan antar statementnya dengan menggunakan tanda

a)

Pagar

b)

Spasi

c)

Koma

d)

Titik-Koma

e)

Petik

47.

dictionary dapat dibuat dengan menggunakan tanda ...

a)

kurung siku / [ ]

b)

kurung kurawal / { }

c)

kurung < >

d)

kurung ( )

48.

Berdasarkan kode berikut:

bil1 = 5

bil2 = bil1 % 2

bil1 *= bil2

print(bil1)

a)

0

b)

1

c)

5

d)

10

49.

Untuk kode di bawah ini, Python akan menampilkan pesan:

bilangan = (5 % 3 ** 2) + (3 + 2 * 2) * (4 - 2)

print(bilangan)

a)

28

b)

26

c)

19

d)

30

50.

for a in range(4)

print(a)

outputnya adalah

a)

1 2 3 4

b)

0 1 2 3

c)

4 4 4 4

d)

1

2

3

4

e)

0

1

2

3