• 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

On Java SE OCA exam, will there be code snippet on the first line?

 
Greenhorn
Posts: 12
IntelliJ IDE Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.

Currently, I am reading the book “OCA: Oracle Certified Associate Java SE 8 Programmer I Study Guide: Exam 1Z0-808” written by Jeanne Boyarsky & Scott Selikoff. This book is better to read and prepare to pass the Java SE 8 OCA exam.
In that book, I encountered that if the code begins with the line number for example 3 or 4, it is okay to think about the import statements, package name that are included in the question on hidden line. This is okay. But there is one point. Following is a code snippet from book:



I know that we should import ArrayList for Java compiler, and we should import Arraylist before the class keyword, otherwise, it will not compile. As you saw, on that snippet there is no more code line to write import statement.
My question is that, is there such a question on the exam? I mean, given code begins with the line 1 and we can not import any package above the class keyword? If it is, is there an answer to select "This code will not compile"?
 
Ranch Hand
Posts: 91
Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ulvi,

I don't know about the book (Jeanne's) examples, but these are the assumptions in the
Oracle's exam site.

To make the link below work remove the "A" from "/plsA/" (weird thing with the abbreviation checker)

(https://education.oracle.com/plsA/web_prod-plq-dad/db_pages.getpage?page_id=5001&get_params=p_exam_id:1Z0-808):

Assume the following:

- Missing package and import statements: If sample code do
 not include package or import statements, and the question
 does not explicitly refer to these missing statements, then
 assume that all sample code is in the same package,
 or import statements exist to support them.

- No file or directory path names for classes: If a question
 does not state the file names or directory locations of
 classes, then assume one of the following, whichever will
 enable the code to compile and run:
 - All classes are in one file
 - Each class is contained in a separate file, and all files
   are in one directory

- Unintended line breaks: Sample code might have unintended
 line breaks. If you see a line of code that looks like it
 has wrapped, and this creates a situation where the wrapping
 is significant (for example, a quoted String literal has
 wrapped), assume that the wrapping is an extension of the
 same line, and the line does not contain a hard carriage
 return that would cause a compilation failure.

- Code fragments: A code fragment is a small section of source
 code that is presented without its context. Assume that all
 necessary supporting code exists and that the supporting
 environment fully supports the correct compilation and
 execution of the code shown and its omitted environment.

- Descriptive comments: Take descriptive comments, such as
 "setter and getters go here," at face value. Assume that
 correct code exists, compiles, and runs successfully to
 create the described effect.

I understan tha Mala Gupta's book also has some tips on what
scenarios you can get with code smippets (I could not find it
right away..)


 
Mano Ag
Ranch Hand
Posts: 91
Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

And Welcome to the Ranch!
 
Mano Ag
Ranch Hand
Posts: 91
Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi,

This is from Mala Gupta's (free stuff part) book. It might be of some help.

http://ejavaguru.com/freeresources/examquestiontypes-exp.html

 
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is totally possible that you could get an exam question on code like you've posted Ulvi.
The question would be something like "What is the result of the following code snippet?".
And one option would be "Does not compile".

While there is only 70 questions on the exam, I suspect that Oracle has more then a few hundred that could be used at any point on any exam.
Given that I can not say for certain that you will get a question like this, but you should know the answer to this type of question just in case.
 
author & internet detective
Posts: 41855
904
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
What page number was that on? I think it is an errata item and we forgot the import.
 
Ulvi Mardaliyev
Greenhorn
Posts: 12
IntelliJ IDE Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mano Ag wrote:Hi Ulvi,

I don't know about the book (Jeanne's) examples, but these are the assumptions in the
Oracle's exam site.

To make the link below work remove the "A" from "/plsA/" (weird thing with the abbreviation checker)

(https://education.oracle.com/plsA/web_prod-plq-dad/db_pages.getpage?page_id=5001&get_params=p_exam_id:1Z0-808):

Assume the following:

- Missing package and import statements: If sample code do
 not include package or import statements, and the question
 does not explicitly refer to these missing statements, then
 assume that all sample code is in the same package,
 or import statements exist to support them.

- No file or directory path names for classes: If a question
 does not state the file names or directory locations of
 classes, then assume one of the following, whichever will
 enable the code to compile and run:
 - All classes are in one file
 - Each class is contained in a separate file, and all files
   are in one directory

- Unintended line breaks: Sample code might have unintended
 line breaks. If you see a line of code that looks like it
 has wrapped, and this creates a situation where the wrapping
 is significant (for example, a quoted String literal has
 wrapped), assume that the wrapping is an extension of the
 same line, and the line does not contain a hard carriage
 return that would cause a compilation failure.

- Code fragments: A code fragment is a small section of source
 code that is presented without its context. Assume that all
 necessary supporting code exists and that the supporting
 environment fully supports the correct compilation and
 execution of the code shown and its omitted environment.

- Descriptive comments: Take descriptive comments, such as
 "setter and getters go here," at face value. Assume that
 correct code exists, compiles, and runs successfully to
 create the described effect.

I understan tha Mala Gupta's book also has some tips on what
scenarios you can get with code smippets (I could not find it
right away..)




Thank you for your reply. I understood that if the question does not refer to the import statement, even if the given code begins with the line 1 and ArrayList has not been mentioned, it is okay to continue to solve the question. Yes?
 
Ulvi Mardaliyev
Greenhorn
Posts: 12
IntelliJ IDE Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mano Ag wrote:
And Welcome to the Ranch!



Thanks)
 
Ulvi Mardaliyev
Greenhorn
Posts: 12
IntelliJ IDE Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mano Ag wrote:
Hi,

This is from Mala Gupta's (free stuff part) book. It might be of some help.

http://ejavaguru.com/freeresources/examquestiontypes-exp.html



Yes. It was so helpful to me and I guessed which sort of the questions would be on the exam and I tried to solve every question on that link. Do you have the answers of the those questions? If yes, please, share them with me.
Thanks.
 
Ulvi Mardaliyev
Greenhorn
Posts: 12
IntelliJ IDE Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Pete Letkeman wrote:It is totally possible that you could get an exam question on code like you've posted Ulvi.
The question would be something like "What is the result of the following code snippet?".
And one option would be "Does not compile".

While there is only 70 questions on the exam, I suspect that Oracle has more then a few hundred that could be used at any point on any exam.
Given that I can not say for certain that you will get a question like this, but you should know the answer to this type of question just in case.



I agree with you. Also, I think the answer of the given code is "Does not compile".
if this kind of questions is on the exam, it will be easier one to answer  
 
Ulvi Mardaliyev
Greenhorn
Posts: 12
IntelliJ IDE Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:What page number was that on? I think it is an errata item and we forgot the import.



No, I don't think that it was an errata. It's been given as an example to explain the situation on the exam but  I did not get the main idea why that code has been given. Could you explain, please?

This is the way to that code snippet:
Chapter 1. Java Building Blocks - > Understanding Package Declarations and Imports -> Code Formatting on the Exam.
 
Jeanne Boyarsky
author & internet detective
Posts: 41855
904
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
Ah. You are correct that it isn not an errata. That's the example where we say in the paragraph below the code says it does not compile.

It isn't frequent, but you could get a question about a missing import.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic