• 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

badly formatted code on exam?

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
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

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):
 
Melissa Heeren
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
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

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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks - that's a lot better.
:-)
 
Author
Posts: 375
22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Enthuware Software Support
Posts: 4810
52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic