So, what's the best answer to the old "reverse a string" question in java? Is it worth doing it via xor, or should you just use StringBuilder.reverse()?
I would say the best answer is to use StringBuilder.reverse(), based on the principle that if you find yourself reimplementing functionality that you already have in the standard API, you better have a very good reason for doing so. Otherwise you are probably just wasting your time, and the company's money.
Surely, our University graduates in Computer Science, even freshers, are far,far advanced in their training and equipment! If I were the interviewer, I would brush aside all questions on grammar and concentrate on things like J2ee technologies( RMI,RMI-IIOP,EJB,JNDI,JDBC,JAX,STRUTS,JSF) and Swing.
"One thing to note is that I try very hard to not ask trivia questions." - next paragraph - "The first thing I hit on is what is a bit and a byte" So asking what 'transient' means is trivial? I don't care if the user knows what a bit & byte is - but for a Java programmer, a question about the KEYWORD 'transient' is important......especially in the J2EE space where we are moving session objects over the wire. I stand confused???
Be honest, when you first saw transient what did you do? I bet you looked it up on Google and read the definition. And it said something like "The bytes of a transient field does not get serialized with the object and needs to be recreated manually". If you didn't understand bits and bytes and how they worked...could you have understood transient?
If you are looking specifically for a J2EE developer and serialization is important to you, then by all means, ask the question. Just please dig deeper into the candidate and determine if they really understand the definition they gave you, or if they are just repeating Google.
Asking anyone to define anything in an interview is a waste of time.
I have some programmers working with me who can tell you the meaning of any programming term, yet cannot think out of the box for the life of them. Guess what the good programmers do when they don't know a term?
Creative thinking is more important than anything. In Java or .NET, anyone can code up something with very little prior knowledge if they know the fundamental concepts of problem solving.
If you want to know if they are any good. Ask them a few logic questions that have very little to do with coding. See how they think.
Comments
binhex replied ago:
So, what's the best answer to the old "reverse a string" question in java? Is it worth doing it via xor, or should you just use StringBuilder.reverse()?
murban replied ago:
I would say the best answer is to use StringBuilder.reverse(), based on the principle that if you find yourself reimplementing functionality that you already have in the standard API, you better have a very good reason for doing so. Otherwise you are probably just wasting your time, and the company's money.
rsr replied ago:
Surely, our University graduates in Computer Science, even freshers, are far,far advanced in their training and equipment! If I were the interviewer, I would brush aside all questions on grammar and concentrate on things like J2ee technologies( RMI,RMI-IIOP,EJB,JNDI,JDBC,JAX,STRUTS,JSF) and Swing.
ak50951 replied ago:
Here are the results of our benchmarking of different types of string reversal algorithms.
http://blogs.sourceallies.com/roller/page/aaron?entry=how_to_reverse_a_string
Thomas1OF12 replied ago:
"One thing to note is that I try very hard to not ask trivia questions." - next paragraph - "The first thing I hit on is what is a bit and a byte" So asking what 'transient' means is trivial? I don't care if the user knows what a bit & byte is - but for a Java programmer, a question about the KEYWORD 'transient' is important......especially in the J2EE space where we are moving session objects over the wire. I stand confused???
Regards,
Tom
ak50951 replied ago:
Be honest, when you first saw transient what did you do? I bet you looked it up on Google and read the definition. And it said something like "The bytes of a transient field does not get serialized with the object and needs to be recreated manually". If you didn't understand bits and bytes and how they worked...could you have understood transient?
If you are looking specifically for a J2EE developer and serialization is important to you, then by all means, ask the question. Just please dig deeper into the candidate and determine if they really understand the definition they gave you, or if they are just repeating Google.
FlySwat replied ago:
Asking anyone to define anything in an interview is a waste of time.
I have some programmers working with me who can tell you the meaning of any programming term, yet cannot think out of the box for the life of them. Guess what the good programmers do when they don't know a term?
Creative thinking is more important than anything. In Java or .NET, anyone can code up something with very little prior knowledge if they know the fundamental concepts of problem solving.
If you want to know if they are any good. Ask them a few logic questions that have very little to do with coding. See how they think.
Voters For This Link (13)
Voters Against This Link (1)