• 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

Type in question and octal values

 
Ranch Hand
Posts: 2596
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2596
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Manish Hatwalne
Ranch Hand
Posts: 2596
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
reply
    Bookmark Topic Watch Topic
  • New Topic