Win a copy of Rust Web Development this week in the Other Languages forum!

Vineet Sharma

Ranch Hand
+ Follow
since Dec 30, 2000
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Vineet Sharma

Dear Gayathri,
Sorry to hear that you could not make it. I am sure you will pass the next time. Here are my observations about the exam...
1. I think, as the computer picks randomly from a pool of questions, it is possible that you may end up getting a lot of "not so easy" questions. I was getting b/w 75% to 85% in the mock quetions, but was baffled at the real exam. It was so tough!!! All the same I know a lot of people who say that their exam was very easy.
2. A very good strategy would be to nest questions or concepts in a single question. I realised there were many questions like this in my own exam. For example, make a question on switch. Pass a parameter(to the switch case) which requires some conversion or casting. Further this parameter comes from the main method through a method call! You may also add this in a try/catch block.
3. Make your own simple code/ questions and play around with it. Doing this helped me clear a lot of concepts.
4. Take a printout of the mock question paper. Try running the code based questions by making little variations here and there.Eg.
char c = 'a'; //legal
char c = a; //illegal
char c = 9; //legal
char c = '9' // legal but
char c = '10' //illegal! and
char c = 10 //legal!
I wish you all the best in your exam and life. Don't get disheartend...
Gunjan Sharma
20 years ago
Dear Ramani,
Please send me the list of such websites
Thanks
Vineetm@aol.com
20 years ago
Hi Nitin,
1. Simply do All the questions in IO, from All the mock exams available on the net + go through Robert & Heller book (Chapter 13 and its Questions) and you can get 100% in IO.
2. I got 1 question from Collections: theoritical.
Best of luck,
Vineet Sharma
20 years ago
Hello to all,
I would first thank everybody at Java Ranch for doing such a great job! Special thanks to all the moderators... I cleared the coveted exam on March 24th. I could not have done it without your help.
Now, my experience with the exam:
Firstly, my confidence was washed over by the first ten questions, on IO and threads. I was not well prepared for these two topics and as questions, on these two topics, came pouring in one after the other I wondered whether they would ever end or not. So, do not loose heart if the first few questions seem difficult.
I could have got a few more questions correct had I not been so nervous and disheartened at these questions.
Secondly, be very thorough with the fundamentals. I was so good at flow control but was knocked off by a nested for loop question. What I thought was the answer appeared no where in the choices! The questions never try to trick you (as some of the mock questions do) but they may seem difficult if the concepts are not very clear.
Thirdly, I found the exam to be tougher than most of the standard mock exams on the net. On a scale of 1 to 10, if mock exams get 6marks for toughness the real exam gets 8!
Fourthly, the best way to answer multiple choice questions is by elimination. That is, once you have selected your answer(s), read the other options carefully and compare those statements with the answers you selected. Also never leave any answer unattended since there is no negative marking.
Last but not the least be very attentive.
If you have worked hard nobody can stop you from getting it. All the best...
Regards,
Vineet Sharma
20 years ago
Hi,
char is "narrower" than int. Then how come the following does not give any error. (Note that no casting has been done.)
char c = 32;
Regards
Vineet
Hi,
char is "narrower" than int. Then how come the following does not give any error. (Note that no casting has been done.)
char c = 32;
Regards
Vineet
20 years ago
Thank You Abhijeet
20 years ago
Thank You Axel ! Your concepts seem to be crystal clear!
20 years ago
Please explain the following:
1) try{
FileInputStream dis = new FileInputStream("Hello.txt"); //Are we not creating a file here?
}catch(FileNotFoundException fne) {
System.out.println("No Such File Found");
return -1
}
catch(IOException ioe){
}
finally{
System.out.println("Doing Finally");
}
return 0;
}
}
Ans is :
No Such File Found, Doing Finally , -1
1. I Think We Are Creating File At The Commented Line.
2. Why is the order of output not : No Such File Found, -1, Doing Finally.
(-1 is in returned first)
2). String s1 = new String("Hello");
String s2 = new String("there");
String s3 = new String();
s3 = s1+s2;

The above compiles fine and outputs Hello there. Can We Concatenate two STRING OBJECTS ?

3) Which is correct:
Vector v = new Vector();
v.add("99");
OR
Vector v = new Vector();
v.addElement("99");

4) DataInputStream d = new DataInputSream(System.in);

DataInputStream takes a parameter of low lenvel stream, but System.in is an example of high level stream, then why is the above correct ?

Regards
Vineet
20 years ago
Hello and Greetings,
Please explain the following:

1) public class Emp{
int i[] = {0};
public static void main(String args[]){
int i[] = {1};
change_i(i);
System.out.println(i[0]);
}
public static void change_i(int i[]){
int j[] = {2};
i = j;
}
}
If arrays behave like objects the answer should be 2. But the correct answer is 1. Why?

2. Is the following legal ( ie,Are two package statements legal?).
package pkg;
package pkg2;
import java.awt.*;
class c{};

3. I think following should give error because we are trying to put int in to char with out cast. But it compiles fine. Why?
char c = 32; //is Legal.

4. byte x = 3;
x = ( byte ) ~ x ;
System.out.println(x);

I think x can be -4 as well as 252, but the correct answer is -4. Please explain.

Reason for 252:
Binary of byte x = 3: 00000011
~3 = 11111100 = 252

5. Does delete() in the File class actually delete a file or just deletes an instance of the File Class?
Regards
Vineet
20 years ago
Hello to all,
I am appearing for the programmer exam on Friday, March 23rd. I am extremely nervous.
I have no programming experiance. I have studied from Robert & Heller (for 2 1/2 months)and am scoring around 65% to 75% in mock questions. Initially I felt O.K but lately the experianc eof some of the Ranchers have not been very good. And they that mock exams are no where close to the real thing!
I would highly appreciate any help and advice of any kind at this point. If anyone can give a fair evaluation of the exam.
Thanks
Apprehensively...
Vineet Sharma
20 years ago
Art,
Thanks a lot for your help. Your method makes things very easy.
Thanks again,
Vineet

Originally posted by Art Metzer:
Hi, Vineet.
A little rule that I use when I need to represent negative numbers in binary is
~i = -i-1.
That is, the bitwise inversion of "i" is equivalent to negative "i" less one.
In your example, you're looking for the binary representation of -192. Since -192 = -191-1, the following statement is true:
~191 = -192.
So if we can find the binary representation of 191, then invert all its bits, we will have the binary representation of -192.
This computation requires us to know which data type we are working with: since you didn't specify, I'll assume we are working with ints (32 bits).
191 = 2**7 + 2**5 + 2**4 + 2**3 + 2**2 + 2**1 + 2**0
+191 = 00000000 00000000 00000000 10111111
then
~191 = 11111111 11111111 11111111 01000000 = -192.
I hope this helps, Vineet.
Art


20 years ago
Sridevi,
Thanks for the example. However, doing the same for -192 does not seem to work.
Can you please let me know what you arrive at as the solution.
Thanks,
Vineet

Originally posted by Sridevi Shrikanth:
Negative numbers are represented as 2's complement.
Let me take a simple no: 41
Its binary rep is : 00101001
Taking 2's complement is as follows:
Negate the bits and add one to the result:
Negating the bits: 11010110
Add 1 : 11010111
so -41 is 11010111
Hope this helps


20 years ago
How can arrive at the binary representation of -192?
I understand how this works for positive numbers, but negative numbers are confusing.
Any feedback will be appreciated.
Thanks,
Vineet
20 years ago
.... but it is still not clear. Why do mock exams have questions from this chapter?