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

# Primitive Data Types

Ranch Hand
Posts: 41
• Number of slices to send:
Optional 'thank-you' note:
Consider the following question:
Which assignments are legal?
long test = 012;
float f = -412;
int other = (int)true;
double d = 0x12345678;
short s = 10;
Ans: a, b, d, and e. The other tries to cast a boolean to an int, which is illegal.
Isn't it necessary to use a calculator to find out the value assigned to d?
My question is: Can I take a calculator to the SCJP exam center to use?

Sheriff
Posts: 5782
• Number of slices to send:
Optional 'thank-you' note:
No, you can't take a calculator for the exam. If there is only one answer to be selected( look for radio-button ), then you can use the method of elimination to arrive at the best answer. If you have to select more than one, you will have to do it the hardway - using paper and pencil. These kind of questions might take more than a minute to figure out, so you should mark them( there will be a little checkbox on the top-left corner of the screen ) and review them later.
Having said that, I'm sure you can formulate some easy methods to convert from one number system to another. Also make sure you know the ranges and can make an educated guess whether the number that is being assigned fits in to a specific range.
Hope that helps,
------------------
Ajith Kallambella M.
Sun Certified Programmer for the Javaï¿½2 Platform.
IBM Certified Developer - XML and Related Technologies, V1.