logo

Crowdly

MC 2025 COMP100 Introduction to Computer Science Tests W/P 1

Looking for MC 2025 COMP100 Introduction to Computer Science Tests W/P 1 test answers and solutions? Browse our comprehensive collection of verified answers for MC 2025 COMP100 Introduction to Computer Science Tests W/P 1 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 will be output when the following program is run?

age = 15

height = 160

weight = 55

if (age < 18):

if (height > 150):

if (weight < 50):

print("A")

else:

print("B")

else:

print("C")

else:

print("D")

View this question

What will be the output (or result) of running the following code?

mark = 75

if mark > 75 and mark < 75:

print("A")

0%
0%
0%
100%
0%
0%
View this question

a = 3

b = a * 4

a = b + 2

b = a // 2

a = b * 3

What is the final value of a after all the statements in this program are executed? If there is an error or the value cannot be determined, then write “error”

View this question

Which of the following statements (i to v) will print the following string exactly as shown? Note that it must print the statement as shown below, including punctuation and quotations. Choose all that apply.

"Stop!" he yelled, "That’s my cat’s toy!"

print("Stop!" he yelled, "That's my cat's toy!")            # i  

print('"Stop!" he yelled, "That\'s my cat\'s toy!"') # ii

print(''''Stop!' he yelled, "That's my cat's toy!"''') # iii

print(""" "Stop!" he yelled, "That's my cat's toy!" """) # iv

print("Stop! he yelled, That's my cat's toy!") # v

100%
0%
100%
0%
0%
View this question

Study the code below.

x = 0

if x <= 0:

print("negative")

elif x == 0:

print("zero")

else:

print("positive")

Which one of the following is the correct output from the code?

View this question

Each of the following expressions will produce a value (or result in an error) when it is evaluated. Match the expression to the type of the value it will produce. Choose “error” if the expression cannot be evaluated because of an error.

View this question

Give the result of the evaluation of each expression. Give the exact value. Note that for e.g. 3.0 is not the same as 3. If there is an error in the expression then write “error”.

int(str(4.9)) + "int(0)"

int(float("9")) + float(int("9.0"))

float(str(2) + "0.5") + 2

View this question

Give the output of each of the following statements. Ensure you give the exact output - i.e. precisely what will be printed on the screen. If there is an error in the statement, write "ERROR" as your answer. If there is no output, then leave the answer blank.

The Python precedence rules are given in the table above.

print( 12 / 3 // 2)

print( 7 + 3 * (5 // 2) )

print( 3 + 4 > 8 - 2 )

print( float(int(9.123)) - 0.5 )

print((4 > 1) or ((7 < 7) or not (8 == 1)))

print( float(int(4.999)))

View this question

Which of the following are NOT valid numeric literals in Python? Choose all that apply.

100%
100%
0%
100%
100%
0%
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!