WorksheetsTest vòng loại Python - HKICO
Total questions: 16
Worksheet time: 48mins
Python language was developed in what year?
1985
1820
1991
2001
1979
What is a statement in programming?
Expresses an action to be carried out
Always returns results like expressions
Rules controlling how components in a program are combined
An instruction to perform a task, usually one word
None of the above
What is the output of the following code?
var = "James" 2 * 3
print(var)
James
JamesJamesJamesJamesJamesJames
JamesJamesJamesJamesJames
Error: invalid syntax
None of the above
What is the output of the following code?
str = "pynative"
print (str[1:3])
py
yn
pyn
yna
pn
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)
Syntax error
The concatenation of the two numbers 1530
The sum of the two numbers 45
Compiler error
None of the above
Which one will display when this code is run?
for I in range(10):
print(i)
None of the above
What is the output of the following code?
var= "James Bond"
print(var[2::-1])
Jam
dno
maJ
dnoB semaJ
Bon
What is the Output of the following code?
for x in range(0.5, 5.5, 0.5):
print(x)
[0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5]
[0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5]
[0.5, 1, 1.5, 2]
[0.5, 1, 5.5]
The Program executed with errors
What is the output of the following code?
Salary: 12000 Salary: 8000
Salary: 8000 Salary: 12000
Salary: 12000 Salary: 12000
Salary: 8000 Salary: 8000
The program failed with errors
Which operator has higher precedence in the following list?
% (Modulus)
& (BitWise AND)
** (Exponent)
> (Comparison)
They are equal
What is the data type of print(type(0xFF))?
number
hexint
hex
int
float
Please select the correct expression to reassign a global variable “x” to 20 inside a function fun1()
global x =20
global var x
x = 20
global.x = 20
global x
x = 20
None of the above
What is the output of the following variable assignment
Error
76
1
75
None
What is the output of the following nested loop
10 Chair
10 Table
20 Chair
20 Table
10 Chair
10 Table
20 Chair
20 Table
20 Chair
20 Table
20 Chair
10 Table
Given the nested if-else structure below, what will be the value of x after code execution completes
0
1
2
3
4
What is the order of precedence in python?
i) Parentheses ii) Exponential
iii) Multiplication iv) Division
v) Addition vi) Subtraction
i, ii, iii, v, vi, vi
i, iii, ii, iv, v, vi
ii, i, v, iii, v, vi
ii, i, iii, v, iv, vi
i, ii, iii, iv, v, vi
