• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Answer for Chapter 6 question 18, page 331 (Java OCA 8 Programmer I Study Guide)

 
Suresh Regmi
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Little confused with the answer for question number 18. The book says(A,B,C,E).

Checked exceptions are allowed to be handled or declared. Is this option correct ?
 
Roel De Nijs
Sheriff
Posts: 10662
144
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:Checked exceptions are allowed to be handled or declared. Is this option correct ?

Checked exceptions are required to be handled or declared, so the explanation in the study guide is correct. But the list of correct answers is incorrect, it should be B, C, and E.

Hope it helps!
Kind regards,
Roel
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm wondering if this is an English thing. "Allowed" is a subset of "required". For example, suppose the law says that I am required to cross the street when the traffic light is green. I am both allowed and required to cross the street at a green light. I am not allowed to cross at a red light. (I may do so anyway when walking, but that's another story.)

I'm thinking you are both reading "allowed" as "allowed but not required". Hence my thinking it is an English thing.

I don't think answer A is wrong. I did add it to my private list of things to clarify if we do a Java 9 version of the book though.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:I'm thinking you are both reading "allowed" as "allowed but not required". Hence my thinking it is an English thing.

For me it's the interpretation of the word "allowed" (which might be related to the translation). According to answer option A (and my interpretation of "allowed") I can handle a checked exception, or I can declare a checked exception, or I can do nothing with the checked exception; all three are just fine.

I definitely would have answered this question wrong as well. I would never have selected A as a correct answer. The actual exam would have said "Select 4 correct answers". I would have immediately selected B, C, and E. And after some reconsideration, I would select A as well, because D and F are definitely wrong, so by elimination I get to the right answer (which is definitely a valuable test taking technique).

The reason why I would not select A from the beginning: for me "allowed" means "you are allowed to do so but if you don't want to do it, that's fine as well". And "required" simply means "you must do that, otherwise you'll get in (serious) problems". A real-life example: before you get on the Liberty Island ferry, you are required to go through security. On the ferry, you are allowed to buy some snacks. Explanation: if I try to hop on the ferry without going through security, I'll be in a serious pickle. But not so, if I don't buy snacks on the ferry (because I just had lunch).
Back to the question: if I don't handle nor declare a checked exception, I'll have a problem as well because the compiler will complain and won't compile my brilliant code So checked exceptions must (are required to) be handled or declared.

Additional nitpick/comment: you can also handle and declare a checked exception, that's fine for the compiler as well. If you take the "handle and declare" option into consideration for this question (which I didn't in the previous explanation) then answer option B would be wrong, because you are not required to handle or declare a checked exception, you can handle and declare a checked exception as well.

Hope it made some sense!
 
Suresh Regmi
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Roel and Jeanne for the kind reply, I agree with Roel, once you it is required(which is mandatory), you are not allowed(optional). I also think that these two rules don't fit together.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In English, everything that is required is allowed, by definition. It's what you'd call a tautology -- a statement that's true by necessity or by virtue of its logical form. Like it or not, it's true, and the test authors believe it to be true as well.

Roël, note that while you were required to go through security to board the ferry, that is also the one place via which you are allowed to enter the ferry. You are therefore allowed to go through security to board the ferry. Since you're not allowed to get on the ferry any other way, if you want to go on the ferry you are required to go that way.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ernest Friedman-Hill wrote:In English, everything that is required is allowed, by definition. It's what you'd call a tautology -- a statement that's true by necessity or by virtue of its logical form. Like it or not, it's true, and the test authors believe it to be true as well.

I asked the same question to some of my colleagues as well (all Dutch speaking) and they all selected B, C, and E as the correct answers. So it's definitely an English thingy

And I have no problem with this question, I was just trying to explain my point of view (as a non-native English speaker). On the actual exam, the number of correct answers you must select is mentioned, so this kind of subtle language differences won't be a problem. If this question would appear on the actual exam, I would be able to select the 4 correct answers by elimination, because the other 2 are 100% wrong. That's why I'm ok with this (kind of) question
 
Guillermo Ishi
Ranch Hand
Posts: 789
C++ Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:For me it's the interpretation of the word "allowed" (which might be related to the translation). According to answer option A (and my interpretation of "allowed") I can handle a checked exception, or I can declare a checked exception, or I can do nothing with the checked exception; all three are just fine.


If you have three cups and say "You are allowed to choose either A or B" it can mean actually two things. It can mean you can choose only A or B, or it can be taken to say nothing about cup C. It's pretty ambiguous. The way I would interpret "Checked exceptions are allowed to be handled or declared" is like "Checked exceptions can be either handled or declared." That statement is correct. It might imply you can also do nothing, but that's not part of the question.

Most importantly if "Checked exceptions are allowed to be handled or declared. Is this option correct ?" is a literal quote, it's incorrect English which complicates it further. The mind has to flip it into something else, because the exceptions aren't being allowed to do anything.

I say this as a native speaker of broadcast-grade MIDWESTERN English
 
Paul Anilprem
Enthuware Software Support
Ranch Hand
Posts: 3817
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guillermo Ishi wrote:The way I would interpret "Checked exceptions are allowed to be handled or declared" is like "Checked exceptions can be either handled or declared." That statement is correct.

If that is how you interpret it then the statement is not correct because checked exceptions can be handled and be declared as well at the same time.
 
Guillermo Ishi
Ranch Hand
Posts: 789
C++ Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Anilprem wrote:
Guillermo Ishi wrote:The way I would interpret "Checked exceptions are allowed to be handled or declared" is like "Checked exceptions can be either handled or declared." That statement is correct.

If that is how you interpret it then the statement is not correct because checked exceptions can be handled and be declared as well at the same time.

If I say "Paul can either be punched or kicked" it doesn't mean he can't be punched and kicked at the same time But if Paul says "Either punch me or kick me" it means he just wants one or the other...
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guillermo Ishi wrote:The way I would interpret "Checked exceptions are allowed to be handled or declared" is like "Checked exceptions can be either handled or declared." That statement is correct. It might imply you can also do nothing, but that's not part of the question.

That's it! With "allowed" you imply indeed that you can do nothing at all as well and for checked exceptions that's a definite no-go. Because we all know (or at least should know ) that checked exceptions must (at least) be handled or declared. So "allowed" seems to have a more informal/casual character than "required". With the latter one, there is no ambiguity: you must handle or declare checked exceptions or you'll be in trouble. (Note: the context of this question rules out the "handle and declare" possibility and that's why B is a correct answer)

Guillermo Ishi wrote:I say this as a native speaker of broadcast-grade MIDWESTERN English

And would you have selected A as a correct answer as well (besides B, C, and E)?
 
Guillermo Ishi
Ranch Hand
Posts: 789
C++ Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:And would you have selected A as a correct answer as well (besides B, C, and E)?

I don't see the whole question anywhere, so I don't know.

Answer me this -- If I change "Checked exceptions are allowed to be handled or declared" to "You are allowed to handle or declare checked exceptions" does it mean something different to you? The first thing has a technical glitch, but I know she meant the second thing.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guillermo Ishi wrote:I don't see the whole question anywhere, so I don't know.

I thought the OP had posted a screenshot, but clearly he didn't Here's the question.

Select the correct answers. Choose all that apply.
A. Checked exceptions are allowed to be handled or declared.
B. Checked exceptions are required to be handled or declared.
C. Errors are allowed to be handled or declared.
D. Errors are required to be handled or declared.
E. Runtime exceptions are allowed to be handled or declared.
F. Runtime exceptions are required to be handled or declared.

Guillermo Ishi wrote:If I change "Checked exceptions are allowed to be handled or declared" to "You are allowed to handle or declare checked exceptions" does it mean something different to you?

No! For me, both statements are equivalent.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guillermo Ishi wrote:
Answer me this -- If I change "Checked exceptions are allowed to be handled or declared" to "You are allowed to handle or declare checked exceptions" does it mean something different to you? The first thing has a technical glitch, but I know she meant the second thing.

I'll bite. What's the difference between those two? The fact that I don't see the difference seems like the key to why I am having trouble following this thread. And since they mean the same thing to me, I clearly mean the second thing
 
Guillermo Ishi
Ranch Hand
Posts: 789
C++ Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:
I'll bite. What's the difference between those two? The fact that I don't see the difference seems like the key to why I am having trouble following this thread. And since they mean the same thing to me, I clearly mean the second thing

The thing that's wrong with the first one is it isn't the exceptions that are being allowed to do something. It is "you" that is allowed to do something. I don't know the technical explanation for sure but I think the object of the preposition is wrong. I was fixing the English thinking it might be clearer to a foreigner. A little experiment.
 
Guillermo Ishi
Ranch Hand
Posts: 789
C++ Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:
And would you have selected A as a correct answer as well (besides B, C, and E)?

I would choose b, c, e. My reason is the repeating "allowed" and "required" in every choice makes me think the question is about what must be done, and what can be done. So I would think a and b were mutually exclusive as far as the question was concerned.

On the other hand -- if b is true, then a has to be true.
 
Paul Anilprem
Enthuware Software Support
Ranch Hand
Posts: 3817
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guillermo Ishi wrote:
Paul Anilprem wrote:
Guillermo Ishi wrote:The way I would interpret "Checked exceptions are allowed to be handled or declared" is like "Checked exceptions can be either handled or declared." That statement is correct.

If that is how you interpret it then the statement is not correct because checked exceptions can be handled and be declared as well at the same time.

If I say "Paul can either be punched or kicked" it doesn't mean he can't be punched and kicked at the same time But if Paul says "Either punch me or kick me" it means he just wants one or the other...

Strawman. You changed the voice in the two examples.
 
Guillermo Ishi
Ranch Hand
Posts: 789
C++ Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Anilprem wrote:
Strawman. You changed the voice in the two examples.

Maybe, but there are some subtleties in there. If I say "Your choices are either rocket or torpedo" I wouldn't rely on that to mean you can't hit the ship with both. But if I say "Choose either rocket or torpedo" it always means you can only have one or the other.
 
Paul Anilprem
Enthuware Software Support
Ranch Hand
Posts: 3817
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guillermo Ishi wrote:
Paul Anilprem wrote:
Strawman. You changed the voice in the two examples.

Maybe, but there are some subtleties in there. If I say "Your choices are either rocket or torpedo" I wouldn't rely on that to mean you can't hit the ship with both. But if I say "Choose either rocket or torpedo" it always means you can only have one or the other.

OK.
thank you for explaining.
 
Guillermo Ishi
Ranch Hand
Posts: 789
C++ Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
YW. You write like a 100% native speaker but in this age, who knows. I think you work for a company based in India.

Bottom line is the question is not worded as well as it needs to be. I remember going on a rant here about how my teachers in high school wrote ambiguous test questions and as a result I didn't trust test questions, then I took an online MIT course and was impressed by the quality of the test questions, like I could trust they'd be good. A cut above average, like MIT.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:The fact that I don't see the difference seems like the key to why I am having trouble following this thread.

Let's try another point of view which is not related to the meaning of an Enlgish word but from the question's context

From the answer options (all different exception/error types with "allowed" and "required"), it seems this question is testing you about your knowledge about which exceptions you must handle or declare and which exceptions you can handle or declare. From this perspective the correct answers are (without any doubt) B, C, and E. And this is probably another reason why most people will select these answers as the correct ones.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic