stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
Ruby Review Flashcards | StudBud
Explore
/
Ruby Review
Ruby Review
8 terms
·
StudBud Administration
·
25 plays
Review of basic ruby concepts #ruby #programming #fundamentals
Flashcards
8 cards
F
Practice quiz
P
Host live
L
Questions
8
Answers
1
What is the name of the interactive terminal program for ruby?
irs
rvm
irb
ruby
2
How can you convert “4” to a number?
“4”.to_i
int(“4”)
parseInt(“4”)
“4”.to_int
3
What is a string method to remove trailing whitespace?
slice
strip
splice
chomp
4
What does this code do: pet=””
It is invalid and does nothing
Prints an empty string
Assigns an empty string to a variable
Creates the string “pet”
5
How can you convert 6 to a string
toString(6)
string(6)
6.to_s
6.to_string
6
What is an example of string interpolation?
“you are ${age} years old”
“you are #[age] years old”
“you are ” + age + “ years old”
“you are #{age} years old”
7
Given: pet=”cat”. What does this return: pet == “dog” ? “woof” : “chirp”
“woof”
“meow”
“chirp”
None of these
8
Which of these is an array?
{1,2,3}
[1,2,3]
(1,2,3)
“1,2,3”