1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Ruby silverの模擬問題を抜粋して解説をしていきます。

下記コードの出力を4択から選ぶ問題になっています。

puts "A".ord + 1

1.66
2.114
3.エラーとなる
4.B

まず、'"A".ord'は'A'という文字コードの整数値を取得するメソッドになります。したがって、'A'はASC文字コードでは65を示します。

'"A".ord + 1'を計算すると、65 + 1で66になります。

したがって、puts "A".ord + 1の結果は66になります。

解答は1番になります

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?