wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes how to interpret a question ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "how to interpret a question ?" Watch "how to interpret a question ?" New topic
Author

how to interpret a question ?

Shafkat Talli
Ranch Hand

Joined: Aug 01, 2003
Posts: 30
I've done one of the MasterExams from the Kathy & Bert study guide. I got this question with two PUBLIC classes:
-------------------------------------------
Given the following:
public class A{
public void m1(){
System.out.print("ma");
}
}
public class B extends A{
public static void main(String [] args){
A a = new B();
a.m1();
}
public void m1(){
System.out.print("mb");
}
}
-------------------------------------------
What is the result (choose one) ?
A) ma
B) mb
C) mbma
D) Compilation fails
E) An Exception is thrown at runtime
THE ANSWER GIVEN IN THE EXAM IS B.
I WENT FOR D, CAUSE I INTERPRETED THE CODE AS BEEING PLACED IN ONE SOURCE-FILE AND THEREFORE 2 PUBLIC CLASS ARENT ALLOWED.
MY QUESTION TO U PPL IS, CAN I GET THIS TYPE OF QUESTION ON THE REAL EXAM, AND IF YES, DO I INTERPRET IT ALWAYS TO BE IN TWO SEPARATE FILES IF THERE ARE 2 PUBLIC CLASSES STATED, WITHOUT ANY MORE INFORMATION GIVEN ???
THIS WAS FRUSTRATING
ANOTHER QUESTION -> IS THERE STATED ON EVERY SINGLE QUESTION WHAT OBJECTIVE THE QUESTION IS TAKEN FROM ? I DONT THINK SO, BUT IM JUST ASKING CAUSE THIS MASTEREXAM HAD IT !


---------------------------<br />Shafkat Talli<br />SCJP 1.4, August 2003.
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
1o) there should be an error in the question, related to public classes in the same java file. But your answer is also incorrect because it does not throw a runtime exception. It'd throw a compile-time error.
MY QUESTION TO U PPL IS, CAN I GET THIS TYPE OF QUESTION ON THE REAL EXAM, AND IF YES, DO I INTERPRET IT ALWAYS TO BE IN TWO SEPARATE FILES IF THERE ARE 2 PUBLIC CLASSES STATED, WITHOUT ANY MORE INFORMATION GIVEN ???
You can get questions like this in the exam. What you should pay attention to is the code and the line numbering. If the lines are numbered, starting from line # 1, it means it's a whole file. But if it starts at any other number, it's because it is a code snippet. The questions are very specific and well written, you shouldn't have any problem with ambiguity.
ANOTHER QUESTION -> IS THERE STATED ON EVERY SINGLE QUESTION WHAT OBJECTIVE THE QUESTION IS TAKEN FROM ? I DONT THINK SO, BUT IM JUST ASKING CAUSE THIS MASTEREXAM HAD IT !
The exam does not state any objective. It'd be damn easy that way. You can get a complex question on threads and you might spend a lot of time trying to figure out what it prints, but it can happen that the top level class was declared private, for example, throwing a compiler error immediately.


I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
Kathy Sierra
Cowgirl and Author
Ranch Hand

Joined: Oct 10, 2002
Posts: 1572
Howdy,
We should have been much more explicit and stated that these two classes were NOT in the same file. I *can* tell you that this is not an issue in the real exam.
For one thing, as the previous post said, the line numbers are given to suggest that these may be different files. If the numbering starts at 1 and continues without missing a line, then you're looking at a single source file. If the numbering does NOT start at 1, then you're looking at a code snippet and not a complete file.
BUT... you will NEVER be tested on something that requires you to get your information from the line numbering. In other words, the line numbering is just there to help make things more obvious, but NEVER to be used as part of your question.
If you WERE going to be tested on whether you knew that two public classes could not be in the same file, it would either EXPLICITLY say, "Given two classes in the same file..." OR it would just be a statement like,
What is true about source code files?
A) You can have more than one public class in a source code file.
[which you would NOT select as the right answer...]
I hope that helps, and we're sorry for the confusion!
This stuff is confusing enough already...
cheers,
Kathy


Co-Author of <a href="http://www.amazon.com/exec/obidos/ASIN/0596007124/ref=jranch-20" target="_blank" rel="nofollow">"Head First Design Patterns"</a><br /> <br />Just a Jini girl living in a J2EE world.
Shafkat Talli
Ranch Hand

Joined: Aug 01, 2003
Posts: 30
Thanx Kathy, i'm not confused anymore ,
just wanna say ur study guide is really really good !
recommend it to everyone takin da exam !
[ August 18, 2003: Message edited by: Shafkat Talli ]
 
GeeCON Prague 2014
 
subject: how to interpret a question ?