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 = 15height = 160weight = 55if (age < 18): if (height > 150): if (weight < 50): print("A") else: print("B") else: print("C")else: print("D")
What will be the output (or result) of running the following code?
mark = 75if mark > 75 and mark < 75: print("A")
a = 3b = a * 4a = b + 2b = a // 2a = 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” 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
Study the code below.
x = 0if x <= 0: print("negative")elif x == 0: print("zero")else: print("positive")
Which one of the following is the correct output from the code? 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.
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
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)))
Which of the following are NOT valid numeric literals in Python? Choose all that apply.
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!