jQuery in Action, 2nd edition*
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
Author

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';
a=b;
and it compiles just fine without any cast!!!
Is it MindQ mistake ? What do u think ?
Thank you.
Ivan.
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
OPSSSSSS !
I was taking tests for 3 hours now & I need some rest - i completely REVERSED THIS QUESTION ! )))
Thank you !!!
Ivan
 
GeeCON Prague 2014
 
subject: MindQ test ERROR Q 14 !!!!!!!!!!!!?