This question has been taken from Voodo Exam
Test Engine-Pooja_Exam. The test engine can be downloaded at
http://www.geocities.com/gnashes30/java/mock.htm //Question :
//What is the output of the following class file when compiled & run ?
class Test34 {
public static void main (
String args [ ] ) {
String String = " Hello String " ;
System . out . println ( String ) ;
}
};
/*
Options :
a . Compiler error - String is an invalid variable name
b . Compiler error - can't print a class name since no reference exists
c . Exception thrown at runtime
d . Compiles fine & prints " Hello String " when run
*/
Surely you will go for option a. Isnt it ??? Or, at least you (I thought) that the answer is a.
But wait�..today is my/your (I don�t know about uts)dooms day.
The answer is d. Can you imagine that the above code will compile and run fine ??? At least I couldn�t.
But the learning behind the code is object reference name can be exactly same as the class name
So the following compiles fine
Test34 Test34=new Test34();
I am surprised as usual, but I don�t think such question will be asked in the exam. This is because, the real exam I quite strict about the �exam objectves� mentioned on the sun�s website. The real exam never deviates ands asks such �compile-run-and-discover� questions. I am very much sure about this based on the feedback from the people who have passed the exam.
Another stupid types of question are
�passing null as an argument to a method and asking which method will be invoked.
�Find which of the following are legal octal literals (on must know all conversion methods between the number systems)�especially when all start with 0.
�Some unknown methods from the Collections/Thread class
�Whether Void, ThreadGroup, Class, ClassLoader etc are final ???
�The real exam will contain questions that are very much similar (harder) to K&B questions� � Is this assumption valid ???
Its very frustrating to sort out such questions from the exam and then solve the test. Besides, an exam having such questions doesn�t help you gain confidence in giving tests . Its very important to develop test giving practice.
What do you think???
The mock exams available on the web do not test the concepts, but rather have some of such stupid questions. This keeps my scores low and I am not able to judge my exact preparation status. Excluding such questions, I scored 80% in the exam (this question was taken from a mock exam). As per my calculation, my score is 80%, but as per the software (including questions on AWT, and such other stupid questions) score is 65%.
I am very much sure about this based on the feedback from the people who have passed the exam.
What do you think???