File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Type in question and octal values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Type in question and octal values" Watch "Type in question and octal values" New topic
Author

Type in question and octal values

Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2579

I thought it is more appropriate to show octal variables as a sequence of three digits, if they have only 1 digit in them (values 0 to 7), but yesterday when I keyed in value 007 for decimal 7 in one of the mocks, it was assessed as an incorrect answer in favour of 07. Is this a preferred way? Moreover, will 007 (or similar) be treated as an incorrect answer in the actual exam?
eg- what is decimal 15 in hex?
Is it 0xF or 0x0F?
I am used to writing it as 0x0F. Should I stick to it or go for 0xF?
TIA,
- Manish
[ March 18, 2002: Message edited by: Manish Hatwalne ]
Jamal Hasanov
Ranch Hand

Joined: Jan 08, 2002
Posts: 411
Hi, Manish
0x0F and 0xF values are equal.
You can test it so
public static void main(String [] args) {
int a = 07;
int b = 007;
int c = 0xF;
int d = 0x0F;
System.out.println(a);
System.out.println(b);
System.out.println(c);
System.out.println(d);
}
That's all. If you're preparing for SCJP exam, you should try everything with java code. because this way, you are understanding basic principles deeply.
Jamal
Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2579

Originally posted by Jamal Hasanov:
Hi, Manish
0x0F and 0xF values are equal.
You can test it so
public static void main(String [] args) {
int a = 07;
int b = 007;
int c = 0xF;
int d = 0x0F;
System.out.println(a);
System.out.println(b);
System.out.println(c);
System.out.println(d);
}
That's all. If you're preparing for SCJP exam, you should try everything with java code. because this way, you are understanding basic principles deeply.
Jamal

Jamal,
I *DO* understand they are same values
What I am referring to is "Type in" type of questions of the exam, where you are required to enter the answer by typing it in the TextField, in which case how you enter it *DOES* matter, and as I said earlier my answer 007 was assessed as an incorrect answer in favour of 07 by the mock engine; hence the question.
Regards,
- Manish
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
The question will make it very clear about how you should type the value in.
For instance it may say something like, type in the octal reprensentation of 16. Do not enter unneeded zeroes or spaces.
so the answer is clearly 020 because the first zero is to indicate an octal literal and the last one is part of the value.
[ March 19, 2002: Message edited by: Valentin Crettaz ]

SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2579

Originally posted by Valentin Crettaz:
The question will make it very clear about how you should type the value in.
For instance it may say something like, type in the octal reprensentation of 16. Do not enter unneeded zeroes or spaces.

Great!
Thank you
- Manish
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Type in question and octal values