Win a copy of Android Programming: The Big Nerd Ranch Guide this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

OCA Exam question formating.  RSS feed

 
Suresh Regmi
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If code starts without the line number, it does not have the package and import information as well.



I am little confused with this kinds of questions, do I assume they are in same package? different package? Your suggestion is appreciated.
 
Simon Roberts
Author
Ranch Hand
Posts: 176
9
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In general, information that is missing from the question should be assumed to support the "obvious expectation", and certainly will never be a cause for compilation failure.

I'm pretty sure that in the real exam you won't see a question like the one you drafted, where package access makes a difference, that fails to tell you the package relationship between the classes. You might see it in practice exams, but you shouldn't see it in the real thing. That said, I don't have the questions here in front of me, so I can't state that with absolute certainty.
 
Roel De Nijs
Sheriff
Posts: 11200
174
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suresh Regmi wrote:I am little confused with this kinds of questions, do I assume they are in same package? different package? Your suggestion is appreciated.

From K&B7:
K&B7, Question Format, Multiple-Choice Questions wrote:The real exam typically numbers lines of code in a question. Sometimes we do not number lines of code—mostly so that we have the space to add comments at key places. On the real exam, when a code listing starts with line 1, it means that you're looking at an entire source file. If a code listing starts at a line number greater than 1, that means you're looking at a partial source file. When looking at a partial source file, assume that the code you can't see is correct. (For instance, unless explicitly stated, you can assume that a partial source file will have the correct import and package statements.)


Furthermore, if they want to test your knowledge about packages and access modifiers for example, the questions on the real exam will clearly mention the different packages (and source files). So if you see a code snippet like that, you can assume that all classes are in the same source file (and thus package).

Here is some very important advice: NEVER assume something which is not mentioned in the question. So if class A, B, and C would be in a seperate package, that will definitely be mentioned in the question!

Hope it helps!
Kind regards,
Roel
 
Paul Anilprem
Enthuware Software Support
Ranch Foreman
Posts: 4031
33
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. The information given above about real exam questions typically containing line numbers is obsolete. They followed this format earlier but they do not anymore. We have seen that most of the questions in fact do not contain any line numbers. Questions that require you to focus on specific lines in the code, put the line numbers in comments like so:

Options that need to refer to a line of code will then refer to the line of code like this: Compilation failure at //line 1.

This is the format we have been following in our questions as well (because it is easy for a reader to just copy paste the code into their java file and compile/execute it).

2. You will see a lot of code in real exam that omits a lot of details such as package and import. Many are just code fragments without any wrapping method or a class. Again, no line numbers. You just have to assume that all information that is not provide does not affect the answer. In the code that you mentioned above, there is no package statement, that means all the code belongs to the default package. No need to assume anything here. Most of the time it is just common sense. You will easily figure that out as you attempt more and more questions.
 
Roel De Nijs
Sheriff
Posts: 11200
174
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Anilprem wrote:1. The information given above about real exam questions typically containing line numbers is obsolete. They followed this format earlier but they do not anymore. We have seen that most of the questions in fact do not contain any line numbers.

That's good to know! I have to admit, I took the OAJP7 exam only 6 months ago and can't remember this one.

Paul Anilprem wrote:2. You will see a lot of code in real exam that omits a lot of details such as package and import. Many are just code fragments without any wrapping method or a class. Again, no line numbers. You just have to assume that all information that is not provide does not affect the answer.

I do remember this one from the OCAJP7 exam. It makes the code evaluation part a bit easier because you have to assess less code to see if the code compiles or not.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 36875
481
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In our book, we used line numbers a lot so we could refer to them in the answer explanation! On the exam, I didn't see any/many questions with line numbers either. We kept the guidance about line #s in the book anyway in case an older question sneaks though.

I didn't see any questions where the only problem was a missing import anyway. Besides you do get a random subset of the questions, so I wasn't comfortable saying that it never happens.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!