File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes MindQ test ERROR  Q 14 !!!!!!!!!!!!? 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 "MindQ test ERROR  Q 14 !!!!!!!!!!!!?" Watch "MindQ test ERROR  Q 14 !!!!!!!!!!!!?" New topic

MindQ test ERROR Q 14 !!!!!!!!!!!!?

Ivan Ivanoff
Ranch Hand

Joined: Jan 04, 2002
Posts: 56
Hi - here is question # 14 from MindQ test:
14. Given the variable declarations below:
byte myByte;
int myInt;
long myLong;
char myChar;
float myFloat;
double myDouble;
Which one of the following assignments would need an explicit cast?
a) myInt = myByte;
b) myInt = myLong;
c) myByte = 3;
d) myInt = myChar;
e) myFloat = myDouble;
f) myFloat = 3;
g) myDouble = 3.0;
I think (a,d,f) are correct, but MinQ thinks that only (a,f) are correct !!?
I tested it with compiler like :
int a = 10;
char b = 'x';
and it compiles just fine without any cast!!!
Is it MindQ mistake ? What do u think ?
Thank you.
Jim Hall
Ranch Hand

Joined: Nov 29, 2001
Posts: 162
The answer is b & e. All the rest do not require a cast. Assigning a char to an int is perfectly fine.
Ivan Ivanoff
Ranch Hand

Joined: Jan 04, 2002
Posts: 56
I was taking tests for 3 hours now & I need some rest - i completely REVERSED THIS QUESTION ! )))
Thank you !!!
I agree. Here's the link:
subject: MindQ test ERROR Q 14 !!!!!!!!!!!!?
It's not a secret anymore!