Шукаєте відповіді та рішення тестів для 2025 COMP100P1 Introduction to Computer Science? Перегляньте нашу велику колекцію перевірених відповідей для 2025 COMP100P1 Introduction to Computer Science в learn2025.ukzn.ac.za.
Отримайте миттєвий доступ до точних відповідей та детальних пояснень для питань вашого курсу. Наша платформа, створена спільнотою, допомагає студентам досягати успіху!
What is the output of the following code:
a = 5b = 13c = 7if (a < b):print (a)
print(c)
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)
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=" ")
When the code below is executed
x = 1if (x < 1):
print("x")
else:
print("o")
What is the output of the following code:
x = 10 y = float(x)print("x is",x,"and y is",y)