Question 1
Question
What is the result of 2 + 3 * 4 in Python?
Question 2
Question
Which of the following is a valid variable name in Python?
Answer
-
1variable
-
my_variable
-
variable-1
-
var&ble
Question 3
Question
What will be the output of print("Hello" * 3) in Python?
Answer
-
HelloHelloHello
-
9
-
Hello 3 times
-
Rasengan
Question 4
Question
In Python, which statement is used to make a decision based on a condition?
Question 5
Question
How do you define a function in Python?
Answer
-
function myFunction():
-
define myFunction():
-
def myFunction():
-
func myFunction():
Question 6
Question
What is the correct way to call a function named my_function with two arguments in Python?
Answer
-
call my_function()
-
function my_function()
-
my_function(arguments)
-
my_function(arg1, arg2)
Question 7
Question
What will the following code snippet output: 5 > 3 and 10 < 20?
Question 8
Question
Which data type can not execute a calculation in Python?
Answer
-
string
-
integer
-
float
-
all of above
Question 9
Question
What does the "return" statement do in a function?
Question 10
Question
What is the result of range(7) in Python?
Answer
-
1,2,3,4,5,6
-
0,1,2,3,4,5,6
-
0,1,2,3,4,5,6,7
-
1,2,3,4,5,6,7
Question 11
Question
Which of the following program segment (s) is an example of a compound(複合的) conditional statement in Python?
Answer
-
if x > 5 or y < 10:
-
if x > 5 and y < 10:
-
if x > 5 then y < 10:
-
if x > 5
Question 12
Question
What is the output of print(3 == 3) in Python?
Question 13
Question
What is the purpose of the not keyword in Python?
Question 14
Question
What will be the output of the following code snippet?
Question 15
Question
What does the != operator signify in Python?
Answer
-
Less than or equal to
-
Not equal to
-
Greater than or equal to
-
Assignment
Question 16
Question
What will be the output of the following code snippet?
Answer
-
Out of range
-
In range
-
out of range
-
Zaphkiel Bet
Question 17
Question
What is the value of z after the execution of the following code snippet?
def my_function(x, y):
return x + y
z = my_function(3, 4) * 2
Question 18
Question
What is the value of z after the execution of the following code snippet?
Question 19
Question
What will be the output of the following code snippet?
Question 20
Question
What will be the output of the following code snippet?
Answer
-
3.33333
3
-
3
3.33333
-
error
-
3 / 3
3 // 3
Question 21
Question
What is the result of True + True in Python?
Question 22
Question
Are you ready for the test?
Answer
-
Absolute Cinema
-
Yes
-
No
-
Will Win
Question 23
Question
What will be the output of the following code snippet?
Answer
-
2
3
-
2
2.66666
-
8
3
-
2.66666
2
Question 24
Question
What will be the output of the following code snippet?
Question 25
Question
What is the value of the result variable in the following code snippet?
Question 26
Question
What does the += operator do in Python?
Answer
-
Subtracts the right operand from the left operand
-
Multiplies the left operand by the right operand
-
Adds the right operand to the left operand
-
None of the above
Question 27
Question
What will be the output of the following code snippet?
Question 28
Question
What is the result of (True or False and True) in Python?
Answer
-
True
-
False
-
Error
-
None of the above
Question 29
Question
What does the // operator do in Python?
Question 30
Question
the display output of
print (f" Answer = { name } ")
is equivalent to
print ("Answer = name")
Question 31
Question
Write a Python program segment to ask "the user to input their test mark" and store it in the test variable as a float type. The programme should ask the user a question "What is your test result? >"
[blank_start]test[blank_end] = [blank_start]float([blank_end][blank_start]input([blank_end][blank_start]"What is your test result? >"[blank_end][blank_start]))[blank_end]
Answer
-
test
-
text
-
float(
-
int(
-
str(
-
input(
-
output(
-
"What is your test result? >"
-
"What is your test result?"
-
"What is your text result? >"
-
"what is your text result? >"
-
"What is your text result?>"
-
))
Question 32
Question
The Data type of variable "Future" is String
SYNY = 1
Future = SYNY == "True"
Question 33
Question
Which of the following variable names uses the snake case approach?
Answer
-
3711ModuleCode
-
SeeYouNextYear
-
HKIIT_Modules
-
if
Question 34
Question
Which of the following variable names uses the camel case approach?
Answer
-
seeYouNextYear
-
HKIIT_Modules
-
3711moduleCode
-
____main____
Question 35
Question
Which of the following variable names uses the Pascal Case approach?
Answer
-
See You Next Year
-
See_You_Next_Year
-
SeeYouNextYear
-
ifelse
Question 36
Question
What is the correct way to declare a variable in Python?
Answer
-
create variable mark is 100;
-
x <- 100
-
dim Sum As Integer = "HarGow";
-
SeeYouNextYear = "Higher Diploma"
Question 37
Question
What is the value of the variable Result stored when the following Python segment is executed?
Question 38
Question
Which of the following Python segments is/are able to execute the below function CallMe()?
Question 39
Question
Which of the following Python segments able to execute the provided function CallMe() and display the result
21850000 Call Me
Question 40
Question
Which operator is used to calculate reminders in Python?
Question 41
Question
Which of the following Python code is a correct answer to the following expression?
Expression: 73% of 467
Answer
-
467 * 0.73
-
467 // 0.73
-
467 * 73%
-
467 // 73/100
Question 42
Question
Which of the following is/are a software development stage?
Answer
-
Planning
-
Analysis
-
Design
-
Implementation
-
Katon Goukakyuu no jutsu
Question 43
Question
What is the output of the following program segment?
print(10*(3.7 + 2.3))
Question 44
Question
What is the displayed result of the Python program segment?
Answer
-
GoodGood Bye
-
=========
=========
GoodGood Bye
-
=========
GoodGood Bye
=========
-
=========
Jutsushiki jyunten "Ao", Jutsushiki hanten "Aka"
=========
Question 45
Question
What is the python expression that can represent the following mathematics equation?
Answer
-
(a + b) ** (5/2)
-
(a + b) ** (2/5)
-
(a + b) ^ (2/5)
-
(a + b) ^ (5/2)
Question 46
Question
Choose all of the following Python expression(s) that are possible to represent the displayed mathematics equation.
Question 47
Question
What is the displayed result when the following Python code executed?
Answer
-
GGWP
WPGG
-
WPGG
GGWP
-
Error
-
GGWP
-
WPGG
Question 48
Question
What will be the output of the following code segnment?
Question 49
Question
What will be the output of the following code segment?
Question 50
Question
What happens if a function in Python does not have a return statement?
Question 51
Question
Identify the data type of the following variables.
Answer
-
string
-
float
-
integer
-
float
-
boolean
Question 52
Question
Ans = 0
[blank_start]for[blank_end] [blank_start]count[blank_end] [blank_start]in[blank_end] [blank_start]range(1,6)[blank_end]:
[blank_start]Ans[blank_end] [blank_start]+=[blank_end] [blank_start](2 * count) ** count[blank_end]
Answer
-
for
-
while
-
I don't know fuck!
-
count
-
Ans
-
in
-
on
-
at
-
under
-
range(1,6)
-
range(0,5)
-
range(6)
-
range(5)
-
range(6,1)
-
Ans
-
count
-
+=
-
-=
-
*=
-
(2 * count) ** count
-
(2 ** count) * count
-
(count ** count) * 2
-
(count * count) ** 2
Question 53
Question
sum = 0
count = 1
while [blank_start]count <= 5[blank_end]:
[blank_start]sum[blank_end] [blank_start]+=[blank_end] [blank_start](count * 2) ** (2 * count -1)[blank_end]
[blank_start]count += 1[blank_end]
Answer
-
count <= 5
-
count < 5
-
sum
-
+=
-
(count * 2) ** (2 * count -1)
-
(count * 2) ** (2 * count +1)
-
count += 1
-
count + 1
-
1 / ((count * 2) ** (2 * count -1))
-
1 / (count * 2) ** (2 * count -1)
-
1 / ((count * 2) ** (2 * count +1))
-
1 / (count * 2) ** (2 * count +1)
-
1 / ((count ** 2) * (2 ** count -1))
Question 54
Question
count = 1
sum = 0
[blank_start]while[blank_end] [blank_start]count <= 5:[blank_end]
sum += [blank_start](2 * count) ** count[blank_end]
[blank_start]count += 1[blank_end]
Answer
-
while
-
for
-
when
-
count <= 5:
-
count < 5:
-
count <= 5
-
count < 5
-
(2 * count) ** count
-
(2 ** count) * 2
-
(2 ** count) * count
-
count += 1
-
count += 2
-
count += 5
-
count + 1
Question 55
Question
sum = 0
#below is the for loop
For [blank_start]count[blank_end] [blank_start]in[blank_end] [blank_start]range(1,6):[blank_end]
sum [blank_start]+=[blank_end] [blank_start]1/((count * 2) ** ( 2 * count -1))[blank_end]
Answer
-
count
-
sum
-
count += 1
-
in
-
on
-
at
-
range(1,6):
-
range(1,5):
-
range(1,6)
-
range(6):
-
range(1,5)
-
+=
-
*=
-
/=
-
1/((count * 2) ** ( 2 * count -1))
-
1/(count * 2) ** ( 2 * count -1)
-
1/((count ** 2) * ( 2 ** count -1))
-
1/((count ** 2) ** ( 2 ** count -1))
Question 56
Question
count = 1
sum = 0
[blank_start]while count <= 5:[blank_end]
[blank_start]sum[blank_end] [blank_start]+=[blank_end] [blank_start]1/((2 * count) ** (2 * count - 1))[blank_end]
[blank_start]count += 1[blank_end]
Answer
-
while count <= 5:
-
while count <= 5
-
for count <= 5:
-
for count <= 5
-
sum
-
count
-
+=
-
^=^
-
/=
-
1/((2 * count) ** (2 * count - 1))
-
(2 * count) ** (2 * count - 1)
-
1/(2 * count) ** (2 * count - 1)
-
1/((2 ** count) * (2 ** count - 1))
-
count += 1
-
count *= 1
-
count /= 1
-
count 凸 = 凸 1
Question 57
Question
count = 1
Ans = 0
while [blank_start]count <=5[blank_end]:
Ans [blank_start]*=[blank_end] [blank_start]1/((2 * count +1) ** (4 * count))[blank_end]
[blank_start]count += 1[blank_end]
Answer
-
count <=5
-
count <=5:
-
*=
-
+=
-
1/((2 * count +1) ** (4 * count))
-
1/((4 * count +1) ** (2 * count))
-
1/((2 ** count +1) * (4 ** count))
-
1/((2 ** count) * (4 ** count + 1))
-
1/((2 * count) ** (5 * count + 1))
-
count += 1
-
count *= 1
Question 58
Question
Ans = 0
#For loop is below
[blank_start]For count in range(1,6):[blank_end]
Ans [blank_start]*=[blank_end] [blank_start]1/((2 *count + 1) ** ( 4 * count))[blank_end]
Answer
-
For count in range(1,6):
-
For count in range(0,6):
-
For count in range(6):
-
For count in range(5):
-
*=
-
+=
-
1/((2 *count + 1) ** ( 4 * count))
-
1/(2 *count + 1) ** ( 4 * count)
-
1/((2 *count + 1) * ( 5 * count))
Question 59
Question
Ans = 0
count = 1
while [blank_start]count <= 4[blank_end]
Ans += [blank_start]count / (count ** 2)[blank_end]
count += 1
Answer
-
count <= 4
-
count <= 5
-
count <= 5:
-
count <= 4:
-
count / (count ** 2)
-
(count**2) / count
Question 60
Question
Ans = 0
[blank_start]for count in range(1,6):[blank_end]
Ans [blank_start]+=[blank_end] [blank_start]count / (count ** 2)[blank_end]
Question 61
Question
Using the len() method, write a "for" loop to display all company names from the
ProgrammeName list. Print the corresponding output, referring to the following
sample execution.
ProgrammeName = ["DSAI","GSD","SE","TN"]
for [blank_start]count[blank_end] in [blank_start]range(0,len(ProgrammeName))[blank_end]:
print(f"Programme [blank_start]{count + 1}[blank_end] :[blank_start]{ProgrammeName[count]}[blank_end]")
Answer
-
count
-
PragrammeName
-
range(0,len(ProgrammeName))
-
range(0,length(ProgrammeName))
-
{count + 1}
-
(count + 1)
-
{ProgrammeName[count]}
-
(ProgrammeName[count])
Question 62
Question
Using the len() method, write a "for" loop to display all names from the
Name list. Print the corresponding output, referring to the following
sample execution.
Name = ["Benson","Matthew","Eric","Arion"]
[blank_start]Name.sort()[blank_end]
for [blank_start]count[blank_end] in [blank_start]range(0,len(ProgrammeName))[blank_end]:
print(f"Teacher [blank_start]{count + 1}[blank_end] : [blank_start]{Name[count]}[blank_end]")
Question 63
Question
Complete the Python program to check the Block of each Room by using the "if-elif" statement. Save the correct result into a variable named, Block.
if Room >=101 and [blank_start]Room <= 127[blank_end]:
Block = "A"
elif [blank_start]Room >= 128 and Room <= 191[blank_end]:
[blank_start]Block = "B"[blank_end]
elif Room >= 192 and [blank_start]Room <= 223[blank_end]:
[blank_start]Block = "C"[blank_end]
[blank_start]elif[blank_end] Room >= 224 and Room <= 255:
[blank_start]Block = "D"[blank_end]