COMP10001 Foundations of Computing Practice Mid-Semester Test
19 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What percentage of the final grade does this practice mid-semester test count for?

10%

Are students allowed to use calculators and dictionaries during the test?

No

What materials are students authorized to use during the test?

None

How many marks does this practice mid-semester test contain?

<p>40</p> Signup and view all the answers

What is the time allowed for this practice mid-semester test?

<p>Forty minutes</p> Signup and view all the answers

What is the instruction regarding communication with other students during the test?

<p>Must not communicate with any other student in any way</p> Signup and view all the answers

What is the value of the expression $5 * 6 // 7 + 8 % 9 / 10$?

<p>Error</p> Signup and view all the answers

What is the result of the Python statement $tuple("bird")[::-1]$?

<p>('d', 'r', 'i', 'b')</p> Signup and view all the answers

How can you create a new version of a Python string 'text' where all alphabetic characters are converted to lower case and leading/trailing blank characters are removed?

<p>text.strip().lower()</p> Signup and view all the answers

How can you right-justify a Python string 'text' with less than 20 characters in a 20-character long string 'text20'?

<p>text20 = text.rjust(20)</p> Signup and view all the answers

How can you replace the first element of a Python tuple 'tup' with the special value None?

<p>tup = (None,) + tup[1:]</p> Signup and view all the answers

What happens when you try to add the strings '12' and '2' in Python?

<p>'122'</p> Signup and view all the answers

What is the output of the Python statement '"hello hello".split("e")'?

<p>['h', 'llo h', 'llo']</p> Signup and view all the answers

What does the Python function biggest_diff(subject1, subject2) do?

<p>It returns the biggest absolute difference in marks that any student has for the two subjects.</p> Signup and view all the answers

What is the condition for the return value to be positive in the biggest_diff function?

<p>The student with the biggest absolute difference in marks has a higher mark for subject1.</p> Signup and view all the answers

What is the condition for the return value to be negative in the biggest_diff function?

<p>The student with the biggest absolute difference in marks has a higher mark for subject2.</p> Signup and view all the answers

How are the marks of students represented in the biggest_diff function?

<p>Each student mark is an integer between 0 to 100 inclusive, with marks at the same position in each list corresponding to the same student.</p> Signup and view all the answers

What does the Python variable lw store in the given scenario?

<p>The last word in the non-empty Python string 'text'.</p> Signup and view all the answers

What is the significance of the lists being the same length in the biggest_diff function?

<p>Marks at the same position in each list correspond to the same student.</p> Signup and view all the answers

More Like This

Introduction to Data Processing COMP100
5 questions
COMP100: Data Processing Introduction
9 questions
COMP1005/5005 Lecture 2: Strings and Lists
23 questions
Use Quizgecko on...
Browser
Browser