This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Associate Certification (OCAJP 7/8) and the fly likes badly formatted code on exam? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Associate Certification (OCAJP 7/8)
Bookmark "badly formatted code on exam?" Watch "badly formatted code on exam?" New topic
Author

badly formatted code on exam?

Melissa Heeren
Greenhorn

Joined: Feb 26, 2013
Posts: 6
In addition to preparing myself for the exam, I teach advanced high school students in a magnet program, and my top kids are going to sit for the exam. We're using a variety of resources to prepare, including LearnKey OnlineExpert and Enthuware. The sample questions on the Oracle site have "ugly" code - no indentation, etc. Is this what we'll see on the exam? When I'm trying to figure out ugly code, the first thing I do is format it to make it readable. If that's the game here we'll learn the rules and play to win. But I don't want to spend precious test prep time on something we won't face on the test. (FWIW, I've seen REALLY ugly real-world code - in various assembly languages :-) )

Thanks in advance.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5300
    
  13

Melissa Heeren wrote:Is this what we'll see on the exam?

Yes, it is.

Something like this code snippet could be easily on the exam (wrong indentation just to try to fool you):


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Melissa Heeren
Greenhorn

Joined: Feb 26, 2013
Posts: 6
Actually that seems fair. I'm talking about NO indentations, at all. Here are the samples I'm referring to:

public class Sequence {
Sequence() { System.out.print("c "); }
{ System.out.print("y "); }
public static void main(String[] args) {
new Sequence().go();
}
void go() { System.out.print("g "); }
static { System.out.print("x "); }
}

and

public class MyLoop {
public static void main(String[] args) {
String[] sa = {"tom ", "jerry "};
for(int x = 0; x < 3; x++) {
for(String s: sa) {
System.out.print(x + " " + s);
if( x == 1) break;
}
}
}
}

and


interface Rideable {
String getGait();
}
public class Camel implements Rideable {
int weight = 2;
public static void main(String[] args) {
new Camel().go(8);
}
void go(int speed) {
++speed;
weight++;
int walkrate = speed * weight;
System.out.print(walkrate + getGait());
}
String getGait() {
return " mph, lope";
}
}



etc. Basically, ALL of the sample questions on the Oracle site have NO indentation at all. That's not what I've seen on the practice tests so far - some trick nesting notwithstanding. Is this what we should expect on the exam?

Thanks,
MJH
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5300
    
  13

Melissa Heeren wrote:Is this what we should expect on the exam?

In the previous exams I took (I didn't take the OCAJP 7 yet) such questions didn't appear on the exam, the code was always indented.

The Sequence class (in previous exams) will be presented as follows:
Melissa Heeren
Greenhorn

Joined: Feb 26, 2013
Posts: 6
Thanks - that's a lot better.
:-)
Mala Gupta
Author
Ranch Hand

Joined: Sep 27, 2002
Posts: 251
    
    9
Melissa,

As Roel mentioned, the code isn't very badly indented in the exam.

Oracle has confirmed that the incorrectly indented code in the sample questions at their website is a webpage display issue. You can scroll down the blog enty - Prepare For Your Oracle Certification At OpenWorld and JavaOne, at Oracle.com and look for confirmation comments by Brandye Barrington (from Oracle).

With respect,
Mala


Author of Manning's OCA Java SE 7 Programmer I Certification Guide and OCP Java SE 7 Programmer II Certification Guide
Paul Anilprem
Enthuware Software Support
Ranch Hand

Joined: Sep 23, 2000
Posts: 3305
    
    7
Melissa,
We haven't observed messed up indentation in the real exam, unless the question tests something about indentation such as the if/else mentioned above. We don't have badly indented code in our mock exams for the same reason.

HTH,
Paul.


Enthuware - Best Mock Exams and Questions for Oracle/Sun Java Certifications
Quality Guaranteed - Pass or Full Refund!
 
GeeCON Prague 2014
 
subject: badly formatted code on exam?