Ruby面試精選30題 - 題目大綱
自從Oct-Nov.2018這段時間在Sydney將IT邦鐵人賽完賽之後,一直在想如何將這30篇文章做最佳利用。目前訂閱我的30天修煉Ruby面試精選30題
系列的人超乎想像熱烈(30篇文章,共有26人訂閱),對於首次參加鐵人賽完賽的作者來說是很大的鼓勵。謝謝觀眾們!
這篇文章是個Ruby面試題列表,希望整理過後可以幫到未來面試的我和你們。
01
什麼是類別?
What is a Class?
02
類別與模組有什麼不同?
What’s the Difference Between aClass
and aModule
?
03
包含與延伸有什麼不同?
What’s the Difference Betweeninclude
andextend
?
04
請解釋實體方法與類別方法?
Explaininstance method
andclass method
.
05
self是什麼意思?
What doesself
mean?
06
請說明Ruby的三種存取限制。
Explain 3 levels ofaccess control
for Ruby methods.
07
符號和字串有什麼不同?
What’s difference betweensymbol
andstring
?
08
+=和concat有什麼不同?
What’s difference betweenconcat
and+=
?
09
請解釋 a ||= b?
Explain this ruby idiom (or-equals) :a ||= b
?
10
Ruby如何引入方法?
Please explain how Ruby looks up a method toinvoke
?
11
Ruby 的 block, proc, lamdba方法比較?
What’s difference betweenblocks
,procs
andlambdas
?
12
Ruby 的 類別變數與類別實體變數,與實體變數有何不同?
What is difference betweenclass variable
,class instance variable
andinstance variable
?
13
instance_eval 和 class_eval 的差別 ?
What’s the difference betweeninstance_eval
andclass_eval
?
14
each, map 和 collect 比較?
What’s the difference between each, map and collect?
15
alias 和 alias_method比較?
What’s the difference between alias和 alias_method?
16
什麼是迭代器? 請解釋Ruby裡面有哪幾種迭代器?
What’sIterator
? How many iterators are there in Ruby?
17
解釋Ruby裡的 freeze 和 ?frozen。
Explan when to usefreeze
andfrozen
in Ruby?
18
如何在Ruby寫下多行字串?
How to writemultiline string
in Ruby?
19
描述Ruby裡的yield用法?
What isyield
statement in Ruby?
20
說明Ruby裡Enumerable的實用之處?
Why IsEnumerable
So Useful?
21
解釋Ruby裡的True, False與Nil?
Explan True and False vs.Truthy
andFalsey / Falsy
in Ruby?
22
[and], [or] 和 [&&], [||] 比較?
What’s the difference between[and]
,[or]
and[&&]
,[||]
?
23
解釋Ruby裡的 ==, ===, eql?, equal。
Explain each of the following operators==
,===
,eql?
,equal
?
24
nil?, empty? 和, blank? present? 比較?
What’s the difference betweennil?
,empty?
,blank?
andpresent?
?
25
.present? 和.exists? 比較?
What is the difference between.present?
and.exists?
26
說明Ruby的錯誤處理機制。 Explain
Error Handling
in Ruby.
27
如何設定Ruby的Hash預設值?
How to setdefault value
in hash?
28
Ruby的 ** 運算子是什麼?
What does** (double splat)
operator do?
29
請解釋Ruby的tap method?
What istap method
in Ruby?
30
請解釋Ruby的鴨子型別(duck type)?
What isduck type
?