Ruby Interview Fragen - Vorbereitung und Antworten
Basis Ruby-Fragen
1. Erkläre OOP in Ruby
Klassen, Vererbung, Polymorphismus. Alles ist Objekt in Ruby.
2. Was ist eine Gem?
Wiederverwendbarer Ruby-Code. Package-Manager: RubyGems.
3. Unterschied: Array vs. Hash?
- Array: Geordnete Liste mit Index (0, 1, 2, ...)
- Hash: Key-Value Pairs, ungeordnet
4. Was ist Yield und Block?
Block: Code-Block zwischen { } oder do...end.
Yield: Method ruft Block auf.
def greet
yield("World")
end
greet { |name| puts "Hello #{name}" }
5. Difference: Proc vs. Lambda?
Lambda hat strictes Argument Checking, Proc nicht. Lambda return aus Lambda, Proc aus Method.
Rails-Fragen
1. MVC Architecture
Model (Daten), View (HTML), Controller (Logic).
2. What is ActiveRecord?
ORM. Ruby-Objekt zu Datenbank-Zeile.
3. Explain RESTful Routing
HTTP Methods (GET, POST, PATCH, DELETE) auf Resources (Posts, Users, etc.)
4. Database Migrations
Versionskontrolle für Schema. Up/Down.
5. Authentification vs. Authorization
Auth: "Wer bist du?" (Login) Authz: "Darf du das?" (Permissions)
Coding Challenges
Typisch: 30–60 Minuten
Example: Two Sum
Given array und target sum, find two numbers.
def two_sum(nums, target)
hash = {}
nums.each_with_index do |num, i|
complement = target - num
return [hash[complement], i] if hash[complement]
hash[num] = i
end
end
Example: Reverse String
def reverse(str)
str.reverse
# oder
str.split('').reverse.join('')
end
Soft Skills
1. "Warum Ruby/Rails?"
Antwort sollte authentic sein. "Schnelle Produktivität, gute Community, Startups..."
2. "Stressige Situation?"
STAR Method: Situation, Task, Action, Result. Bleibe positiv.
3. "Deine größte Schwäche?"
Honesty aber frame positiv: "Ich war schwach in Testing, habe das gelernt."
4. "Teamarbeit?"
Story erzählen. "Code Review, Pair Programming, Hilf Juniors..."
Vorbereitung Tipps
- LeetCode üben: Easy/Medium Ruby
- Firmen recherchieren: Stack, Values
- Questions vorbereiten: "What's the team culture?"
- CV Review: Bekannte prüfen
- Mock Interviews: Mit Freunden üben
Nach dem Interview
- Dank-Email schreiben
- 1 Woche warten
- Follow-up falls keine Antwort
- Bei Rejection: Feedback fragen
