Test Yourself: A Closer Look at Ruby

Making sure you've covered everything you need to know for the coming projects.

Scroll down...

Content

Resources

Comments

Test your knowledge with the questions below. Make sure you can answer them before starting on the projects. All of the answers are contained in the previous lessons.

Numbers, Operators and Expressions

  • What's the difference between =,==, and ===?
  • What's the result of 3/2? 3/2.to_f?
  • Which type of Range is more common, inclusive (..) or exclusive (...)?

Objects and Methods

  • "Object is to Noun as Method is to ...?"
  • What class do all objects in Ruby inherit from?
  • What does a question-mark at the end of a method name signify?
  • What is "Reflection"?
  • What are "Side Effects"?
  • What are "Arguments"?
  • What is "Method Chaining" and why is it useful?
  • What does an exclamation point at the end of a method name signify?
  • What is an "Implicit Return" in Ruby?
  • How do you write a default value for a method input?
  • What are classes?
  • What is an instance?
  • When you save an object in Ruby, what are you actually saving?
  • What does the object_id method give you and why is it potentially helpful?

Strings and Symbols

  • What's the difference between using single quotes and double quotes in a string?
  • What is "String Interpolation"?
  • What does it mean to "Escape" a character in a string?
  • What are the special "newline" and "tab" characters?
  • What method lets you convert (pretty much) anything to a string?
  • What is string "Concatenation"?
  • What is the "Shovel Operator"?
  • How do you access a specific character in a string?
  • How do you access the last character of a string? Second to last?
  • How do you access a subset of characters in a string?
  • How do you break a string into an array?
  • How do you get user input for your program?
  • What's the difference between chomp and strip?
  • Why are they useful, especially for user input?
  • How do you replace one character or group of characters with another in a string?
  • What is a "Regular Expression" and where can you go to practice them?
  • How is a Symbol different from a String?
  • When should you use a String instead of a Symbol?

Arrays

  • What is an Array?
  • How many different ways to create an array can you think of?
  • How do you create an array pre-populated with data?
  • How many different types of things should you store in an array?
  • How do you read a single item from an array?
  • How do you pull a sub-array from an array?
  • How do you edit array items?
  • How do you combine arrays?
  • What happens if you subtract arrays?
  • What do push and pop do?
  • What does the "Shovel Operator" (<<) do to arrays?
  • What do shift and unshift do?
  • How do you delete items from an array?
  • How do you check if an item is included in an array?
  • How do you figure out where in an array an item is?
  • How should you name your arrays?
  • How do you convert an array into a single string?

Hashes

  • What is a hash?
  • What are keys and values?
  • How do you create an empty hash?
  • How do you create a hash with existing values?
  • How do you add new data to a hash?
  • How do you modify data in a hash?
  • What can you use for the keys in a hash?
  • What can you use for the values in a hash?
  • What are "Options Hashes" and why are they useful?
  • What are the two options for hash syntax if using symbols as keys?
  • How do you remove an item from a hash?
  • How do you combine hashes?
  • How do you list out all the keys or values of a hash?

Conditionals and Flow Control

  • What is "Truthiness"?
  • What are the only things are considered "Falsy"?
  • Are else clauses required?
  • How many elsif clauses can you have?
  • What is unless?
  • How do you put if or unless on a single line?
  • How do you say "Not equal to"?
  • What is the "Spaceship Operator"?
  • How do you specify the logical "And" operator? "Or"?
  • What is "Lazy Evaluation" and how can it be useful to you?
  • What is returned by a logical expression?
  • What is the syntax of a "Ternary Operator"?
  • What is a case statement?

Iteration

  • What is an "Index Variable"?
  • How should you name your index variable?
  • How does loop work?
  • How do you stop a loop?
  • How does while work?
  • Where do you need to declare your index variable to use it in a while loop?
  • What is until?
  • What does each do?
  • What does each return?
  • What does each pass into the block for an array? For a hash?
  • How does times work?
  • What is the first value passed into the times block?
  • What does times return?
  • How can you loop and still use the index value of the current iteration?
  • What is the for loop syntax and how common is it in Ruby?
  • When should you use a loop vs a while vs an each vs a times vs a for?
  • How can you control or break your looping?
  • Why shouldn't you use return to exit a loop?
  • What does "Nesting" loops mean?

Dates and Times

  • What does a Time represent in Ruby?
  • When exactly did time begin according to Ruby?
  • How can you get the current time?
  • How can you get a specific time?
  • How can you add or subtract times?
  • How can you print out a time in a user-friendly way?
  • How are time zones handled?
  • What is "UTC" and what are "UTC offsets"?


Sign up to track your progress for free

There are ( ) additional resources for this lesson. Check them out!

There are no additional resources for this lesson just yet!

Sorry, comments aren't active just yet!

Next Lesson: Ruby Warmup Sprint