ROR Questions
ROR Questions
SQL
A1
Q2 Write down SQL which will find first user (ordered by ID) user whose name starts with ‘A’
Q3 Write down SQL query which will find all documents for a user with email “[email protected]”
A3 Select * from documents inner join access ON documanets.id = access.documanet_id INNER JOIN users
ON access.user_id = users.idwhere users.email = ““[email protected]”
Page 1 of 12
RoR Technical Interview Candidate: Date:
v. 1.1 Interviewer: Time:
Q4 Write down SQL query which will calculate for every user number of documents he has an access. Find
below an example of expected output. The result of your query should look like the following:
Name Email Number Of Documents
Accessed
A4 select users.name,users.email, count(users.id) from users inner join access ON users.id = access.user_id
group by users.name, users.email;
Q5 What are normalization and denormalization? What are “pros and contras” of each? In what practical
cases will you use each of them?
A5
Ruby Language
Q6 What is the difference between include and extend? Write snippets of code which demonstrates the
difference?
A6
A7
Page 2 of 12
RoR Technical Interview Candidate: Date:
v. 1.1 Interviewer: Time:
A8
Q9 What’s the meaning of amperssent (&) operation? Describe all use cases you know.
A9
Q10 What is a singleton class in Ruby? How one can extend it?
A10
Q11 You have an object x of cass MyClass and you call its method foo (x.foo). Where Ruby runtime will look
for this method implementation?
A11
Q12 What is “monkey patching” technique? What are “pros and contras”. In which practical cases would you
use it?
A12
Q13 Write a method str_to_h which will take a string and convert it to a hash where the keys are indexes of the
character and the values are characters. For instance:
str_to_h(“Hello”) => { 0: ‘H’, 1: ‘e’, 2: ‘l’, 3: ‘l’, 4: ‘o’ }
Q14 Write a method reverse_chain which will take a string name replace each word with its length and returns
the reversed array of length. Not that words could be separated by more than one space. For instance:
reverse_chain(“I want to work at Pair Finance ”) => [7, 4, 2, 4, 2, 4, 1]
Page 3 of 12
RoR Technical Interview Candidate: Date:
v. 1.1 Interviewer: Time:
A14
Rails Framework
A15
Q16 What the problem with the code below? How will you fix ti?
A16
Q17 How would you define a Person model so that any Person can be assigned as the parent of another
Person (as demonstrated in the Rails console below)? What columns would you need to define in the
migration creating the table for Person?
Page 4 of 12
RoR Technical Interview Candidate: Date:
v. 1.1 Interviewer: Time:
Q18 Update the Person model so that you can also get a list of all of a person’s grandchildren, as illustrated
below. Would you need to make any changes to the corresponding table in the database?
Q19 What is a ActiveSupport::Concern? How and when are you using it?
A19
Page 5 of 12
RoR Technical Interview Candidate: Date:
v. 1.1 Interviewer: Time:
def hello
render ‘greetings’
end
Where Rais will look for greetings view? (Give list of folders’ paths)
Q21 Consider the controllers hierarchy above. If session ended in general you want to redirect to application
login page (login_path), but for AdminsController you want to redirect to special admin login page
(admin_loing_path). How can you do it?
A21
Q22 Consider the controllers hierarchy above. You want to have specific layouts for all views in
UsersController and AdminsController. How can you do it?
A22
Q23 What's the difference between POST and GET verbs? When one should use each?
Page 6 of 12
RoR Technical Interview Candidate: Date:
v. 1.1 Interviewer: Time:
A23
Q24 What's the difference between POST, PUT and PATCH verbs? When one should use each?
A24
Q26 What are other verbs do you now? How are they used?
A26
A28
Q29 What content types do you know for HTTP requests and responses?
A29
Q30 What other headers do you know? How are they used?
A30
Page 7 of 12
RoR Technical Interview Candidate: Date:
v. 1.1 Interviewer: Time:
Q31 List all HTTP response status code series and explain their meaning.
A31
Q32 What is REST API? What are “must haves” of the goor designed REST API on your opinion?
A32
Software Design
Q33 How do you understand DRY (don’t repeat yourself) principle? Why is it important?
A33
Q34 How do you understand SOLID (Single responsibility, Open–closed, Liskov substitution, Interface
segregation and Dependency inversion) principle?
A34
A35
Page 8 of 12
RoR Technical Interview Candidate: Date:
v. 1.1 Interviewer: Time:
JavaScript
(function() {
var a = b = 5;
})();
console.log(b);
A36 skip
multiply(5)(6); => 30
A37
Q38 How would you add your own method to the Array object so the following code would work?
Page 9 of 12
RoR Technical Interview Candidate: Date:
v. 1.1 Interviewer: Time:
Q39 What is a Closure and How do you use it? Give examples.
A39
Q40 What happens when you call a function with the new keyword?
A40
Q41 What is the difference between the classical and the prototypical inheritance?
A41
Q42 After an object is created, for example using the new keyword, how can we access the prototype object
that the instantiated object is linked to?
A42
Q43 You have an object x = { a: 1, b: 2, c: 3 } and you have a variable with name of one properties y=’b’.
Get the values of property x.b using only variables x and y.
A43
Page 10 of 12
RoR Technical Interview Candidate: Date:
v. 1.1 Interviewer: Time:
CSS
Q44 Explain what elements will match each of the following CSS selectors:
div, p
div p
div > p
div + p
div ~ p
A44
Describe in plain eglish which elements will browser select to apply red text color.
A45
Q46 How do margin, border and padding fit together in the box model?
Page 11 of 12
RoR Technical Interview Candidate: Date:
v. 1.1 Interviewer: Time:
U
2
Applic A D UsersCo
1 1 2
Base
i i i Admins
Contr
d d d Controll
4
oller *u * 1ti er 3
n
A46
Page 12 of 12