nus-cs2113-AY2122S1 / forum

3 stars 1 forks source link

Mock Exam Qns #164

Open SeanRobertDH opened 2 years ago

SeanRobertDH commented 2 years ago

Qn 4 image

Hi Prof Akshay, with regards to this question, I was wondering why it is not a coding standard violation to not declare 5 at line 2 as a constant? Is it not a coding standard violation in that it is a magic literal?

SeanRobertDH commented 2 years ago

Qn 8 image Is the UML diagram also not missing a condition in this diagram? image

SeanRobertDH commented 2 years ago

Qn 10 image

Without the constructors being included in the class diagram, Wouldn't it be wrong to assume that we can create a new Box with zero parameters? Because it's entirely possible that the constructor must have parameters but we do not have that information from the diagram.

okkhoy commented 2 years ago

Hmm for Q4:

Is it not a coding standard violation in that it is a magic literal?

Yes!

Q8: <being cheeky!> This error is not in the options. <being serious!> yes, this is an error that was missed in the image. (wrt answering the question, see above!)

okkhoy commented 2 years ago

Q10: The underlying assumption is everything is available in the code (but I think I understand your argument).

SeanRobertDH commented 2 years ago

Thanks Prof @okkhoy for the quick reply!

Yeahh, Qn 10 seems kinda ambiguous given that the constructors were not included in the diagram.. I can't say that there is a constructor that accepts no variables so I would not know for certain if the code would compile..

okkhoy commented 2 years ago

hmmm since i saw a follow up question, I waited for a bit to answer if there are any more in the pipeline :-)

Yup. Understood your argument. If you find such ambiguities (hopefully none!) please include your argument/justification/assumption in the note->feedback so that I can take a look.