• Post Reply Bookmark Topic Watch Topic
  • New Topic
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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How's this possible ????

 
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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???
 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
here i think its just to do with wrapper classes ,and u try to print the object values,
even try out with Integer u wil get the result.
I hope i am right.
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think this question tests your ability to find out what are the keywords (and reserved words)in java.
Since string or String is not a keyword, you could use it just like any other non java word.
If you are studying only K&B, you should be able to answer this question.
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The mock exams do not give the clear picture to you.
Based upon mock exams you cannot diagnostic your level. Most of the mock exams I have seen or more complex or away from the sun objective.
Understand the concepts well , that will help lot
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
String is not a Java keyword.
So it will compile just fine.
 
Steve Liem
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should recognise all the keywords.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic