Call us at (416) 850-2500 - Visit us at 639 Queen St. W, Suite 502, Toronto, Ontario M5V 2B7
  Posted by Dominic on July 13th, 2010

Rails Web Developer Quiz

Here’s a quiz we ran last year, at Employment.nil, Toronto first Ruby job fair.

See if you can get them all, I’ll post the answers in a couple weeks, and if you have your own favorite trick questions, post them here.

Javascript

1. An external JavaScript must contain the <script> tag, true or false?

2. What is the purpose of the the SWFObject javascript library?

Ruby

3. Given:

1
2
3
4
5
a = 'foo'
b = nil

first = a && b
second = a and b

Are first and second equal?

4. True or false?

1
1/2 == 0.5

5. If ('1'..'10').to_a returns:

["1", "2", "3", "4", ..... "10"]

What does ('2'..'10').to_a return?

Rails

6. Given the following class:

1
2
3
4
5
class Monkey << ActiveRecord::Base
has_many :bananas, :order => 'size ASC'

named_scope :starting_from_massive, :order => 'size DESC'
end

What SQL is generated for the following queries:

1
2
3
@monkey.bananas
@monkey.bananas.starting_from_massive
@monkey.bananas.all(:order => nil)

XHTML:

7. The DOCTYPE declaration has no closing tag, true or false?

8. All XHTML tags and attributes must be in lower case, true or false?

9. There is a way of describing XML data, how?

10. What does DTD stand for?

AJAX:

11. AJAX functionality is achieved by using what object?

CSS:

12. Should you clear floats?

13. How do you properly clear floats?

14. How do you write IE specific css?
Bonus: what is the problem with this?

Everything – Multiple Choice

15. Rails: Which of the following is not a form helper method?

a. text_field_tag
b. text_input_tag
c. text_area_tag
d. hidden_field_tag

16. What’s the default REST HTTP action verb for updating an existing record?

a. PUT
b. UPDATE
c. POST
d. PUSH

17. Which of the following is not a core Rails package?

a. ActionMailer
b. ActionController
c. ActiveRecord
d. ActiveResource

18. Which of the following is not an instance method of Object?

a. to_a
b. to_i
c. taint
d. hash

19. Which of the following is not a valid render option?

a. :update
b. :partial
c. :string
d. :file

20. Which of the following is not a valid ActionController filter declaration?

a. before_filter
b. clear_filter
c. after_filter
d. around_filter

21. Which of the following is not a valid ActiveRecord callback type?

a. before_create
b. before_validation_on_create
c. after_destroy
d. before_validation_on_destroy

22. XML is to XHTML as this is to HTML.

23. The keys of a model’s attributes are stored using this data type.

24. This is the RFC 2324 definition for HTTP status code 418.

24. Bonus: what does this do???

1
data.gsub(/[^\d]/, '').split('').reverse.enum_with_index.collect{|x, i|  (i%2!=0)? (x.to_i*2).to_s.split('').inject(0){|sum, i| sum + i.to_i} :  x.to_i}.inject(0){|sum, i| sum + i}%10 != 0

Leave a Reply