Looking for 2025 COMP100P1 Introduction to Computer Science test answers and solutions? Browse our comprehensive collection of verified answers for 2025 COMP100P1 Introduction to Computer Science at learn2025.ukzn.ac.za.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
What is the output of the following code:
a = 13b = 7c = 5if (a < b): if (b < c):print ("a")
elif (a < c):
print("b")
else:
print(c)
When the code below is executed
x = 1if (x < 1):
print("x")
else:
print("o")
Match each chunk of code with the correct output
#chunk 1
i = 1while (i < 5): print(i,end=' ') i = i + 1
#chunk 2
i = 0while (i <= 5): print(i,end=' ') i = i + 1
#chunk 3
i = 0while (i <= 5): i = i + 1 print(i,end=' ')
#chunk 4
i = 0while (i < 5): i = i + 1 print(i,end=' ')
Consider the following code:
if (a > 2.0):
b = 10.0elif (a > 1.0):
b = 20.0
elif ( a > -1.0):
b = 30.0
else:
b = 40.0
Assume possible values for a are: 4.5, 3.2, 0.01112, and 1.67. Of these values, the one which causes b to be assigned the value 30.0 is
Match the chunk of code to the correct output
#Code chunk1
sum = 0
while sum <15:
sum += 3
if sum % 2 == 0:
print("",end="")
else:
print(sum, end= " ")
#Code chunk2
sum = 0
while sum < 15:
sum += 3
print(sum,end=" ")
What is the output of the following code:
a = 5b = 13c = 7if (a < b):print (a)
print(c)
1. Use the following code in answering the questions that follow:
def is_divisible(x,y): return x%y==0 print(is_divisible(4,2))
What is the output of the code above?
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!