4/27/2018 - 4:48 PM


The following is a response to the requested qist questions for the pre-work.

Reflecting on Mod 1 What strengths did you bring to Mod 1 last inning? What are you proud of? I brought my Learner strength to Mod 1 last round. I'm proud of all the information I was able to absorb and feel like it's enabling me to accomplish the second round of pre-work much more efficiently.

What were the biggest challenges of Mod 1 last inning? I couldn't get organized, which caused me to panic and shut down. I feel like I have things a little more together this time around.

How frequently did you meet with your mentor? What did you work on during those times? What kind of pairing/mentor time was the most helpful for you?

What do you need to do differently this inning (or do you feel you just need more time/exposure)?

Considering your strengths, challenges, & what you know about Mod 1, what type of support would be beneficial this inning (from possibly your cohort, mentor, instructors, and anyone else)?

Please write at least one SMART goal that you would like support and accountability in reaching by the end of Mod 1.

Numerics and Arithmetic

What is the difference between integers and floats?

Integers are whole numbers that belong to the Integer class. Floats are decimals and belong to the Float class.

What is the ruby command to find 2 to the 2nd power?

2 ** 2


What do each of the following symbols mean?

== - equal to - 100 == 100 => true

>= - greater than or equal to - 100 >= 100 = true

<= - less than or equal to - 99 <= 100 = true

!= - not equal to - 99 != 100 = true

&& - AND - (11) && (22) => true; (12) && (22) => false

|| - OR - (11) || (22) => true; (12) || (22) => true; (12) || (34) => false

What are two Ruby methods that return booleans?




What is flow control?

Flow control is the order statements are evaluated and executed within a program.

What will the following code return?

apple_count = 4

#if apple_count > 5*

puts "Lots of apples!"


puts 'Not many apples...'


Not many apples... => nil

What is an infinite loop, and how can you get out of one?

An infinite loopis code that continuously executes, because the conditional is never satisfied. Exit an infinite loop by press control+c.


What is nil? Nil is a special value that denotes the absence of value in an object.


How can symbols be beneficial in Ruby?

Symbols are more performant. Symbols only utilize one space in memory and consequently save memory. Symbols are immutable (can't be changed at runtime).

Does naming symbols use the same rules for naming variables? Symbols are prepended with a : to indicate that the object is recocgnized by Ruby as a symbol.


What method can you call to find out how many elements are in an array?


What is the index of pizza in this array: ["pizza", "ice cream", "cauliflower"]?


What do 'push' and 'pop' do? .push pushes an element into an array, appending it to the end. .pop pops off the last item of an array.


Describe some differences between arrays and hashes.

Arrays are a collection of elements ordered by index.

Array elements are retrieved using the numerical index

Hashes are a collection of stored key/value pairs.

Hash values are retrieved by using the key.

What is a case when you might prefer an array? What is a case when you might prefer a hash? A grocery list, or a task list, might use an array. A hash is more suitable when associating one item with another, like ticket prices based on seating area: seating = {general: 20, club_level: 30, rooftop: 40, vip: 50}

What is a pomodoro break?

Pomodoro breaks are short pauses (3 to 5 minutes) during the course of a pomodoro session intended to reduce mental fatigue.

How do you create a variable?

Create a variable by assigning a variable name to a variable value on either side of an equal sign.

Example: my_name = "Blythe McFall"

What did you learn about the rules for naming variables?

Different naming conventions are required for different types of variables:

CONSTANTS_CONSTANT - uppercase with underscores.

$global - declared by prepending the variable name with a dollar sign.

@instance_variable - lowercase with underscore

local_variables - lowercase with underscore

MyClass - mixedcase

How do you change the value of a variable?

By overwriting the existing value.

my_var = 1

my_var => 1

my_var = "reassign"

my_var => "reassign"


How can you find out the class of a variable?

Append the variable with the .class method in Terminal.

my_var.class => String

What are two string methods?

<=> - Comparison

Returns -1 if the initial string is less than the other string.

"Mazatla" <=> "Mazatlan"=> -1

Returns 0 if both strings are equal.

"Mazatlan" <=> "Mazatlan" => 0

Returns 1 if the initial strings is greater than

"Mazatlan1" <=> "Mazatlan" => 1

Returns 1 if the initial string case does not match

"Mazatlan" <=> "MAZATLAN" => 1

Returns nil if the intial string does not match the other string.

"Mazatlan" <=> 365 => nil

rstrip - Like .lstrip and strip - returns a copy of the string without any appending whitespace. string_with_whitespace = "stringwithtrailingwhitespaces " string_with_whitespace.rstrip => "stringwithtrailingwhites"

How can you change an integer to a string?

integer = 10 => 10

integer.class => Integer

integer = "ten" => "ten"

integer.class = String


Why might you use double quotes instead of single quotes in Ruby?

To ensure the successful interpolation of strings.

What is this used for in Ruby: #{}?


How would you remove all the vowels from a string?

my_var = "supercalifragilisticexpialidocious" => "supercalifragilisticexpialidocious"

my_var.delete("aeiou") => "sprclfrglstcxpldcs"

Input & Output

What do 'print' and 'puts' do in Ruby?

Both the prints and puts methods output text to the console, but only puts returns the new line character automatically.

What does 'gets' do in Ruby?

The gets method allows the ability to capture, store and operate on user input.

What command is entered into the command line to enter an 'irb' session?


What is the expression used to express a number squared?

The exponentiation operator consists of two asterisks.

2 ** 2 => 4

What is the ruby command used to output something to the terminal?

The puts method, is the basic command to output to the terminal.

How is a ruby file run from the command line?

From the command line, in the directory where the ruby file lives run:

ruby ruby_file.rb

*If the directory where the file resides is different, specify the path: ruby ./directory/ruby_file.rb

If a # is at the beginning of a ruby line in Atom, what does that indicate?

The hash, octothorp, pound sign, square symbol, etc. indicates the line is commented out and is ignored if the Ruby files is executed.

What will "turing".length return?

"turing".length => 6