Midterm (AY21/22)

Problems

4. Data Type Conversion

There is only one point to note down in this problem, that is when you assign a double to a long ,the numbers after the floating point will be trauncated.

For example,

long x = 2.00 - 1.00; // x will be 1

7. Assertion

One tip is that when doing questions about assertion or loop variant, check all the options since there are likely to have some trivial one!!!

8. Logical Expression*

A good question that tests your Truth Table Method, good to try again!

12. Recursion*

Another awesome question worth trying again to test the recursion thinking.

Last updated