Today in class we took a stab at last year's midterm as practice for this Friday's exam.
Since we didn't have time to do the answers to all questions, we'll discuss the remainder under this posting. Feel free to post your answers if you want feedback about how they would be marked.
Since we didn't have time to do the answers to all questions, we'll discuss the remainder under this posting. Feel free to post your answers if you want feedback about how they would be marked.
I have a question about the midterm. Can we assume that any code we are asked to look at will compile correctly unless otherwise stated?
ReplyDeleteYes. However, if you think a code fragment on the exam may not compile, you are encouraged to ask about it during the exam (just raise your hand).
DeleteThe PDF for this practice midterm is posted on the main course page now (for anyone who missed class or lost their copy).
ReplyDeleteNumber 18 on the pre exam exam given to us in lab
ReplyDeleteasks for a method signature. the answer on the
solutions guide is: public static int getTotalBodies()
https://docs.google.com/document/d/1G6e7dcPiKchSZ_XPybQdclAcDBn5kFJRiCFGzitKIUc/edit
but according to: http://docs.oracle.com/javase/tutorial/java/javaOO/methods.html
it would be: getTotalBodies()
so what should I do on the test?
public static int getTotalBodies(); would be the best answer. However, this question is slightly unfair because it doesn't provide much information.
DeleteI think, in class, I have been consistent about using "signature" to refer to fully-qualified signatures that specify the return type as well as the parameters, as well as any modifiers such as public, static, final, etc.
DeleteI think, despite the reference Vivek found, that the more detailed sort of signature is what people usually mean. (Check out the wikipedia article if you like.) It's also what I want you to use on the exams.
Keep in mind that you can always ask for clarification during the exam if you aren't sure what a question is asking for.