What does this expression evaluate to?
"Cool".+("io")
The Ruby Erudite Saga Quiz
Quiz
•
Computers
•
University
•
Hard
Lorenah Mbogo
Used 4+ times
FREE Resource
9 questions
Show all answers
1.
FILL IN THE BLANK QUESTION
1 min • 10 pts
What does this expression evaluate to?
"Cool".+("io")
Answer explanation
This is another way to concatenate Strings. The previous example actually uses syntactic sugar (a deviation from formal syntax to enhance code readability) and this example uses the strict syntax.
2.
FILL IN THE BLANK QUESTION
1 min • 10 pts
What does this expression print?
my_name = "50 Cent"
my_name = "Miley"
p my_name
Answer explanation
The my_name variable was assigned to the value "50 Cent", but then it was reassigned to the value "Miley". Once the my_name variable is reassigned to "Miley", it loses all knowledge that it used to point to "50 Cent".
3.
FILL IN THE BLANK QUESTION
3 mins • 12 pts
Define a method called silly_check() that takes a number argument and returns "The number is less than 5" if the argument is less than 5 and "The number is greater than or equal to 5" otherwise.
4.
MULTIPLE CHOICE QUESTION
1 min • 10 pts
name = "clem"
age = 32
Is this array valid?
[name, age]
Yes
No
Answer explanation
Yes, variables can be used inside of Arrays.
5.
MULTIPLE CHOICE QUESTION
1 min • 10 pts
Which of the following is the correct way to define a class called Car?
def Car/end
class Car/end
create Car/end
6.
MULTIPLE CHOICE QUESTION
1 min • 10 pts
What is an instance variable?
A variable that describes an attribute of an instance of a class and is available to all instance methods of a class.
A variable that describes an attribute of an instance of a class and is available to both instance and class methods within a class.
7.
FILL IN THE BLANK QUESTION
3 mins • 12 pts
What does the following expression print?
if "sam" == "cat"
puts "sam equals cat"
elsif "matt" == "matt"
puts "matt equals matt"
else puts "whatever"
end
Answer explanation
The elsif keyword is used to add additional logical criteria to an if statement and this expression prints "matt equals matt". In this case, the boolean condition following the if statement ("sam" == "cat") evaluates to false, so the code inside the if block is not executed. However, the boolean condition following the elsif statement evaluates to true ("matt" == "matt"), so the code inside the elsif block is executed.
9.
FILL IN THE BLANK QUESTION
3 mins • 14 pts
Consider the following table and SQL query:
What will the SQL query above return?
12 questions
Python Functions and Docstrings Quiz
Quiz
•
University
13 questions
Quiz #2 (Refer to Javatpoint in answering these question)
Quiz
•
University
9 questions
Повторення пайтон3 панда
Quiz
•
University
12 questions
javaquizvivek
Quiz
•
University
10 questions
Q4 - Comp Vision
Quiz
•
University
10 questions
Static Members in Class
Quiz
•
University
10 questions
Quiz 6
Quiz
•
University
12 questions
UML-2020-158225-Week7-ClassDiagramObjectDiagram-NTY
Quiz
•
University
20 questions
math review
Quiz
•
4th Grade
20 questions
Math Review - Grade 6
Quiz
•
6th Grade
20 questions
Reading Comprehension
Quiz
•
5th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
20 questions
Taxes
Quiz
•
9th - 12th Grade
10 questions
Human Body Systems and Functions
Interactive video
•
6th - 8th Grade
19 questions
Math Review
Quiz
•
3rd Grade
45 questions
7th Grade Math EOG Review
Quiz
•
7th Grade
20 questions
Summer
Quiz
•
KG - University
6 questions
Railroad Operations and Classifications Quiz
Quiz
•
University
47 questions
2nd Semester 2025 Map Final
Quiz
•
KG - University
43 questions
Science 5th Grade EOG Review #3
Quiz
•
KG - University
24 questions
Cartoon Characters
Quiz
•
KG - University
9 questions
What is your personality?
Quiz
•
University
10 questions
El Presente
Quiz
•
1st Grade - University
32 questions
NC Biology EOC Review : Heredity, Genetics, Biotechnology
Quiz
•
KG - University