5 ms·
TripleByte is awful. Take a look at the question they just asked me when I was doing their General Coding Assessment: What is the output of the following
by guessmyname 5y ago
TripleByte is awful.
Take a look at the question they just asked me when I was doing their General Coding Assessment:
What is the output of the following function? (1m 12s)
function foo(a, b) {
a += 1
b.push(1)
}
const a = 0
const b = []
foo(a, b)
console.log(a, b)
- dang 5y agoWhat's bad about that? It's obviously testing understanding of scoping and side effects. It's not hard if you understand those things and confusing if you don't, which seems like the kind of question you'd want on a "general coding assessment", no? The only thing that bugs me about that question is that "the output of the following function" is confusingly worded. It's the sort of question that a competent candidate might get nervous about and start to overthink: wait, that isn't a function, it's a code snippet. The function here is foo – so maybe they mean "what's the output of foo"? But then what does "the output of a function" mean? I suppose they mean return value? Is this a trick question to see if I remember what push returns? Damn it, does it return the entire array or just the pushed element? That's what my mind usually does with questions like that and I'm far from the only one. Since the goal of the test is to screen for basic competence, it ought not to filter out people who could answer the question perfectly fine if it were being asked clearly, but who also perceive corner cases and ambiguities. Such a skill should make you more likely to pass such a test, not less. Therefore the question ought to say something like "What does the following code snippet write to the console?"
- guessmyname 5y ago> What's bad about that? The timer is what is bad about this. I do not care about the question. As you say, any competent programmer could solve this in a few seconds, if they are proficient, or minutes if they are not. In my opinion, they should not put a count down because they are interrupting the programmer’s flow. If they really want to measure time, they do it without interrupting the programmer, hide the timer, let them take as much time as they want/need to solve these problems. Then, at the end of the quiz, show them how long it took them to give a proper solution, and take in consideration that time to score them. If Alice solved 10 problems in 10 minutes, and Bob solved the same problems in 15 minutes, maybe there is something there that is worth highlighting in their profiles. Maybe Alice is able to analyze this type of questions much faster than Bob, and if that matters to the recruiters or potential employers, then allow the candidate to use that in their favor. However, if Bob actually knew the answer, but they ran out of time to select an option, that seems unfair.
- deleted 5y ago[deleted]
- google234123 5y ago> any competent programmer could solve this in a few seconds, if they are proficient, or minutes if they are not. You've found exactly what they are looking for. Also, it's pretty bad manners to leak test questions imo. You probably agreed not to in the TOS that you accepted.
- manv1 5y agoDepending on the language and how it passes in values, you'll have different answers. Assuming it's javascript the answer is 0,1. In other languages it might be 1, 1. That's a tricky question, and if you're not good enough to understand why they're asking that then you fail!
- ornornor 5y agoI think it would be 0, [] a and b are shadowed in the foo function so the function only acts on the shadowed (and copied) variables. Once you return from foo, the const a and b are unchanged. Not a great question as a pass or fail test imho because if you use shadowed names often enough to be able to parse this code in your head, you’re writing bad code. There is a reason why shadowing names is a bad practice: it’s hard to figure out what the end result is and account for side effects! But as a discussion on all the points above then it would teach the recruiter something about what the candidate knows rather than using this as a trivia question.
- dang 5y agoThe const on b only applies to the object reference to b, and doesn't prevent foo from changing the contents of b. No doubt that's why the test question includes an array in the first place. At least I assume that's how const works; I've not used const in JS.
- ornornor 5y agoThat’s possible. In reality, if I ever came across that piece of code and had a bug to fix in it, the first thing I’d do is rename a and b in one scope or the other because it’s just asking for trouble otherwise and it’s not easy to understand what happens to a and b. That’s why I think using this question as a trivia question is bad. But the discussion we’re having about it clearly shows we both know what to look out for, that we’re competent, and is way more interesting than running JS code in our heads. Even if either of us gets the answer wrong, it doesn’t really matter as much as how we got there in my opinion.
- 5y ago