logo

Crowdly

24-25 CS1821/CS1822/DC1821: Programming Laboratory

Looking for 24-25 CS1821/CS1822/DC1821: Programming Laboratory test answers and solutions? Browse our comprehensive collection of verified answers for 24-25 CS1821/CS1822/DC1821: Programming Laboratory at moodle.royalholloway.ac.uk.

Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!

To complete the checkpoint you need to discuss your solution with a

teaching assistant during the checkpoint sessions. Use the box below to

make any notes that will be useful.

View this question

To complete the checkpoint you need to discuss your solution with a teaching assistant during the checkpoint sessions. Use the box below to make any notes that will be useful.

View this question

Match the following expressions with their values.

View this question

Which of the following programs is the shortest that is also equivalent to the following code?

if i % 4 == 0:

x = 0

elif i % 4 == 1:

x = 1

elif i % 4 == 2:

x = 2

else:

x = 3

0%
0%
0%
View this question

What values could the expression i % 4 evaluate to?

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

To complete the checkpoint you need to discuss your solutions with a

teaching assistant during the checkpoint sessions. Use the box below to

record any notes that might be useful.

View this question

What is the difference between the two population sizes after 50 years?

View this question

The checkpoint sheet is not complete until it has been marked by a TA. During your checkpoint marking meetings, a TA will discuss your work with you and ask some simple questions. If you show a good understanding of the code you have written, they will mark this question (and therefore the sheet) as passed.

You do not need to write anything in the box below, but may use it for notes if you wish.

View this question

We can compare the value of two numerical expressions to obtain a boolean value. Comparison operators that you might use include == (checking equality), != (checking for disequality), > (greater than), and < (less than).

What do think the value of the following expressions are?

You can check the answers by extending your program in expressions.py to print out the values of these expressions.

View this question

In Python 3, the / operator actually denotes division of floating point numbers, and Python automatically converts integers to floating point when needed. If you want to perform integer division (also called floor division) then you have to use the operator //.

Extend your program in expressions.py to compute and print out the values of the expressions above using // operator instead of /. Is the output what you expected? Floor division gives the largest integer that it smaller than the result of floating point division. Notice that this is not always the same as rounding to the nearest integer!

Enter your answers below

View this question

Want instant access to all verified answers on moodle.royalholloway.ac.uk?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!