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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Campbell Ritchie
• Ron McLeod
• Paul Clapham
• Bear Bibeault
• Junilu Lacar
Sheriffs:
• Jeanne Boyarsky
• Tim Cooke
• Henry Wong
Saloon Keepers:
• Tim Moores
• Stephan van Hulst
• Tim Holloway
• salvin francis
• Frits Walraven
Bartenders:
• Scott Selikoff
• Piet Souris
• Carey Brown

best strategy to answer this question??

Greenhorn
Posts: 23
hi pals,
can someone please tell me how can i use method of elimination for questions like this, because i believe i cant solve the whole of it during the exam, or if u ve got some other better way to have it done correct!! thank you.

public class Test{
public static void main(String args[]){
int i=oxFFFFFFF1;
int j=~i;
}}

which is decimal value of j at line 5?
A. 0
B.1
C.14
D.-15
E. compile error at line 3
F. compile error at line 4

Ranch Hand
Posts: 1272
Here is how I approach this problem.

11111111 11111111 11111111 11110001 in binary

~i means to replace every 0 bit with a 1 bit and replace every 1 bit with a 0 bit, so ~i is
00000000 00000000 00000000 00001110 in binary, which is 14 in decimal

If I can't do a bit manipulation problem quickly in my head, I do it in binary, not in hexadecimal.

Ranch Hand
Posts: 1646

Originally posted by sabah ammar:
3: int i=oxFFFFFFF1;
...
E. compile error at line 3

If that really is a lowercase o and not a leading 0 before the x, then the answer is E.

sabah ammar
Greenhorn
Posts: 23
mike thank you for the simple answer but it lead me to this one more question.can u please explain the method to convert hex - binary?

sabah ammar
Greenhorn
Posts: 23
sorry.. i just got misunderstood with the converstion, i...obviously know the hex-bin conversion.. thanks again.

Ranch Hand
Posts: 411
One more tip . If the question asked is in decimal form like this

then the value of k can be calculated as k = - ( j + 1 )

sabah ammar
Greenhorn
Posts: 23
this is something smart

Ranch Hand
Posts: 3851
Jay ,
Have you ever prepared for MBA entrance ...

Jay Pawar
Ranch Hand
Posts: 411

Originally posted by rathi ji:
Jay ,
Have you ever prepared for MBA entrance ...

My dad wanted me to do that. not me BTW where are you in India?

ankur rathi
Ranch Hand
Posts: 3851
But you should go for that ...
I am in Pune .

Ranch Hand
Posts: 4982

My dad wanted me to do that

Might be this is a bit off topic, however, personally, I believe MBA is a must nowadays for entering into management level with a easier career path.

MBA did offer you a good chance to meet with different people from different companies. And if the MBA programme is highly recognized, it really helps you to build a "network" that benefits much in your career path as you might meet "powerful" guys.

Of course, you need to have experiences on how to manage people. As said all the time, getting a certificate with no experience means nothing at all.

Nick

Greenhorn
Posts: 2
Hi Jay,

I think you wanted to type '-' instead of '+'.

For example, JLS says: "[...] note that, in all cases, ~x equals (-x)-1"

br,
Maciej

 Without subsidies, chem-ag food costs four times more than organic. Or this tiny ad: Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton