You are on page 1of 20

21/11/2022, 06:55 COMP1010 - Midterm Revision

NAME : 
CLASS : 
COMP1010 - Midterm Revision DATE  : 
44 Questions

1.

​ OMP1010
C
Midterm Revision
​Week 8 - Interactive revision session for midterm exam

2.

​Testing Quizzizz Session

https://quizizz.com/print/quiz/6378aa0b94107c001de2cc5c 1/20
21/11/2022, 06:55 COMP1010 - Midterm Revision

3. Do you feel like you did well on Quiz 2? :)


A Yes B No
I'm too smart for this
C Define "well" :'( D
subject >:D
4.

​ ongratulations for completing


C
Quiz 2 and Video Assignment!!

5.

​Quiz 2 Review

https://quizizz.com/print/quiz/6378aa0b94107c001de2cc5c 2/20
21/11/2022, 06:55 COMP1010 - Midterm Revision

6.

What is printed?
A 10 B 0
C SyntaxError D RuntimeError
7.

8.

What is the resulting list?


A 25 B Error
C [2, 33, 222, 14] D [25, 14, 222, 33, 2]

https://quizizz.com/print/quiz/6378aa0b94107c001de2cc5c 3/20
21/11/2022, 06:55 COMP1010 - Midterm Revision

9.

10.
Try this condition if previous conditions failed
A if-else B elif
C else D if
11.

https://quizizz.com/print/quiz/6378aa0b94107c001de2cc5c 4/20
21/11/2022, 06:55 COMP1010 - Midterm Revision

12.
Error if "else" is not defined
A True B False
13.

14.

What's the condition?


A age < 18 B age >= 18
C age > 18 D age = 18

https://quizizz.com/print/quiz/6378aa0b94107c001de2cc5c 5/20
21/11/2022, 06:55 COMP1010 - Midterm Revision

15.

16.

​Lecture Content Review

https://quizizz.com/print/quiz/6378aa0b94107c001de2cc5c 6/20
21/11/2022, 06:55 COMP1010 - Midterm Revision

17.

​Week 2

Variables and Operators Functions


Basic data types What is a function?
​What is a variable? Function call
​Basic operators Built-in Python functions
​input() function ​References

18.

​Week 3

Functions & Modules


Structure of a function What is a module?
Function call Creating modules
Return statement Module import and
Global vs. local variables​ namespace

​Reminder: Check your Lab 3 feedback! Know what you did right and wrong, and why!

https://quizizz.com/print/quiz/6378aa0b94107c001de2cc5c 7/20
21/11/2022, 06:55 COMP1010 - Midterm Revision

19.

20.

​Week 4
Strings Specification and Testing
Intro to sequences Precondition
Indexing, slicing ​Types of Errors
​Mutability ​Testing and Debugging
String methods and operators​ Assert, try-except​-else-finally

https://quizizz.com/print/quiz/6378aa0b94107c001de2cc5c 8/20
21/11/2022, 06:55 COMP1010 - Midterm Revision

21.

​Week 5
Conditionals Memory in Python
Boolean expressions Non-examinable (for now?)​
If-else
If-elif-else
Nested if-else

22.

How many lines will be printed?


A 0 but no error B Error
C 6 D 9

https://quizizz.com/print/quiz/6378aa0b94107c001de2cc5c 9/20
21/11/2022, 06:55 COMP1010 - Midterm Revision

23.

24. ​What are the outputs?

https://quizizz.com/print/quiz/6378aa0b94107c001de2cc5c 10/20
21/11/2022, 06:55 COMP1010 - Midterm Revision

25.

​Week 6
Lists and Sequences

Sequences in Python List alias


What is a List? Copying a list
Mutability Basic list methods and
Identical vs. Equivalent operations​
Indexing and Slicing Nested lists​

26.

​Week 7
Iterations and Loops

Iteration While loop


Iteration on sequences ​Loop-else
For loop Nested loop
Range() function
break/continue/pas

27.

How many times will i and j be printed?


A i: 3 times j: 3 times B i: 1 time j: 1 time
C i: 3 times j: 1 time D i: 3 times j: 5 times

https://quizizz.com/print/quiz/6378aa0b94107c001de2cc5c 11/20
21/11/2022, 06:55 COMP1010 - Midterm Revision

28.

29.

How many times will i be printed?


A 0 B 5
C 10 D 9
30.

https://quizizz.com/print/quiz/6378aa0b94107c001de2cc5c 12/20
21/11/2022, 06:55 COMP1010 - Midterm Revision

31.

​ ommonly confused topics


C
Additional practice questions​

32.
When will Dwight
become Manager?
Over the 9 seasons of The Office US,
Dwight Schrute had held multiple title at
the Dunder-Mifflin Scranton Branch.
However your best friend doesn't watch
The Office but wanted to catch up with
the show. Using your supreme
programming skill from COMP1010,
you've created a program to help your
friend figure out Dwight's current job title.

https://quizizz.com/print/quiz/6378aa0b94107c001de2cc5c 13/20
21/11/2022, 06:55 COMP1010 - Midterm Revision

33.
​ fter hearing a rumour that Prof. Kok-Seng is going to test you on
A
nested if-else, you decided to practice by changing your previous code:

​ here are multiple ways to write the same conditions!


T
Some are worse than others, depends on the use case.​

34.

Python Circuit
Tester
​You’re trying out electrical engineering
class in high school. In the first week
the teacher wanted you to write out a
Truth Table for the following circuit.
However, you’re already blessed by the
Python god and already knew how to
automate this boring task in Python.
Describe your approach.

​How would you write this as a nested conditional?

https://quizizz.com/print/quiz/6378aa0b94107c001de2cc5c 14/20
21/11/2022, 06:55 COMP1010 - Midterm Revision

35.
​Can you improve this?

36.
​Can this be improved even further?

https://quizizz.com/print/quiz/6378aa0b94107c001de2cc5c 15/20
21/11/2022, 06:55 COMP1010 - Midterm Revision

37.

38.

Water tank
simulation
You’re a mechanical engineer who was
tasked to figure out how long it would
take for a liquid nitrogen tank to be filled
if a new pump is installed. However,
today you don’t really feel like doing any
math, so you decided to run a
simulation instead. What kind of loop
can you use for this problem?​

​Can you describe how you can complete the code?

https://quizizz.com/print/quiz/6378aa0b94107c001de2cc5c 16/20
21/11/2022, 06:55 COMP1010 - Midterm Revision

39.

40. ​ our (very) distance cousin who is not-so-good-at-math, Anya, currently owns a restaurant chain
Y
with 2 branches.
She started a new promotion which discounted the prices for her favourite food: peanuts, cake,
and steak.
Anya now wants to know how big a difference in terms of money earned from the discounted
items compared to if it was sold at the original price. You are now tasked to perform this simple
analysis and she will pay you with 3 carrots.
(Assume you really hate Excel so decided to use Python instead).

https://quizizz.com/print/quiz/6378aa0b94107c001de2cc5c 17/20
21/11/2022, 06:55 COMP1010 - Midterm Revision

41.

42.

https://quizizz.com/print/quiz/6378aa0b94107c001de2cc5c 18/20
21/11/2022, 06:55 COMP1010 - Midterm Revision

43.

44.

​We're done!

(unless...?)

https://quizizz.com/print/quiz/6378aa0b94107c001de2cc5c 19/20
21/11/2022, 06:55 COMP1010 - Midterm Revision

Answer Key
1. 2. 3.n/a 4.
5. 6.a 7. 8.c
9. 10.b 11. 12.b
13. 14.c 15. 16.
17. 18. 19. 20.
21. 22.c 23. 24.
25. 26. 27.d 28.
29.c 30. 31. 32.
33. 34. 35. 36.
37. 38. 39. 40.
41. 42. 43. 44.

https://quizizz.com/print/quiz/6378aa0b94107c001de2cc5c 20/20

You might also like