• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/104

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

104 Cards in this Set

  • Front
  • Back

Polymorphism

Code that can work with objects of multiple types and classes at once.

Give an example of a polymorphic method in Ruby.

#to_s works on integers, arrays, and hashes.

What is a private method in Ruby?

Methods marked private are only accessible by code inside an object's methods. You can't call them directly on an object.

Describe a protected method in Ruby.

A protected method can be called from the scope of the methods of any object that's a member of the same class.

Define Class in Ruby.

A class is a blueprint for creating objects.

Define Object in Ruby.

An object is an instance of a class, something built from the class blueprint.

Define local variable in Ruby.

A variable that can only be used in the same place it is defined.

How do you define a global variable in Ruby.

$variable_name

Define object or instance variable in Ruby.

Variables that have scope within and are associated to the current object.

Define global variable in Ruby.

Variables that are accessible from everywhere within an application.

Define class variables in Ruby.

Variables whose scope is within the current class as opposed to within specific objects of that class.

Define reflection in Ruby.

The process by which a computer program can inspect analyze and modify itself while it's running and being used.

Define Module in Ruby.

A structure to collect classes, methods, and constants into a single, separately named and defined unit.

Explain the difference between a class and a module in Ruby.

Modules are namespaced methods and constants (like libraries). Whenever you want code that logically belongs together but that won’t require that you create instances of a ‘model’, then a module is the right construct to use.

How do you declare and use a constructor in Ruby?

class Beer


def initialize(style)


@style = style


end


end




ipa = Beer.new(ipa)




"new" is the constructor in Ruby

How do you create a getter method in Ruby?

class Beer


attr_reader :style


end




which is a shortcut for:


def style


@style


end

How do you create a setter method in Ruby?

class Beer


attr_writer :style


end




which is a shortcut for:


def style=(value)


@style = value


end

Name 3 ways to invoke a method in Ruby?

beer = Beer.new


1. beer.some_method


2. beer.send(:some_method)


3. beer.method(:some_method).call *Not sure this one is correct.

Explain what 'self' means in Ruby.

x

Explain why they say almost everything is an object in Ruby.

x

What is a singleton method in Ruby?

x

Describe the Ruby method lookup path.

x

List Ruby callback (functions?). How are they used?

x

What is Rack?

x

Explain the Rack application interface.

x

Write a simple Rack application.

x

How does Rack middleware work?

x

Define middleware.

x

What are Ruby gems? How do they work?

x

Explain the structure of a Ruby gem.

x

Give some examples of your favorite gems.

x

What is ActiveJob? When should you use it?

x

What is the Asset Pipeline?

The asset pipeline provides a framework to concatenate and minify or compress JavaScript and CSS assets. It also adds the ability to write these assets in other languages and pre-processors such as CoffeeScript, Sass and ERB.

Explain the difference between a symbol and a string in Ruby. Why would you use one over the other?

x

Explain the difference between Page, Action, Fragment, Low-level, and SQL caching types.

x

What is RailsEngine? (WTF is Rails Engine?)

x

Describe the different types of association relationships that exist? (Where? In what? WTF is this referring to?)

x

What is the directory structure of Rails?

x

What is the main function of helpers?

x

What is garbage collection? Why use it?

x

Give an example of RESTful routing and controllers.

x

Describe the CRUD verbs and actions.

x

How should you test routes?

x

How do you use filters in controllers?

x

What are strong parameters?

A set of approved, white-listed attributes that can be assigned when creating and updating an object in Rails.

What should you test in controllers?

x

How do you use content_for and yield?

x

How should you use nested layouts?

x

Explain the Active Record pattern.

x

What is Object-Relational Mapping (ORM)?

x

Describe Active Record conventions.

x

Explain the migrations mechanism (in Active Record or Rails in general?)

x

What are the the types of associations in Active Record?

x

What is Scopes (in Active Record? WTF?). How should you use it? *This is how the question is asked from the blog site you're looking at.

x

Explain the difference between optimistic and pessimistic locking in Active Record.

x

Explain the concept of sessions in a web application. How does it work?

x

Describe cross-site request forgery.

CSRF stands for Cross-Site Request Forgery. This is a form of an attack where the attacker submits a form on your behalf to a different website, potentially causing damage or revealing sensitive information. Since browsers will automatically include cookies for a domain on a request, if you were recently logged in to the target site, the attacker’s request will appear to come from you as a logged-in user (as your session cookie will be sent with the POST request).

Describe cross-site scripting.

Cross-Site Scripting (XSS) attacks are a type of injection, in which malicious scripts are injected into otherwise benign and trusted web sites. XSS attacks occur when an attacker uses a web application to send malicious code, generally in the form of a browser side script, to a different end user.

Describe session hacking and session fixation attacks.

x

What's the difference between SQL injection and CSS injection?

x

How should you store secure data (e.g. passwords)?

x

Explain the significance of using HTTPS vs. HTTP.

x

What is a code smell?

A piece of code or pattern that goes against conventional practices, or implements bad coding practices.

What are some good tools to find code smells and bugs?

x

Why should you avoid fat controllers?

DRY code and the principle of single responsibility in methods. Easier to read, maintain, and update.

Why should you avoid fat models?

DRY code and the principle of single responsibility in methods. Easier to read, maintain, and update.

Explain extract value, service, form, view, query, and policy objects techniques. (WTF?)

x

Why did you become a programmer?

I like the opportunity it provides to combine both my creative and analytical sides.

What project are you most proud of?

print.nookpress.com

What is the difference between Ruby's Hash and ActiveSupport's HashWithIndifferentAccess?

Ruby's Hash class does a key lookup using == method. This means that a key of :whiskey_tango DOES NOT equal the string key "whiskey_tango". HashWithIndifferentAccess ignores this difference, equating symbols to their string counterparts.

How can you defend against a CSRF attack in Rails?

protect_from_forgery with: :exception in the application controller. This ensures a request that fails the authenticity token check does not execute.

What is the difference between a member route and a collection route in Rails?

A member route requires an id because it acts on a specific member of a collection. A collection route does not require an id because it acts on the collection as a whole. Think #show (member route) vs. #index (collection route).

Define mutable object

A mutable object can be changed (it's value) after assignment. A string is a mutable object in Ruby.

Define immutable object

An immutable object cannot be changed after assignment; it can only be overwritten. A symbol is an immutable object in Ruby.

True or False? A string in Ruby requires a new space in memory every time it is written.

True

True or False? A symbol in Ruby requires a new space in memory every time it is written.

False

List the 7 RESTful routing actions, their corresponding HTTP verbs in Rails, and sample urls for a 'photos' resource.

1. Index => GET => /photos


2. New => GET => /photos/new


3. Create => POST => /photos


4. Show => GET => /photos/:id


5. Edit => GET => /photos/:id/edit


6. Update => PATCH/PUT => /photos/:id


7. Destroy => DELETE => /photos/:id

Define Mixin in Ruby

A Mixin is the point of insertion for a Module in Ruby. You can either 'include' the Mixin or 'extend' it into a class.

Explain the difference between using the include keyword versus the extends keyword when adding a Mixin to your Ruby classes.

1. The include keyword adds the methods of the module to the class as instance methods.




2. The extends keyword adds the methods of the module to the class as class methods.

What is a remote repository?

Remote repositories are versions of your project that are hosted on the Internet or network somewhere.

Define Object Oriented Programming.

Paradigm that models programs around objects, with attributes and behavior, rather than a set of procedural steps.

What is duck typing?

When a language is less concerned with an object's type (i.e. its Class) and more with what it can do. In Ruby, if an object walks like a duck and quacks like a duck, the Ruby interpreter is happy to treat it like a duck.

Define a dynamically typed language.

a programming language where the type of a variable can change and be resolved on the fly at the exact moment it gets parsed by the interpreter.

Define a statically typed language.

language where the type of a variable is resolved in advance by the interpreter/compiler. With statically typed languages, you cannot say that x is a string and, a few lines after, that it is an integer.

True or False: Ruby is a statically typed programming language.

FALSE. Ruby is a dynamically typed programming language.

Define a Strongly Typed programming language.

A language in which once a variable's type is defined, it will only allow certain things to be done with it.

Define a Weakly Typed programming language.

A language that allows you to mix and match variable types in your expressions without throwing an exception.

What is a session in Rails?

x

Who designed the Ruby language?

Yukihiro Matsumoto.

Who developed Rails?

David Heinemeier Hansson

How would your current manager rate your performance on a scale from 1 to 10?

x

Has your recent manager mentioned any specific areas that you need to improve on? *Note that this is a different wording of the 'What is/are your weaknesses?'

x

What are some good things your current manager (or any reference you list) would say about you? *Note that this is a different wording of 'What are your strengths?'

x

What are your strengths?

x

What are your weaknesses?

x

True or False. Model names in Rails are singular.

True.

True or False. Controller names in Rails are plural.

True.

True or False. Database table names in Rails are plural and begin with a lower case letter.

True.

True or False. The #create method for an Active Record model immediately updates the database.

True.

True or False. The #new method for an Active Record model immediately updates the database.

False. After assigning attributes to a model using the #new method you must use model#save to update the db.

Describe the strong parameters pattern for an instance of article, using the attributes title and category.

private




def article_params


params.require(:article).permit(:title, :category)


end

x

x

What are partials used for in Rails?

partials are used to extract away redundant view code into component-like, re-usable chunks.

Describe the differences between unit, functional, and integration tests in Rails.

x