4 ms·
I went through your solutions and I must disagree. Your solutions did not generate the correct output for the questions. For example, I'll take the following q
by nps 16y ago
I went through your solutions and I must disagree. Your solutions did not generate the correct output for the questions.
For example, I'll take the following question :
'Given the string variable 's' and the integer 'n', return a new string consisting of n repetitions of s.
For example, if s = "abc" and n = 3, you should return "abcabcabc".'
The code you have written is as follows :
String duplicate(String s, int n)
{
String result = s;
// First assignment already done
while (n > 0) {
result += s;
n--;
}
return result;
}
If we analyze the following code (assuming that s = "abc" and n = 3), initially, the variable 'result' is assigned the value "abc".
The loop then runs 3 times - when n = 3, when n = 2 and when n = 1. Which effectively means that "abc" is concatenated 3 more times giving the string "abcabcabcabc", which is incorrect.
I do agree that the solution is almost right. Note that you are allowed to compile your code and run it against our testdata (and even your own test cases) in order to establish it's correctness - which means that you did have the opportunity to find out that there was a bug in your code and fix it.
But in computing, how often is it acceptable to get things 'almost' right ? Would you be happy if Google returned search results which were almost right ?
I know that if a human conducted the interview, he would have helped guide you through the test - in fact, we are almost done adding the capability for recruiters to monitor test sessions in real time and converse with candidates.
I can also provide a case by case analysis of your other solutions if you wish.
- ismarc 16y agoquestion 2 of 6 for duck: Write code to trap these exceptions and return 1 if a FineException is thrown and return 0 if a CoarseException is thrown. int exceptionTrap(int a) { try { exceptionThrower(a); } catch (FineException fe) { return 1; } catch (CoarseException ce) { return 0; } return -1; } You're saying the above is invalid? Tests out perfectly fine on my system...are you trying to say there shouldn't be the last return because you say "You may assume that an exception is always thrown"? If a function returns a type of int, all codepaths then need to return a type of int, programming 101. Others indeed do have some errors as I quickly typed them up (off by 1, forgetting that java array length isn't the same as C++ std::vector.size). Number 3 could definitely use a better example, such as a = 12 (so the result would be {12, 11, 10}. I admit, I checked number 2 closely, saw a horribly invalid failure reported and only glanced over the rest. Independent of the other failures, you cannot have incorrectly graded questions, and the rest of the points still stand, the requester has nothing to compare against, leaving the judgement up to your pass/fail (which is clearly not 100%) and the random assignment of questions to different test takers results in no real comparison ability between skills.
- deleted 16y ago[deleted]
- nps 16y agoYou're right about question 2, my apologies. There indeed was a bug in the test data for that question (which we have fixed now). However, the rest of the questions given in the test work properly. The reason different test takers get (somewhat) different question sets is because our algorithm alters the difficulty of the questions based on the test taker's performance. I.e. if you did the first few questions well, you'd start getting progressively tougher questions. On the other hand, if you do badly, you'll be given successively easier questions.