• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to interpret a question ?

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 !
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Cowgirl and Author
Posts: 1589
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Shafkat Talli
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic