Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Test vòng loại Python - HKICO

Total questions: 16

Worksheet time: 48mins

Name
Class
Date
1.

Python language was developed in what year?

a)

1985

b)

1820

c)

1991

d)

2001

e)

1979

2.

What is a statement in programming?

a)

Expresses an action to be carried out

b)

Always returns results like expressions

c)

Rules controlling how components in a program are combined

d)

An instruction to perform a task, usually one word

e)

None of the above

3.

What is the output of the following code?

var = "James" 2 * 3

print(var)

a)

James

b)

JamesJamesJamesJamesJamesJames

c)

JamesJamesJamesJamesJames

d)

Error: invalid syntax

e)

None of the above

4.

What is the output of the following code?

str = "pynative"

print (str[1:3])

a)

py

b)

yn

c)

pyn

d)

yna

e)

pn

5.

What output will the console show, if 15 and 30 are entered by the user?

num1 = input(“Enter your first number”)

num2 = input(“Enter your second number”)

print (num1 + num2)

a)

Syntax error

b)

The concatenation of the two numbers 1530

c)

The sum of the two numbers 45

d)

Compiler error

e)

None of the above

6.

Which one will display when this code is run?

for I in range(10):

print(i)

a)
b)

c)

d)

e)

None of the above

7.

What is the output of the following code?

var= "James Bond"

print(var[2::-1])

a)

Jam

b)

dno

c)

maJ

d)

dnoB semaJ

e)

Bon

8.

What is the Output of the following code?

for x in range(0.5, 5.5, 0.5):

print(x)

a)

[0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5]

b)

[0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5]

c)

[0.5, 1, 1.5, 2]

d)

[0.5, 1, 5.5]

e)

The Program executed with errors

9.

What is the output of the following code?

a)

Salary: 12000 Salary: 8000

b)

Salary: 8000 Salary: 12000

c)

Salary: 12000 Salary: 12000

d)

Salary: 8000 Salary: 8000

e)

The program failed with errors

10.

Which operator has higher precedence in the following list?

a)

% (Modulus)

b)

& (BitWise AND)

c)

** (Exponent)

d)

> (Comparison)

e)

They are equal

11.

What is the data type of print(type(0xFF))?

a)

number

b)

hexint

c)

hex

d)

int

e)

float

12.

Please select the correct expression to reassign a global variable “x” to 20 inside a function fun1()

a)

global x =20

b)

global var x

x = 20

c)

global.x = 20

d)

global x

x = 20

e)

None of the above

13.

What is the output of the following variable assignment

a)

Error

b)

76

c)

1

d)

75

e)

None

14.

What is the output of the following nested loop

a)

10 Chair

10 Table

20 Chair

20 Table

b)

10 Chair

10 Table

c)

20 Chair

20 Table

d)

20 Chair

20 Table

e)

20 Chair

10 Table

15.

Given the nested if-else structure below, what will be the value of x after code execution completes

a)

0

b)

1

c)

2

d)

3

e)

4

16.

What is the order of precedence in python?

i) Parentheses ii) Exponential

iii) Multiplication iv) Division

v) Addition vi) Subtraction

a)

i, ii, iii, v, vi, vi

b)

i, iii, ii, iv, v, vi

c)

ii, i, v, iii, v, vi

d)

ii, i, iii, v, iv, vi

e)

i, ii, iii, iv, v, vi