Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Possible Duplicate:
Is using build-in sorting considered cheating in practice tests?

I'm studying for a Java exam at the university. In your opinion, could I use, during the exam,

Arrays.sort(intArray);

instead of creating my own algorithm? How would you judge it, if you were the professor?

share|improve this question

marked as duplicate by Justin Cave, unholysampler, Blrfl, Robert Harvey, ChrisF Aug 30 '12 at 21:19

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

5  
Is there a reason you don't ask the professor? Different professors running different classes at different universities with different goals for the class will give very different answers. It isn't possible to give a general answer. And a general answer isn't helpful to you-- presumably, you only care about whether your particular professor teaching your particular class in your particular university wants to allow you to use the built-in collection library. –  Justin Cave Aug 30 '12 at 20:38
add comment

2 Answers 2

up vote 1 down vote accepted

This is really dependent on the class and you should ask the professor. That said, in my experience as a CS student, if the question doesn't involve sorting algorithms then you don't need to waste the grader's time writing one out and can use Arrays.sort. i.e. if the question is about I/O, then your answer is going to be graded based on your understanding of I/O, not of sorting algorithms.

share|improve this answer
    
Let's pretend the question is "Given a twodimensional array, do something and then do something else. Store the sorted results in a stack". Is it legitimate to use the built-in library? –  Surfer on the fall Aug 30 '12 at 20:49
1  
Up in the air. Raise your hand and ask the professor. –  Andrew Latham Aug 30 '12 at 21:00
    
If you are asking this to find out whether or not to study things like that, you'd be surprised how much you can remember on a test when your grade depends on it. Just glance at bubble sort a few times (it's the easiest one to remember IMO) and you'll probably be able to either recall it or re-invent it on the test. –  Andrew Latham Aug 30 '12 at 21:01
add comment

In my experience the exams explicitly state if you can use library methods or not. Fairly usual exam question would be that certain library is off limits and you are to build similar functionality. If in doubt, ask beforehand.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.