logo

Crowdly

2025 COMP100P1 Introduction to Computer Science

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 = 13

b = 7

c = 5

if (a < b):

if (b < c):

print ("a")

elif (a < c):

print("b")

else:

print(c)

View this question

When the code below is executed

x = 1

if (x < 1):

print("x")

else:

print("o")

View this question

Match each chunk of code with the correct output

#chunk 1

i = 1

while (i < 5):

    print(i,end=' ')

    i = i + 1

#chunk 2

i = 0

while (i <= 5):

    print(i,end=' ')

    i = i + 1

#chunk 3

i = 0

while (i <= 5):

    i = i + 1   

    print(i,end=' ')

#chunk 4

i = 0

while (i < 5):

    i = i + 1

    print(i,end=' ')

View this question

Consider the following code:

if (a > 2.0):

b = 10.0

elif (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

View this question

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=" ")

View this question

What is the output of the following code:

a = 5

b = 13

c = 7

if (a < b):

print (a)

print(c)

View this question
To read in a value from the user for variable x we would use the python statement

View this question
Assume that the 'random' module is imported, and the following code does not produce an error. Which usage of random will produce a number strictly in the range of 13 to 17 both inclusive?
0%
0%
0%
0%
View this question

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?

View this question
What is the order of precedence in python?
View this question

Want instant access to all verified answers on learn2025.ukzn.ac.za?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!