• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Chapter 1 review question 14 about packages (Java OCA 8 Programmer I Study Guide, Sybex)

 
Greenhorn
Posts: 4
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Something about this question doesn't seem right to me, and it may just be the way the wording is phrased.

Given the following class in the file /my/directory/named/A/Bird.java:
INSERT CODE HERE
public class Bird { }

Which of the following replaces INSERT CODE HERE if we compile from /my/directory? (Choose all that apply)

A. package my.directory.named.a;
B. package my.directory.named.A;
C. package named.a;
D. package named.A;
E. package a;
F. package A;
G. Does not compile.



A class can be compiled from anywhere in the directory structure on the command line, and it does not change the package structure, or change the runtime properties. So long as it matches the folder structure, and I run it from within that folder using the dot separator then it works fine. So the answer should be "B", "D" and "F" are all possibilities. Just because it was compiled from within /my/directory doesn't really mean anything.
 
author
Posts: 23958
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please QuoteYourSources.

Henry
 
Steve Phelps
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, it was pulled from the OCA Oracle Certified Associate Java SE 8 Programmer I Study Guide book by Jeanne Boyarsky and Scott Selikoff.
 
author & internet detective
Posts: 42074
933
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Brian,
Welcome to CodeRanch! I've edited the subject of this thread to make it obvious which book the question is about.

That it is true. It goes beyond the scope of the exam though. It sounds like you have some (or a lot) of Java knowledge already. The OCA is a basic exam which means you are going to need to put aside some of that knowledge at times and pick the simplest answer.

Another way to think about is that the exam doesn't test knowledge about compiler options. It does test knowledge of package. So seeing a question like is a clue that the question is about packages.

On the real exam, you'll have another clue - the number of correct answers. If you see 4 possible correct answers and the exam asks you to choose 2, you should pick the most obvious/simplest two.
 
Steve Phelps
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:Brian,
Welcome to CodeRanch! I've edited the subject of this thread to make it obvious which book the question is about.

That it is true. It goes beyond the scope of the exam though. It sounds like you have some (or a lot) of Java knowledge already. The OCA is a basic exam which means you are going to need to put aside some of that knowledge at times and pick the simplest answer.

Another way to think about is that the exam doesn't test knowledge about compiler options. It does test knowledge of package. So seeing a question like is a clue that the question is about packages.

On the real exam, you'll have another clue - the number of correct answers. If you see 4 possible correct answers and the exam asks you to choose 2, you should pick the most obvious/simplest two.



Hey Jeanne,

Thanks for taking the time to respond so quickly. Yeah, I have a lot of Java experience, and I'm trying to bring my knowledge up to date with Java 8, and plan to take the OCA 8 and then OCP 8 exams now that my employer will pay for it. Thanks for the advice on the exam. I had read that it would specify the number of correct answers, which will help greatly. So I'll continue to keep that in mind as I go through chapter by chapter in the book.

Thanks again!

Brian


 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Brian James,

First of all, a warm welcome to CodeRanch!

Brian James wrote:Yeah, I have a lot of Java experience, and I'm trying to bring my knowledge up to date with Java 8, and plan to take the OCA 8 and then OCP 8 exams now that my employer will pay for it. Thanks for the advice on the exam. I had read that it would specify the number of correct answers, which will help greatly. So I'll continue to keep that in mind as I go through chapter by chapter in the book.


Having a lot of Java experience is not always an advantage when you prepare/take the OCA exam. Because as Jeanne said, it's an entry-level exam and focuses on the basics. But because you have much more experience and knowledge, and therefore assume/know things which could affect your answer (as this question showed).
In such a question it's very important to be aware of the "context of a question". This question only has answer options with package statements and in the question itself the directories where the Java source code file resides and from where the source code file will be compiled is the same, so it's clearly about choosing the most appropriate answer. In this thread you'll find a nice discussion about this "context of a question", it's definitely worth reading.
On the actual exam you know for each question how many correct answers you have to select. That's really helpful! Because you know how many answers to select, so if you have 1 obvious answer but the question states to select 2 you know you need to select another one (which you otherwise probably not would have selected). When I took the OCA7 exam, I even had to select an answer with a compiler error because all other answers were definitely incorrect!

Hope it helps!
Kind regards,
Roel
 
Steve Phelps
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Roel De Nijs wrote:Hi Brian James,

First of all, a warm welcome to CodeRanch!

Brian James wrote:Yeah, I have a lot of Java experience, and I'm trying to bring my knowledge up to date with Java 8, and plan to take the OCA 8 and then OCP 8 exams now that my employer will pay for it. Thanks for the advice on the exam. I had read that it would specify the number of correct answers, which will help greatly. So I'll continue to keep that in mind as I go through chapter by chapter in the book.


Having a lot of Java experience is not always an advantage when you prepare/take the OCA exam. Because as Jeanne said, it's an entry-level exam and focuses on the basics. But because you have much more experience and knowledge, and therefore assume/know things which could affect your answer (as this question showed).
In such a question it's very important to be aware of the "context of a question". This question only has answer options with package statements and in the question itself the directories where the Java source code file resides and from where the source code file will be compiled is the same, so it's clearly about choosing the most appropriate answer. In this thread you'll find a nice discussion about this "context of a question", it's definitely worth reading.
On the actual exam you know for each question how many correct answers you have to select. That's really helpful! Because you know how many answers to select, so if you have 1 obvious answer but the question states to select 2 you know you need to select another one (which you otherwise probably not would have selected). When I took the OCA7 exam, I even had to select an answer with a compiler error because all other answers were definitely incorrect!

Hope it helps!
Kind regards,
Roel



Thanks Roel for the extra tips and the link to the thread on context. At this point I will be spending a fair amount of time learning how to study and take the test as much knowing the material. I know a great deal of it already, but honestly I'm a terrible test taker under pressure. So I'll be doing all the practice exams, and making sure I ask about questions like these when I don't have a high degree of certainty.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Brian James wrote:I know a great deal of it already, but honestly I'm a terrible test taker under pressure. So I'll be doing all the practice exams, and making sure I ask about questions like these when I don't have a high degree of certainty.


If you are using Enthuware mock exams, it might be very useful to read this thread as well. So you don't make the mistake of rushing through all the mock exams.
 
To avoid criticism do nothing, say nothing, be nothing. -Elbert Hubbard. Please critique this tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic