So you think you wanna be a web developer... Fork https://gist.github.com/3788769 and update your copy with answers. They don't need to be precise - pseudo-code is fine in most cases. Some questions don't have correct answers. Submit your answers to ara@dojo4.com FROM: you@yeraaddy.com SUBJECT: [dojo4-quiz] quiz-1 BODY: https://gist.github.com/to-your-submission
ref: https://gist.github.com/3788769
1. is this broken in html5? if so why?
<div id='teh_javascripts' />
teh answerz...
2. write an http GET request for the url
'http://domain.com:4242/foo/bar/baz.html'
teh answerz...
3. in any language you choose, write this to run in parallel
numbers = 20, 1
results = []
numbers.each do |number|
results.push( parallelize{ number * 2 } )
end
sum = reduce( results )
teh answerz...
4. in any language you choose, write this to run in parallel on multiple cores
numbers = 20, 1
results = []
numbers.each do |number|
results.push( parallelize{ number * 2 } )
end
sum = reduce( results )
teh answerz...
5. is this broken in html5?, why?
<label for='user.email'>
<input name='user.email'>
teh answerz...
6. what is value of 'status'
if @not_modified
render :status => status
end
teh answerz...
7. is this javascript broken? if so, why?
var submit = document.getElementById("submit");
submit.click();
teh answerz...
8. which is better? why?
<!-- A -->
<table>
<tr>
<td class='key' style='width:33%'>
{{ dynamic_content_for(:key) }}
</td>
<td class='val'>
{{ dynamic_content_for(:val) }}
</td>
</tr>
</table>
<!-- B -->
<div class='fluid grid'>
<div class='row'>
<span class='key width33'>
{{ dynamic_content_for(:key) }}
</span>
<span class='val'>
{{ dynamic_content_for(:val) }}
</span>
</div>
</div>
teh answerz...
9. which is better? why?
# A
if var == 42
"..."
end
# B
if 42 == var
"..."
end
teh answerz...
10. describe steps to debug this problem
@response =
http_request(url, :method => method, :params => params, :headers => headers)
if @response.ok?
ship_it!
else
debugger!
end
teh answerz...
11. which is better? why?
# A
if foo.bar.baz
'...'
end
# B
if foo
if foo.bar
if foo.bar.baz
'...'
end
end
end
teh answerz...
12. is this javascript broken? if so, why?
ajax(url)({
'method' : 'POST',
'params' : params,
'headers' : headers
});
teh answerz...
13. what color is this?
'#FFE'
teh answerz...
14. what number is this?
0b101010
teh answerz...
15. describe an algorithm to detect the 'edges' in these pixels
0 0 0 0 0 0 0 0 1 1 1 0 0 1 1 1 1 0 0 1 1 1 0 0 0 0 0 0 0 0
teh answerz...
15. what does @X represent?
$color = [@X, @R, @G, @B].as_hex
teh answerz...
16. what are the advantages of static linking?
export HINT=$LD_RUN_PATH
teh answerz...
17. wtf is this javascript doing?
var uploader = new qq.FileUploader(options);
var image_ids = [];
uploader._uploadFileList = function(){
image_ids = [];
var args = Array.prototype.slice.call(arguments);
var result = qq.FileUploaderBasic.prototype._uploadFileList.apply(uploader, args);
return(result);
};
teh answerz...
18. what does this code do?
jQuery('.help').find('a').attr('tabindex', '-1');
teh answerz...
19. how would you solve this problem?
~ > run_api_tests_locally
"FAIL: you must access teh API from a box on EC2 with IP 1.2.3.4!"
teh answerz...
20. which is better? why?
// A
User.prototype.first_name = function(){
return this.name.split(/\s+/)[0];
};
// B
User.prototype.first_name = function(){
return User.first_name_for(this.name);
};
User.first_name_for = function(name){
return name.split(/\s+/)[0];
};
teh answerz...