wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python

Total questions: 35

Worksheet time: 18mins

Name
Class
Date
1.
a)
b)
c)
d)

1,2,3,4

2.

Which of the following statements create a dictionary?

a)

a) d = {}

b)

b) d = {“john”:40, “peter”:45}

c)

c) d = {40:”john”, 45:”peter”}

d)

d) All of the mentioned

3.

How many times will this code loop?

a)

50

b)

90

c)

0

d)

4

4.
Look at this code, what shape will it make?
a)
Square
b)
Triangle
c)
Rectangle
d)
Hexagon 
5.

Suppose list1 is [2445,133,12454,123], what is max(list1)?

a)

a) 2445

b)

b) 133

c)

c) 12454

d)

d) 123

6.

If a=(1,2,3,4), a[1:-1] is _________

a)

a) Error, tuple slicing doesn’t exist

b)

b) [2,3]

c)

c) (2,3,4)

d)

d) (2,3)

7.

To add a new element to a list we use which Python command?

a)

a) list1.addEnd(5)

b)

b) list1.addLast(5)

c)

c) list1.append(5)

d)

d) list1.add(5)

8.
In the following code, "city" is an example of a what?
a)
List
b)
Loop
c)
Variable
d)
Array
9.

Suppose listExample is [‘h’,’e’,’l’,’l’,’o’], what is len(listExample)?

a)

a) 5

b)

b) 4

c)

c) None

d)

d) Error

10.

Which of these will allow me to print all numbers from 0 to 4 ?

//0,1,2,3,4

a)

for x in range(4):

print(x)

b)

for x in range(0,4):

print(x)

c)

for x in range(1,5):

print(x)

d)

for x in range(5):

print(y)

11.

What are the syntax errors in this code?

a)

:

b)

Not indented

c)

Both options

12.

What will be the output of the following Python code snippet?

d = {"john":40, "peter":45}

d["john"]

a)

a) 40

b)

b) 45

c)

c) “john”

d)

d) “peter”

13.

Dalam memprogram python perlu adanya pendukung tools dalam mengelolah data yang sangat besar dan juga tim, maka dari itu berikut ini manakah yang bukan dari tim system owner turbin.

a)

Andi Kusuma Hadi

b)

Febri Wahyu D

c)

Tofan Nugroho

d)

Agus Sulistiyono

14.
What does the print function do in python?
a)
It's a variable.
b)
It can input data.
c)

It displays an output

d)
It loops the code.
15.

Quelle est l'extension de fichier correcte pour les fichiers Python ?

a)
b)
c)

.pyth

d)

.pt

16.

What is the keyword needed to repeat code (iterate) in Python?

a)

for

b)

if

c)

input

d)

print

17.

Which are list functions?

a)

append()

b)

index()

c)

items()

d)

len()

18.

What will be the output of the following Python code?

>>>str1="helloworld"

>>>str1[::-1]

a)

a) dlrowolleh

b)

b) hello

c)

c) world

d)

d) helloworld

19.

Apakah module package dalam mengembangkan Bot telegram, kecuali

a)

pyTelegramBotAPI

b)

python-telegram-bot

c)

connect-telegram-bot

d)

pyTelegramBot

20.

#How many hallos will be printed?

a)

5

b)

None

c)

4

d)

6

21.

Dalam menampilkan data python ke visualisasi dashboard, terdapat banyak pilihan dari melakukan dengan koneksi java script ataupun open source dashboard, berikut ini manakah yang merupakan open source dashboard untuk menampilkan data python.

a)

Grafana

b)

Freeboard

c)

Dashbuilder

d)

Wordpress

22.

Which symbols are used in conditional logic?

a)

<

b)

>=

c)

=

d)

==

e)

=<

23.

Which of the following is used to define a block of code in Python language?

a)

a) Indentation

b)

b) Key

c)

c) Brackets

d)

d) All of the mentioned

24.

To move the turtle to a specific position on the drawing canvas you need to use which of the following commands?

a)

set_pos( )

b)

setpos( ):

c)

setpos

d)

setposition( )

25.

What does the following program display?

a)

1,2,3,4

b)

1,2,3,4,5

c)

counter,counter,counter,counter,counter

d)

0,1,2,3,4,5

26.

IQR adalah metode untuk menentukan Upper dan Lower suatu data analisis, untuk mempermudah dalam pengambilan data yang banyak maka diperlukan sintak iloc, iloc itu sendiri merupakan import dari module apa,

a)

Pyscopg2

b)

Seaborn

c)

Pandas

d)

Sqlalchemy

27.

Selain menggunakan anaconda untuk menampilkan jupyter notebook, bisa menggunakan langsung dengan CMD (Command Prompt), seperti apa sintaksnya,

a)

Open Jupyter

b)

Open Jupyter Notebook

c)

Jupyter Notebook

d)

Jupyter

28.

What will be the output of the following Python code?

>>> str1 = 'hello'

>>> str2 = ','

>>> str3 = 'world'

>>> str1[-1:]

a)

a) olleh

b)

b) hello

c)

c) h

d)

d) o

29.

In order to move the turtle 120 forward without drawing on the screen, which order is correct?

a)

turtle.forward(120)

turtle.penup()

turtle.pendown()

b)

turtle.pendown()

turtle.forward(120)

turtle.penup()

c)

turtle.penup()

turtle.forward(120)

turtle.pendown()

30.

Salah satu tools untuk mempermudah pembacaan aplikasi python

a)

Jupyter notebook

b)

Anaconda

c)

Sublime Text

d)

Idle Python

31.

Which were the objectives for Day 2 Python?

a)

Lists and dictionaries

b)

Classes

c)

Iteration

d)

Custom functions

e)

Indexing

32.

Which of these commands would create a turtle named Alice?

a)

Alice = turtle.pen()

b)

Alice = Turtle.pen()

c)

Alice = Turtle.turtle()

d)

Alice = turtle.Turtle()

33.

How many times does the following program print the word ‘computer’:

word= "computer"  

for num in range(2,8):

      print(word)

a)

5

b)

6

c)

1

d)

0

34.

What do you put at the end of a turtle program?

a)

import turtle

b)

wn.mainloop()

c)

hunter = turtle.Turtle()

d)

wn = turtle.Screen()

35.

Which of the following functions is a built-in function in python?

a)

a) factorial()

b)

b) print()

c)

c) seed()

d)

d) sqrt()