Ruby on Rails Multiple choice Questions

Posted On:January 18, 2019, Posted By: Latest Interview Questions, Views: 714, Rating :

Best Ruby on Rails Objective Questions and Answers

Dear Readers, Welcome to Ruby on Rails Objective Questions have been designed specially to get you acquainted with the nature of questions you may encounter during your Job interview for the subject of Ruby on Rails. These Objective type Ruby on Rails Questions are very important for campus placement test and job interviews. As per my experience good interviewers hardly plan to ask any particular question during your Job interview and these model questions are asked in the online technical test and interview of many IT companies.

1. What is bundler?

a) rails generate scaffold User name:string email:string

b) self-contained bundles of gems. Useful for versioning.

c) Edit Gemfile, then run 'bundle install' or just 'bundle'.

d) Ruby Version Manager. Install and manage multiple versions of Ruby.

Ans: c

MCQs on Ruby on Rails

2. What is gemset?

a) self-contained bundles of gems. Useful for versioning.

b) self-contained packages of Ruby code

c) Ruby Version Manager. Install and manage multiple versions of Ruby.

d) rails generate scaffold User name:string email:string

Ans: a

 

3. What is gem?

a) rails generate scaffold User name:string email:string

b) self-contained packages of Ruby code

c) self-contained bundles of gems. Useful for versioning.

d) Ruby Version Manager. Install and manage multiple versions of Ruby.

Ans: b

 

4. what is scaffold command?

a) rails generate scaffold User name:string email:string

b) Ruby Version Manager. Install and manage multiple versions of Ruby.

c) self-contained packages of Ruby code

d) self-contained bundles of gems. Useful for versioning.

Ans: a

 

5. What is rake?

a) self-contained bundles of gems. Useful for versioning.

b) bundle exec rake db:migrate. Using bundle exec ensures that the rake version in our Gemfile is used.

c) rails generate scaffold User name:string email:string

d) Ruby Version Manager. Install and manage multiple versions of Ruby.

Ans: b

 

6. What is rvm?

a) rails generate scaffold User name:string email:string

b) Ruby Version Manager. Install and manage multiple versions of Ruby.

c) self-contained bundles of gems. Useful for versioning.

d) self-contained packages of Ruby code

Ans: b

 

7.how do you create a migration that adds a "phone" field to the "tickets" table?

a) unit, functional, and integration tests

b) RAILS_ENV (RAILS_ENV=production)

c) integration test

d) rails generate migration AddPhoneToTickets phone:string

Ans: d

 

8.Rails' application framework is called ----------?

a) ActionPack

b) ActiveRecord

c) a web page

d) an object

Ans: a

 

9.how do you run a migration?

a) CamelCase

b) ruby make

c) an object

d) rake db:migrate

Ans: d

 

10.what does "show" refer to as the :action value?

a) the method within the controller to call

b) HTTP methods (post, get, put, delete)

c) the data being presented by the web page

d) their names begin with an underscore

Ans: a

 

11.how do you update?

a) update_attributes (as in @ad.update_attributes(params[:ad]))

b) unit, functional, and integration tests

c) format (that period is a concatenation period)

d) it is not associated with a model

Ans: a

 

12.what comes after <% form_for()... ?

a) redirect_to " ... "

b) the request parameters table

c) <%= f.text_field :name %>

d) do |f| (where "f" can be anything)

Ans: d

 

13.what kind of tests are there?

a) unit, functional, and integration tests

b) it is not associated with a model

c) id, created_at, updated_at

d) it runs its validators

Ans: a

 

14.how do you specify a format like html or xml in routes.rb?

a) .:format (that period is a concatenation period)

b) HTTP methods (post, get, put, delete)

c) their names begin with an underscore

d) unit, functional, and integration tests

Ans: a

 

15.when you put something into an array, does the array keep a separate copy?

a) no. arrays just keep references to objects stored in memory.

b) the data being presented by the web page

c) it is not associated with a model

d) the request parameters table

Ans: a

 

16.what is scriptlet versus expression

a) it runs its validators

b) it is not associated with a model

c) Representational State Transfer

d) expression is ruby code that prints out a value in html

Ans: d

 

17.what does the "h" in <%=h ... %> mean?

a) .:format (that period is a concatenation period)

b) h is a helper method that escapes special characters to sanitize malicious input

c) a script that alters the structure of the underlying database

d) the method within the controller to call

Ans: b

 

18.what's the difference between model names and controller names?

a) the method within the controller to call

b) the data being presented by the web page

c) model names are singular, controller (and table) names are plural

d) in the controller: respond_to do |format| ... end

Ans: c

 

19.what is "migration"?

a) It is a format (that period is a concatenation period)

b) a script that alters the structure of the underlying database

c) their names begin with an underscore

d) the data being presented by the web page

Ans: b

 

20.what steps get you from fild.erb to file.html?

a) data from model objects AND the page template

b) .erb -> Embedded Ruby -> ruby code (file.rb) -> fild.html

c) the method within the controller to call

d) the data being presented by the web page

Ans: b

 

21.what is the filter code that calls on the "check_logged_in" method for only the "edit" and "update" methods?

a) the data being presented by the web page

b) HTTP methods (post, get, put, delete)

c) data from model objects AND the page template

d) before_filter :check_logged_in, :only => [:edit, :update]

Ans: d

 

22.representation of a resource is called -------------.

a) CamelCase

b) ruby make

c) a web page

d) ActionPack

Ans: c

 

23.converts database records to objects is called -------------.

a) for ad in @ads

b) integration test

c) Representational State Transfer

d) an object-relational mapping library

Ans: d

 

24.what checks if an input is numeric?

a) integration test

b) a responder object

c) validate

d) validates_numericality_of

Ans: d

 

25.what is Rails' object-relational mapping library?

a) CamelCase

b) ActiveRecord

c) an object

d) underscores

Ans: b

 

26.where do you add the filter code?

a) rails generate migration AddPhoneToTickets phone:string

b) the data being presented by the web page

c) data from model objects AND the page template

d) right after the line introducing the class in the controller

Ans: d

 

27.why is it good to redirect after inserting info into the database?

a) unit, functional, and integration tests

b) a script that alters the structure of the underlying database

c) so that users can't accidentally resubmit information by refreshing the page

d) the data being presented by the web page

Ans: c

 

28.which two steps to include test.xml data to the partial "map" (via the variable "data")...?

a) from general to specific ('/ads/' and then '/ads/:id')

b) include test.xml to root of "public" folder and , render (:partial=>'map', :locals=>{:data=>'/test.xml'})

c) just replace the word "scaffold" with the word "model"

d) login method (that checks a username and password) and , a filter (that calls the login method when needed)

Ans: b

 

29.what environments does Rails have by default?

a) development, test, production

b) render :partial

c) RAILS_ENV (RAILS_ENV=production)

d) integration test

Ans: a

 

30.how do you generate regular model code (not scaffolding)?

a) just replace the word "scaffold" with the word "model"

b) it is not associated with a model

c) username == "admin" && password == "some_password"

d) do |f| (where "f" can be anything)

Ans: a

 

31.how should you order routes?

a) just replace the word "scaffold" with the word "model"

b) from general to specific ('/ads/' and then '/ads/:id')

c) rails generate migration AddPhoneToTickets phone:string

d) do |f| (where "f" can be anything)

Ans: b

 

32.what should you write in routes.rb to give meaning to http://mebay.com/ads/3?

a) from general to specific ('/ads/' and then '/ads/:id')

b) map.connect '/ads/:id', :controller=>'ads', :action=>'show'

c) include test.xml to root of "public" folder and ,render (:partial=>'map', :locals=>{:data=>'/test.xml'})

d) form_for(@object, :url=>{:action=>'create'})

Ans: b

 

33.to add login security, which two pieces of code do you need?

a) 1.all important data is a resource2. every resource has a proper name (URL)

b) .:format (that period is a concatenation period)

c) the method within the controller to call

d) 1. login method (that checks a username and password) and 2. a filter (that calls the login method when needed)

Ans: d

 

34.how do partials look compared to regular erb files?

a) underscores

b) it runs its validators

c) it is not associated with a model

d) their names begin with an underscore

Ans: d

 

35.how does "rake" differ from "ruby"?

a) right after the line introducing the class in the controller

b) a script that alters the structure of the underlying database

c) it can do more complex things like modifying the database structure and running tests

d) expression is ruby code that prints out a value in html

Ans: c

 

36.why should partials generally use local variables?

a) because they make the partial less dependent on other code

b) the data being presented by the web page

c) their names begin with an underscore

d) the request parameters table

Ans: a

 

37.do models have singular or plural names?

a) controller

b) CamelCase

c) flight_id

d) singular

Ans: d

 

38.how does rake tell which migrations have been run and which have not?

a) rails generate migration AddPhoneToTickets phone:string

b) rails records the latest timestamp of all the migrations it runs (and runs only the latest ones)

c) because they make the partial less dependent on other code

d) it can do more complex things like modifying the database structure and running tests

Ans: b

 

39.how does Rails choose to correct format to generate?

a) in the controller: respond_to do |format| ... end

b) it is not associated with a model

c) redirect_to " ... "

d) the data being presented by the web page

Ans: a

 

40.how do you express error messages in a form (do |f|)?

a) ruby make

b) f.error_messages

c) for ad in @ads

d) underscores

Ans: b

 

41.what are the three "magic columns"

a) id, created_at, updated_at

b) render :partial:id

c) integration test

d) rake db:migrate:id:delete

Ans: a

 

42.what tag starts a form?

a) integration test

b) <%= f.text_field :name %>

c) <% form_for() %>

d) <%= yield %>

Ans: c

 

43.what is params[...]?

a) have the same URL of a table

b) the word "private"

c) a responder object

d) the request parameters table

Ans: d

 

44.what comes after "def check_logged_in" line for site "ads"?

a) in the controller: respond_to do |format| ... end

b) errors.add_to_base("there was an error")

c) .:format (that period is a concatenation period)

d) authenticate_or_request_with_http_basic("Ads") do |username, password|

Ans: d

 

45.what is naming convention for classes?

a) ActionPack

b) CamelCase

c) ruby make

d) a web page

Ans: b

 

46.to create scafolding for "thing" data, run...

a) because they make the partial less dependent on other code

b) expression is ruby code that prints out a value in html

c) just replace the word "scaffold" with the word "model"

d) rails generate scaffold thing <column name 1>:<column type1> <column name 2>:<column type2>

Ans: d

 

47.what variable changes the environment?

a) RAILS_ENV (RAILS_ENV=production)

b) development, test, production

c) render :partial

d) validates_numericality_of

Ans: a

 

48.what is naming convention for file names ?

a) ActiveRecord

b) underscores

c) an object

d) validate

Ans: b

 

49.why do you only need to call "render" in the controller sometimes and not always?

a) .:format (that period is a concatenation period)

b) redirect_to " ... "

c) errors.add_to_base("there was an error")

d) if you're happy with the default template, you can omit "render"

Ans: d

 

50.a RESTful application uses ... to define an interaction with the data.

a) a responder object

b) it is not associated with a model

c) HTTP methods (post, get, put, delete)

d) the request parameters table

Ans: c

 

51.what generates web pages from page templates?

a) underscores

b) Embedded Ruby (ERb)

c) a web page

d) render :partial

Ans: b

 

52.where do you edit routs?

a) :controller

b) underscores

c) ActiveRecord

d) config/routes.rb

Ans: d

 

53.if looping through “f” object, how do you make a text field “name”?

a) <%= yield %>

b) … have the same URL

c) <% form_for() %>

d) <%= f.text_field :name %>

Ans: d

 

54.what does a model object do before it saves or updates data?

a) underscores

b) it runs its validators

c) validate

d) rake db:migrate

Ans: b

 

55.what does "rake" mean?

a) #{1+1}

b) singular

c) ruby make

d) flight_id

Ans: c

 

56.how do you start a loop that reads through the array object "@ads"?

a) a web page

b) ruby make

c) for ad in @ads

d) ActionPack

Ans: c

 

57.what scripts does the model-generator command create?

a) their names begin with an underscore

b) the model class (app/models/something.rb) and the data migration (db/migrate/..._create_something.rb)

c) model names are singular, controller (and table) names are plural

d) rails generate migration AddPhoneToTickets phone:string

Ans: b

 

58.what does Embedded Ruby (ERb) process as inputs?

a) data from model objects AND the page template

b) HTTP methods (post, get, put, delete)

c) it is not associated with a model

d) their names begin with an underscore

Ans: a

 

59.what kind of test do you create yourself?

a) an object

b) ActionPack

c) rake db:migrate

d) integration test

Ans: d

 

60.what is "format" in "repond_to do |format|"?

a) underscores

b) an object

c) a responder object

d) integration test

Ans: c

 

61.what does REST stand for?

a) runs State test

b) the request State Transfer

c) Representational State Transfer

d) runs State Transfer

Ans: c

 

62.what parameters are in <% form_for() %>?

a) data from model objects AND the page template

b) form_for(@object, :url=>{:action=>'create'})

c) .:format (that period is a concatenation period)

d) do |f| (where "f" can be anything)

Ans: b

 

63.how do you add an error (called "there was an error") in the validate method?

a) redirect_to " ... "

b) errors.add_to_base("there was an error")

c) the word "private"

d) their names begin with an underscore

Ans: b

 

64.how do you call a partial?

a) a web page

b) underscores

c) singular

d) render :partial

Ans: d

 

65.how do you run the latest migrations?

a) ruby make

b) a web page

c) rake db:migrate

d) CamelCase

Ans: c

 

66.what's special about a search form?

a) for ad in @ads

b) it is not associated with a model

c) Representational State Transfer

d) it runs its validators

Ans: b

 

67.what expression do all layouts have?

a) <%= yield %>

b) <% form_for() %>

c) integration test

d) <%= f.text_field :name %>

Ans: a

 

68.if the table Seats is associated with the table Flights, how should you name the table column in Seats to indicate its flight?

a) an object

b) flight_id

c) ruby make

d) #{1+1}

Ans: b

 

69.how would you insert "1 + 1" into a string?

a) CamelCase

b) #{1+1}

c) singular

d) validate

Ans: b

 

70.what is the second uri indicate?

a) an object

b) ActionPack

c) CamelCase

d) :controller

Ans: d

 

71.what precedes the "check_logged_in" method in a class?

a) the request parameters table

b) the word "private"

c) <% form_for() %>

d) redirect_to " ... "

Ans: b

 

72.what method name indicates to rails that it should validate before saving/updating?

 

a) validate

b) ActionPack

c) flight_id

d) ruby make

Ans: a

 

73.how do you ask for all records of the Ads table?

 

a) singular

b) @ads = Ad.find(:all)

c) validate

d) rake db:migrate

Ans: b

 

74.when data is retrieved from the database, what does Rails turn it into?

 

a) a responder object

b) validate

c) flight_id

d) an object

Ans: d

 

75.what are the main principles of REST?

 

a) 1. all important data is a resource, 2. every resource has a proper name (URL), 3. you can perform a standard set of operations on resources (usually CRUD), 4. client and server talk statelessly

b) model names are singular, controller (and table) names are plural

c) a script that alters the structure of the underlying database

d) no. arrays just keep references to objects stored in memory.

Ans: a

 

76.When is it best to use an array rather than a hash?

 

a) An array uses indices and a hash uses "keys"

b) puts (pronounced "put-ess")

c) Red refers to writing a failing test

d) When the order matters, use an array.

Ans: d

 

77.Describe the TDD cycle.

 

a) An array uses indices and a hash uses "keys"

b) It's a test that simulates a browser accessing our application.

c) Red, Green, Refactor,Red refers to writing a failing test,Green refers to writing a passing test Once we have a passing test we are free to refactor the code.

d) This maps requests for the URL /pages/home to the home action in the Pages controller.

Ans: c

 

78.How does a local variable differ from an instance variable when empty?

a) This is not a standard rails directory, but a directory installed by RSpec in which all test files are kept.

b) The @ indicates that this is an "instance variable". An instance variable defined in the action (or function) of a controller is automatically available in the view of that same name.

c) It's a test that simulates a browser accessing our application.

d) Ruby complains if we try to evaluate an undefined local variable, but issues no such complaint for an instance variable; instead, instance variables are nil if not defined

Ans: d

 

79.What is a .erb file?

a) The "erb" stands for "Embedded RuBy". .erb files look like about.html.erb and live in the "views" directory.They are just html files with embedded ruby in them.

b) The @ indicates that this is an "instance variable". An instance variable defined in the action (or function) of a controller is automatically available in the view of that same name.

c) puts (pronounced "put-ess")

d) It's a test that simulates a browser accessing our application.

Ans: a

 

80.What's the best way to describe an object in Ruby?

a) An array uses indices and a hash uses "keys"

b) It's easier to describe what objects do, which is respond to messages. An object like a string, for example, can respond to the message length, which returns the number of characters in the string

c) This maps requests for the URL /pages/home to the home action in the Pages controller.

d) It's a test that simulates a browser accessing our application.

Ans: b

 

81.What is a Class?

a) An array uses indices and a hash uses "keys"

b) Classes are simply a convenient way to organize functions (also called methods). In pages_controller.rb, PagesController is a Class which holds a "home" action.

c) A controller is a container for a group of (possibly dynamic) web pages.

d) This maps requests for the URL /pages/home to the home action in the Pages controller.

Ans: b

 

82.What kind of object is "@title" and what is special about it in Rails?

a) It's a test that simulates a browser accessing our application.

b) The "erb" stands for "Embedded RuBy". .erb files look like about.html.erb and live in the "views" directory.They are just html files with embedded ruby in them.

c) Ruby complains if we try to evaluate an undefined local variable, but issues no such complaint for an instance variable; instead, instance variables are nil if not defined

d) The @ indicates that this is an "instance variable". An instance variable defined in the action (or function) of a controller is automatically available in the view of that same name.

Ans: d

 

83.What does the routes.rb file do with "get pages/home"?

a) When a request is made for, say, /pages/home, the Pages controller executes the code in the "home" action and then automatically renders the view corresponding to the action -- in this case, home.html.erb.

b) This maps requests for the URL /pages/home to the home action in the Pages controller.

c) When the order matters, use an array.

d) It's a test that simulates a browser accessing our application.

Ans: b

 

84.Describe a "symbol" in Rails?

a) Ruby complains if we try to evaluate an undefined local variable, but issues no such complaint for an instance variable; instead, instance variables are nil if not defined

b) Symbols look kind of like strings, but prefixed with a colon instead of surrounded by quotes. For example, :name is a symbol. You can think of symbols as basically strings without all the extra baggage

c) An array uses indices and a hash uses "keys"

d) This is not a standard rails directory, but a directory installed by RSpec in which all test files are kept.

Ans: b

 

85.What is the status code for "success" when throwing a GET?

a) 300

b) 200

c) 400

d) 150

Ans: b

 

86.What is the command to print to the screen?

a) When the order matters, use an array.

b) An array uses indices and a hash uses "keys"

c) It's a test that simulates a browser accessing our application.

d) puts (pronounced "put-ess")

Ans: d

 

87.What is the main benefit that a Class gets by inheritance from ApplicationController?

a) An array uses indices and a hash uses "keys"

b) When a request is made for, say, /pages/home, the Pages controller executes the code in the "home" action and then automatically renders the view corresponding to the action -- in this case, home.html.erb.

c) This maps requests for the URL /pages/home to the home action in the Pages controller.

d) When the order matters, use an array.

Ans: b

 

88.Name two ways to indicate a "block" in Rails

a) This maps requests for the URL /pages/home to the home action in the Pages controller.

b) The request hits the rails router which dispatches to the proper controller action. In this case, it goes to the index action in the Users controller.

c) Curly braces or do..end. It's best to use curly braces for short one-line blocks and the do..end for mult-iline blocks.

d) When the order matters, use an array.

Ans: c

 

89.What is an integration test?

a) It's a test that simulates a browser accessing our application.

b) When the order matters, use an array.

c) puts (pronounced "put-ess")

d) An array uses indices and a hash uses "keys"

Ans: a

 

90.What is the most special aspect of nil?

a) This maps requests for the URL /pages/home to the home action in the Pages controller.

b) A controller is a container for a group of (possibly dynamic) web pages.

c) When the order matters, use an array.

d) Other than the object "false" itself, nil is the only object that defaults to false.

Ans: d

 

91.What is the /spec directory in rails?

a) Ruby complains if we try to evaluate an undefined local variable, but issues no such complaint for an instance variable; instead, instance variables are nil if not defined

b) Symbols look kind of like strings, but prefixed with a colon instead of surrounded by quotes. For example, :name is a symbol. You can think of symbols as basically strings without all the extra baggage

c) This is not a standard rails directory, but a directory installed by RSpec in which all test files are kept.

d) This maps requests for the URL /pages/home to the home action in the Pages controller.

Ans: c

 

92.What's the difference between a hash and an array?

a) An array uses indices and a hash uses "keys"

b) When the order matters, use an array.

c) It's a test that simulates a browser accessing our application.

d) puts (pronounced "put-ess")

Ans: a

 

93.What is a controller?

a) A controller is a container for a group of (possibly dynamic) web pages.

b) An array uses indices and a hash uses "keys"

c) It's a test that simulates a browser accessing our application.

d) When the order matters, use an array.

Ans: a

 

94.how do you define a "status" parameter (within a "tweet" parameter)?

a) code = tweet,url = /tweets/1

b) @tweet = Tweet.create(:status => params[:status])

c) params = {:tweet => {:status => "I'm dead" }}

d) @tweet = Tweet.create(:status => params[:tweet][:status])

Ans: d

 

95.how do you check the logged in user's id?

a) :status

b) session[:user_id]

c) t.errors

d) the attribute

Ans: b

 

96.let's say you have a method...

def get_tweet

@tweet = Tweet.find(params[:id])

end

how do you tie an action to that that only kicks in for the edit, update, and destroy methods?

a) index, show, new, edit, create, update, destroy

b) code = tweet, :method => :delete    

url = /tweets/1

c) before_filter :get_tweet, :only => [:edit, :update, :destroy]

d) @tweet = Tweet.create(:status => params[:tweet][:status])

Ans: c

 

97.How to includes all javascript?

a) <%= stylesheet_link_tag :all %>

b) <%= javascript_include_tag :defaults %>

c) <%= csrf_meta_tag %>

d) <%= link_to ... %>

Ans: b

 

98.what do you use to send messages to the user?

a) t.errors

b) :status

c) a flash

d) @tweet

Ans: c

 

99.how includes all stylesheet files?

a) <%= javascript_include_tag :defaults %>

b) <%= csrf_meta_tag %>

c) <%= link_to ... %>

d) <%= stylesheet_link_tag :all %>

Ans: d

 

100.how do you make sure your forms don't get hacked?

a) <%= stylesheet_link_tag :all %>

b) <%= csrf_meta_tag %>

c) <%= link_to ... %>

d) tweets_path

Ans: b

 

101.how do you make a link to a zombie's profile with the text of a zombies name?

a) <%= link_to tweet.zombie.name, zombie_path(tweet.zombie) %>

b) <%= javascript_include_tag :defaults %>

c) <%= link_to ... %>

d) <%= stylesheet_link_tag :all %>

Ans: a

 

102.how do you do validate to ensure ":status" exists and that it's length is at least 3 long?

a) validates :status, :presence => true, :length => {:minimum => 3}

b) params = {:tweet => {:status => "I'm dead" }}

c) <%= stylesheet_link_tag :all %>

d) code = tweet, :method => :delete

url = /tweets/1

Ans: a

 

103.what code generates the url "/tweets/new"? (action = new tweet form)

a) tweets_path

b) @tweet

c) new_tweet_path

d) Embedded Ruby

Ans: c

 

104.How to create multiple hashes inside "params" (like "status" within "tweet")?

a) params = {:tweet => {:status => "I'm dead" }}

b) @tweet = Tweet.create(:status => params[:status])

c) code = tweet, :method => :delete

url = /tweets/1

d) @tweet = Tweet.create(:status => params[:tweet][:status])

Ans: a

 

105.how do you make a link?

a) the attribute

b) <%= csrf_meta_tag %>

c) <%= link_to ... %>

d) <%= stylesheet_link_tag :all %>

Ans: c

 

106.what code generates the url "/tweets"?

a) new_tweet_path

b) a flash

c) @tweet

d) tweets_path

Ans: d

 

107.how do you change show method in the controller to render in "status.html.erb"

a) @tweet = Tweet.create(:status => params[:tweet][:status])

b) @tweet = Tweet.create(:status => params[:status])

c) class Tweet

validates_presence_of :status

end

d) def show

@tweet = Tweet.find(1)

render :action => 'status'

end

Ans: d

 

108.what do you write to indicate that a tweet from table "tweets" only belongs to one zombie? (from table "zombies")?

a) class Tweet

validates_presence_of :status

end

b) class Zombie < ActiveRecord::Base

has_many :tweets

end

c) class Tweet < ActiveRecord::Base

belongs_to :zombie

end

d) class TweetsController < ApplicationController

...

end

Ans: c

 

109.show errors in object "t"

a) @tweet

b) t.presence

c) t.errors

d) t.status

Ans: c

 

110.what file corresponds to the "show" method

a) new_tweet_path

b) /app/views/tweets/show.html.erb

c) tweets_path

d) the attribute

Ans: b

 

111.  what does "erb" stand for in file_name.erb?

            a.Error ruby

            b.Embedded Ruby

            C.Enchanter ruby

            d.Extract ruby

Ans: b

 

112.what is partial page templates (or partials)?

a) another term for hash

b) embedded ruby code in templates

c) a tag containing a piece of ruby code

d) fragments of pages that are stored in separate files

Ans: d

 

113.What is scriptlet?

a) a tag containing a piece of ruby code

b) an environment

c) another term for hash

d) integration test

Ans: a

 

114.------sets the location and type of your databbase as well as a few other settings (like how long messages will be recorded)

a) a fixture

b) unit test

c) an action

d) an environment

Ans: d

 

115.how you start a form that matches a model object?

a) form_tag

b) model form

c) form_for

d) a fixture

Ans: c

 

116.how you start a form that doesn't match a model object

a) unit test

b) form_tag

c) a fixture

d) form_for

Ans: b

 

117.which web application that integrates data and services from other places on the web

a) a fixture

b) an action

c) form_for

d) mashup

Ans: d

 

118.how  is authenticity token works?

a) where url requests come through

b) fragments of pages that are stored in separate files

c) embedded ruby code in templates

d) used by Rails to ensure that a request comes from a Rails-generated page

Ans: d

 

119.In Rails, a test of a model class is called ----------------.

a) a fixture

b) functional test

c) an action

d) unit test

Ans: d

 

120.In Rails, a test of an individual controller is called ------------------.

a) an action

b) functional test

c) integration test

d) unit test

Ans: b

 

121.what test that tests the whole system?

a) an environment

b) functional test

c) integration test

d) unit test

Ans: c

 

122.A form bound to a model object is called -------.

a) form_for

b) model form

c) an action

d) a fixture

Ans: b

 

123.what is called a set of test data?

a) an action

b) a fixture

c) form_tag

d) unit test

Ans: b

 

124.what is a layout?

a) a tag containing a piece of ruby code

b) the set of operations that a Rails app carries out in response to a request from a user

c) fragments of pages that are stored in separate files

d) this defines an html wrapper for all of the templates belonging to a particular model

Ans: d

 

125. What is Ruby on Rails?

a) Web application framework

b) PHP framework

c) Train loaded with Rubies

Ans: a

 

126.Who wrote Ruby on Rails?

a) Gudo Rossum

b) Yukihiro Matsumoto

c) David Hansson

Ans: c

 

127.Does Ruby on Rails make app development easier?

a) Yes, It does

b) No, It doesn't

c) No Idea

Ans: a

 

128. What does DRY mean?

a) Don't rub yourself

b) Don't repeat yourself

c) Don't redo yourself

Ans: b