Ruby on Rails/Ruby on Rails Multiple choice Questions Set 1 Sample Test,Sample questions

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

1.a web page

2.ruby make

3.for ad in @ads

4.ActionPack

Posted Date:-2022-08-22 13:32:49


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

1.<%= yield %>

2.… have the same URL

3.<% form_for() %>

4. <%= f.text_field :name %>

Posted Date:-2022-08-22 13:28:41


Question:
.what are the three "magic columns"

1. id, created_at, updated_at

2.render :partial:id

3.integration test

4.rake db:migrate:id:delete

Posted Date:-2022-08-22 13:10:43


Question:
.what does "rake" mean?

1.#{1+1}

2.singular

3.ruby make

4.flight_id

Posted Date:-2022-08-22 13:30:55


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

1.the method within the controller to call

2.the data being presented by the web page

3. model names are singular, controller (and table) names are plural d)

4.in the controller: respond_to do |format| ... end

Posted Date:-2022-08-22 10:26:37


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

1.a responder object

2.validate

3.flight_id

4.an object

Posted Date:-2022-08-23 06:13:15


Question:
.why should partials generally use local variables?

1.because they make the partial less dependent on other code

2.the data being presented by the web page

3.their names begin with an underscore

4.the request parameters table

Posted Date:-2022-08-22 13:04:50


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

1.a responder object

2.it is not associated with a model

3. HTTP methods (post, get, put, delete) d)

4.the request parameters table

Posted Date:-2022-08-22 13:24:50


Question:
converts database records to objects is called -------------.

1.for ad in @ads

2.integration test

3.Representational State Transfer

4. an object-relational mapping library

Posted Date:-2022-08-22 10:31:20


Question:
do models have singular or plural names?

1.controller

2.CamelCase

3.flight_id

4.singular

Posted Date:-2022-08-22 13:05:32


Question:
how do partials look compared to regular erb files?

1.underscores

2.it runs its validators

3.it is not associated with a model

4. their names begin with an underscore

Posted Date:-2022-08-22 13:02:26


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

1.redirect_to " ... "

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

3.the word "private"

4.their names begin with an underscore

Posted Date:-2022-08-23 05:59:09


Question:
how do you ask for all records of the Ads table?

1.singular

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

3.validate

4.rake db:migrate

Posted Date:-2022-08-23 06:10:44


Question:
how do you call a partial?

1.a web page

2.underscores

3.singular

4. render :partial

Posted Date:-2022-08-23 06:00:18


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

1.unit, functional, and integration tests

2.RAILS_ENV (RAILS_ENV=production)

3.integration test

4. rails generate migration AddPhoneToTickets phone:string

Posted Date:-2022-08-22 10:06:44


Question:
how do you express error messages in a form (do |f|)?

1.ruby make

2. f.error_messages

3.for ad in @ads

4.underscores

Posted Date:-2022-08-22 13:09:34


Question:
how do you generate regular model code (not scaffolding)?

1.just replace the word "scaffold" with the word "model"

2.it is not associated with a model

3.username == "admin" && password == "some_password"

4.do |f| (where "f" can be anything)

Posted Date:-2022-08-22 12:55:52


Question:
how do you run a migration?

1.CamelCase

2.ruby make

3.an object

4. rake db:migrate

Posted Date:-2022-08-22 10:12:33


Question:
how do you run the latest migrations?

1.ruby make

2.a web page

3. rake db:migrate

4.CamelCase

Posted Date:-2022-08-23 06:01:41


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

1.format (that period is a concatenation period)

2.HTTP methods (post, get, put, delete)

3.their names begin with an underscore

4.unit, functional, and integration tests

Posted Date:-2022-08-22 10:18:59


Question:
how do you update?

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

2.unit, functional, and integration tests

3.format (that period is a concatenation period)

4.it is not associated with a model

Posted Date:-2022-08-22 10:14:55


Question:
how does "rake" differ from "ruby"?

1.right after the line introducing the class in the controller

2.a script that alters the structure of the underlying database

3. it can do more complex things like modifying the database structure and running tests

4.expression is ruby code that prints out a value in html

Posted Date:-2022-08-22 13:03:29


Question:
how does Rails choose to correct format to generate?

1. in the controller: respond_to do |format| ... end

2.it is not associated with a model

3.redirect_to " ... "

4.the data being presented by the web page

Posted Date:-2022-08-22 13:08:07


Question:
how does rake tell which migrations have been run and which have not?

1.rails generate migration AddPhoneToTickets phone:string

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

3.because they make the partial less dependent on other code

4.it can do more complex things like modifying the database structure and running tests

Posted Date:-2022-08-22 13:07:15


Question:
how should you order routes?

1.just replace the word "scaffold" with the word "model"

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

3.rails generate migration AddPhoneToTickets phone:string

4.do |f| (where "f" can be anything)

Posted Date:-2022-08-22 12:57:55


Question:
how would you insert "1 + 1" into a string?

1.CamelCase

2.#{1+1}

3.singular

4.validate

Posted Date:-2022-08-23 06:05:46


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

1.an object

2.flight_id

3.ruby make

4.#{1+1}

Posted Date:-2022-08-23 06:04:43


Question:
Rails' application framework is called ----------?

1.ActionPack

2.ActiveRecord

3.a web page

4.an object

Posted Date:-2022-08-22 10:11:52


Question:
representation of a resource is called -------------.

1.CamelCase

2.ruby make

3. a web page

4.ActionPack

Posted Date:-2022-08-22 10:30:21


Question:
Ruby on Rails Multiple choice Questions

1.runs State test

2.the request State Transfer

3.Representational State Transfer

4.runs State Transfer

Posted Date:-2022-08-23 05:57:22


Question:
to add login security, which two pieces of code do you need?

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

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

3.the method within the controller to call

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

Posted Date:-2022-08-22 13:01:37


Question:
to create scafolding for "thing" data, run...

1.because they make the partial less dependent on other code

2.expression is ruby code that prints out a value in html

3.just replace the word "scaffold" with the word "model"

4.rails generate scaffold thing <column name 1>:<column type1> <column name 2>:<column type2>

Posted Date:-2022-08-22 13:19:50


Question:
what checks if an input is numeric?

1.integration test

2.Fa responder object

3.validate

4.validates_numericality_of

Posted Date:-2022-08-22 10:32:37


Question:
what comes after <% form_for()... ?

1.redirect_to " ... "

2.the request parameters table

3.<%= f.text_field :name %>

4.do |f| (where "f" can be anything)

Posted Date:-2022-08-22 10:15:48


Question:
what comes after "def check_logged_in" line for site "ads"?

1.in the controller: respond_to do |format| ... end

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

3.format (that period is a concatenation period)

4.authenticate_or_request_with_http_basic("Ads") do |username, password|

Posted Date:-2022-08-22 13:15:36


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

1.the method within the controller to call

2.HTTP methods (post, get, put, delete)

3.the data being presented by the web page

4.their names begin with an underscore

Posted Date:-2022-08-22 10:13:37


Question:
what does a model object do before it saves or updates data?

1.underscores

2. it runs its validators

3.validate

4.rake db:migrate

Posted Date:-2022-08-22 13:29:47


Question:
what does Embedded Ruby (ERb) process as inputs?

1. data from model objects AND the page template

2.HTTP methods (post, get, put, delete)

3.it is not associated with a model

4.their names begin with an underscore

Posted Date:-2022-08-22 13:34:38


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

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

2.h is a helper method that escapes special characters to sanitize malicious input

3.a script that alters the structure of the underlying database

4.the method within the controller to call

Posted Date:-2022-08-22 10:24:23


Question:
what environments does Rails have by default?

1.development, test, production

2.render :partial

3.RAILS_ENV (RAILS_ENV=production)

4.integration test

Posted Date:-2022-08-22 12:54:48


Question:
what expression do all layouts have?

1. <%= yield %>

2.<% form_for() %>

3.integration test

4.<%= f.text_field :name %>

Posted Date:-2022-08-23 06:03:48


Question:
what generates web pages from page templates?

1.underscores

2. Embedded Ruby (ERb)

3.a web page

4.render :partial

Posted Date:-2022-08-22 13:25:55


Question:
what is "format" in "repond_to do |format|"?

1.underscores

2.an object

3. a responder object

4.integration test

Posted Date:-2022-08-22 13:37:08


Question:
what is "migration"?

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

2.a script that alters the structure of the underlying database

3.their names begin with an underscore

4.the data being presented by the web page

Posted Date:-2022-08-22 10:27:27


Question:
What is bundler?

1.rails generate scaffold User name:string email:string

2.self-contained bundles of gems. Useful for versioning.

3. Edit Gemfile, then run 'bundle install' or just 'bundle'.

4.Ruby Version Manager. Install and manage multiple versions of Ruby.

Posted Date:-2022-08-22 10:01:19


Question:
What is gem?

1.rails generate scaffold User name:string email:string

2.self-contained packages of Ruby code

3.self-contained bundles of gems. Useful for versioning.

4.Ruby Version Manager. Install and manage multiple versions of Ruby.

Posted Date:-2022-08-22 10:03:25


Question:
What is gemset?

1.self-contained bundles of gems. Useful for versioning.

2.self-contained packages of Ruby code

3.Ruby Version Manager. Install and manage multiple versions of Ruby.

4.rails generate scaffold User name:string email:string

Posted Date:-2022-08-22 10:02:19


Question:
what is naming convention for classes?

1.ActionPack

2.CamelCase

3.ruby make

4.a web page

Posted Date:-2022-08-22 13:17:36


Question:
what is naming convention for file names ?

1.ActiveRecord

2.underscores

3.an object

4.validate

Posted Date:-2022-08-22 13:21:47


Question:
what is params[...]?

1.have the same URL of a table b)

2.the word "private"

3.a responder object

4. the request parameters table

Posted Date:-2022-08-22 13:12:51


Question:
what is Rails' object-relational mapping library?

1.CamelCase

2.ActiveRecord

3.an object

4.underscores

Posted Date:-2022-08-22 10:33:38


Question:
what is Rails' object-relational mapping library?

1.CamelCase

2.ActiveRecord

3.an object

4.underscores

Posted Date:-2022-08-22 12:34:09


Question:
What is rake?

1.self-contained bundles of gems. Useful for versioning.

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

3.rails generate scaffold User name:string email:string

4.Ruby Version Manager. Install and manage multiple versions of Ruby.

Posted Date:-2022-08-22 10:05:45


Question:
What is rvm?

1.rails generate scaffold User name:string email:string

2. Ruby Version Manager. Install and manage multiple versions of Ruby.

3.self-contained bundles of gems. Useful for versioning.

4.self-contained packages of Ruby code

Posted Date:-2022-08-22 10:10:27


Question:
what is scaffold command?

1.rails generate scaffold User name:string email:string

2.Ruby Version Manager. Install and manage multiple versions of Ruby.

3.self-contained packages of Ruby code

4.self-contained bundles of gems. Useful for versioning.

Posted Date:-2022-08-22 10:04:19


Question:
what is scriptlet versus expression

1.it runs its validators

2.it is not associated with a model

3.Representational State Transfer

4. expression is ruby code that prints out a value in html

Posted Date:-2022-08-22 10:23:21


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

1.the data being presented by the web page

2.HTTP methods (post, get, put, delete)

3.data from model objects AND the page template

4. before_filter :check_logged_in, :only => [:edit, :update]

Posted Date:-2022-08-22 10:29:36


Question:
what is the second uri indicate?

1.an object

2.ActionPack

3.CamelCase

4.controller

Posted Date:-2022-08-23 06:06:29


Question:
what kind of test do you create yourself?

1.an object

2.ActionPack

3.rake db:migrate

4. integration test

Posted Date:-2022-08-22 13:35:50


Question:
what kind of tests are there?

1.unit, functional, and integration tests

2.it is not associated with a model

3.id, created_at, updated_at

4.it runs its validators

Posted Date:-2022-08-22 10:17:28


Question:
what method name indicates to rails that it should validate before saving/updating?

1.validate

2.ActionPack

3.flight_id

4.ruby make

Posted Date:-2022-08-23 06:09:09


Question:
what parameters are in <% form_for() %>?

1.data from model objects AND the page template

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

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

4.do |f| (where "f" can be anything)

Posted Date:-2022-08-23 05:58:16


Question:
what precedes the "check_logged_in" method in a class?

1.the request parameters table

2. the word "private"

3.<% form_for() %>

4.redirect_to " ... "

Posted Date:-2022-08-23 06:07:38


Question:
what scripts does the model-generator command create?

1.their names begin with an underscore

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

3.model names are singular, controller (and table) names are plural

4.rails generate migration AddPhoneToTickets phone:string

Posted Date:-2022-08-22 13:33:47


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

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

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

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

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

Posted Date:-2022-08-22 13:00:52


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

1.data from model objects AND the page template

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

3.the method within the controller to call

4.the data being presented by the web page

Posted Date:-2022-08-22 10:28:11


Question:
what tag starts a form?

1.integration test

2.<%= f.text_field :name %>

3. <% form_for() %>

4.<%= yield %>

Posted Date:-2022-08-22 13:11:48


Question:
what variable changes the environment?

1.RAILS_ENV (RAILS_ENV=production)

2.development, test, production

3.render :partial d)

4.validates_numericality_of

Posted Date:-2022-08-22 13:20:58


Question:
what's special about a search form?

1.for ad in @ads

2. it is not associated with a model

3.Representational State Transfer

4.it runs its validators

Posted Date:-2022-08-23 06:03:01


Question:
when you put something into an array, does the array keep a separate copy?

1. no. arrays just keep references to objects stored in memory.

2.the data being presented by the web page

3.it is not associated with a model

4.the request parameters table

Posted Date:-2022-08-22 10:20:08


Question:
where do you add the filter code?

1.rails generate migration AddPhoneToTickets phone:string

2.the data being presented by the web page

3.data from model objects AND the page template

4. right after the line introducing the class in the controller

Posted Date:-2022-08-22 12:35:26


Question:
where do you edit routs?

1.controller

2.underscores

3.ActiveRecord

4.config/routes.rb

Posted Date:-2022-08-22 13:26:54


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

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

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

3.just replace the word "scaffold" with the word "model"

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

Posted Date:-2022-08-22 12:38:42


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

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

2.redirect_to " ... "

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

4. if you're happy with the default template, you can omit "render"

Posted Date:-2022-08-22 13:23:36


Question:
why is it good to redirect after inserting info into the database?

1.unit, functional, and integration tests

2.a script that alters the structure of the underlying database

3. so that users can't accidentally resubmit information by refreshing the page

4.the data being presented by the web page

Posted Date:-2022-08-22 12:37:36


More MCQS

  1. Ruby MCQ Questions
  2. Ruby on Rails Multiple choice Questions Set 1
  3. Ruby on Rails Multiple choice Questions Set 2
  4. Ruby on Rails Multiple choice Questions Set 3
  5. Ruby on Rails MCQ
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!