Looking for CITS1401 Computational Thinking with Python (2025S1) test answers and solutions? Browse our comprehensive collection of verified answers for CITS1401 Computational Thinking with Python (2025S1) at quiz.jinhong.org.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
Which of the following are true?
If you want to learn anything from this question you should first try to use the documentation and/or the dir and help function to predict how the various methods will behave. You can then check your predictions by typing the expressions into the shell.
Important Note: It would be a good idea to spend a bit of time trying to understand what string methods are available, as you will need them repeatedly throughout the rest of this course. Sometimes, knowing about the existence of particular methods can save you hours of wasted effort trying to re-invent the wheel!
A block of code is given below. Which of the subsequent code blocks are equivalent? Select ALL answer(s), and try to solve without checking your answer. You can assume all variables have already been declared as integers, and they are all unique numbers (i.e., no two variables will have the same value).
if (a > b) and (b < c):
if a > c:
print("largest is a")
else:
print("largest is c")
elif a < b:
if c < b:
print("largest is b")
else:
print("largest is c")
else:
print("largest is a")
Which of the following are syntactically INCORRECT (ie their syntax is INCORRECT for the Python programming language)? Select ALL answers. You may assume all variables have previously been declared.
What is printed after executing the code below? Try to answer the question without trying it out!
a = 10b = 15if a > b: a += belse: a += b * 2if a < b: print("awesome!")elif a > 20: print("great!")else: print("nice!")
var1 != var2
Statement 2:not var1 == var2
Fill in the blanks in the following. The Python code below defines a function named that has two parameters, the first being and the second being . If the function is "called" via the expression distance_travelled(10, 50), the value of the arguments are and respectively, and the numeric value returned by the function will be .
def distance_travelled(duration, speed):
"""Returns the distance travelled given duration and the speed"""
return speed * duration
Functions should also have clear and concise naming, so that users (such as yourself and your colleagues) will be able to understand what it does without having to go over the function in detail. Of course, they should also be syntactically correct. Select ALL functions names that are syntactically correct AND are of good style (i.e. readability).
Which of the following are syntactically correct Python assignment statements? Here, you can assume all the variables are already defined. Select ALL that are correct.
Look at the Python expressions below. What is the value of 'orange' when all those expressions are executed in that order?
You are welcome to use Python to check your answer, but try to solve it without using Python first.
apple = 15
pineapple = apple * 2 + 1
orange = apple + pineapple
orange = orange - (apple * 2)
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!