×

Multiple-Choice Questions

Web Technologies MCQs

Computer Science Subjects MCQs

Databases MCQs

Programming MCQs

Testing Software MCQs

Digital Marketing Subjects MCQs

Cloud Computing Softwares MCQs

AI/ML Subjects MCQs

Engineering Subjects MCQs

Office Related Programs MCQs

Management MCQs

More

Ruby on Rails MCQs

Ruby on Rails MCQs: This section contains multiple-choice questions on Ruby on Rails. All MCQs have the correct answers and explanations. These MCQs will help students and professionals to test their skills and to enhance their knowledge of Ruby on Rails.

List of Ruby on Rails MCQs

1. Rails is ____.

  1. A web application framework
  2. A ORM tool
  3. A Library of Ruby
  4. Rails is a web application framework.

Answer: A) A web application framework

Explanation:

Ruby on Rails (Rails) is a web application framework.

Discuss this Question


2. Rails framework runs on which of the following programming language?

  1. Python
  2. Java
  3. Ruby
  4. Perl

Answer: C) Ruby

Explanation:

Rails is a web application framework running on the Ruby programming language.

Discuss this Question


3. Which of the following, creates a new application?

  1. $ rails latest
  2. $ rails now
  3. $ rails new
  4. $ rails create

Answer: C) $ rails new

Explanation:

$ rails new, create a new application.

Discuss this Question


4. The controllers, models, views, helpers, mailers, channels, tasks, and assets for your application are all located in which of the following folder?

  1. Config
  2. Public
  3. App
  4. temp

Answer: C) App

Explanation:

The controllers, models, views, helpers, mailers, channels, tasks, and assets for your application are all located in the app folder.

Discuss this Question


5. Which of the following folder has the Rails script that launches your application as well as any additional scripts you might need to install, configure, update, or otherwise manage your application?

  1. Config
  2. Temp
  3. Public
  4. Bin

Answer: D) Bin

Explanation:

The "Bin" folder has the Rails script that launches your application as well as any additional scripts you might need to install, configure, update, or otherwise manage your application.

Discuss this Question


6. Which of the following folder contains compiled assets and static files?

  1. Temp
  2. Static
  3. Public
  4. Bin

Answer: C) Public

Explanation:

The public folder contains compiled assets and static files.

Discuss this Question


7. Which of the following folder is a place for all third-party code?

  1. Rakefile
  2. Vendor
  3. Static
  4. App

Answer: B) Vendor

Explanation:

A vendor folder is a place for all third-party codes.

Discuss this Question


8. To terminate the web server, use ____ in the terminal window where it is currently operating.

  1. Ctrl+Q
  2. Ctrl+W
  3. Ctrl+S
  4. Ctrl+C

Answer: D) Ctrl+C

Explanation:

To terminate the web server, use Ctrl+C in the terminal window where it is currently operating.

Discuss this Question


9. In the development environment, does rails require you to restart the server?

  1. Yes
  2. No

Answer: B) No

Explanation:

Rails often does not require you to restart the server when working in the development environment.

Discuss this Question


10. Which of the following links a controller action to a request?

  1. Pipeline
  2. Route
  3. Model
  4. Link

Answer: B) Route

Explanation:

A route links a controller action to a request.

Discuss this Question


11. Which of the following handles the request and prepares any relevant data for the view?

  1. Model
  2. Controller
  3. View
  4. Route

Answer: B) Controller

Explanation:

A controller action handles the request and prepares any relevant data for the view.

Discuss this Question


12. A ____ presents information in the specified format.

  1. View
  2. Modal
  3. Window

Answer: A) View

Explanation:

A view presents information in the specified format.

Discuss this Question


13. Views are templates that are often created using a combination of HTML and Ruby. True or false?

  1. True
  2. False

Answer: A) True

Explanation:

Views are templates that are often created using a combination of HTML and Ruby.

Discuss this Question


14. Routes are rules written in a ____.

  1. HTTP protocols
  2. Python
  3. TCP
  4. Ruby DSL (Domain-Specific Language).

Answer: D) Ruby DSL (Domain-Specific Language).

Explanation:

Routes are rules written in a Ruby DSL (Domain-Specific Language).

Discuss this Question


15. Does Rails applications use require to load application code?

  1. Yes
  2. No

Answer: B) No

Explanation:

Rails applications do not use require to load application code.

Discuss this Question


16. A ____ is a Ruby class that is used to represent data.

  1. View
  2. Param
  3. Model

Answer: C) Model

Explanation:

The root segment is the segment that sits at the top of the hierarchy.

Discuss this Question


17. ____ are used to change the database structure of an application.

  1. Migrate
  2. Transitions
  3. Migrations

Answer: C) Migrations

Explanation:

Migrations are used to change the database structure of an application.

Discuss this Question


18. In Rails applications, migrations are written in ____.

  1. Ruby
  2. Python
  3. Perl
  4. C#

Answer: A) Ruby

Explanation:

To provide database independence, migrations in Rails applications are written in Ruby.

Discuss this Question


19. Rails provides a routes method named ____ that maps all of the conventional routes for a collection of resources.

  1. Require
  2. Resources
  3. Options
  4. Maps

Answer: B) Resources

Explanation:

Rails provides a route method named resources that maps all of the conventional routes for a collection of resources.

Discuss this Question


20. We can inspect what routes are mapped by running which of the following command?

  1. bin/rails routes
  2. bin/rails routing mapped
  3. bin/rails mapped
  4. bin/rails route_mapped

Answer: A) bin/rails routes

Explanation:

We can inspect what routes are mapped by running the bin/rails routes command.

Discuss this Question


21. Which of the following statement is True?

  1. Statement 1: Render triggers a new request from the browser.
  2. Statement 2: render will render the supplied view for the current request.

Answer: B) Statement 2: render will render the supplied view for the current request.

Explanation:

Statement 2 is correct i.e., render will render the supplied view for the current request.

Discuss this Question


22. To develop our form, we'll utilize a Rails functionality known as a ____.

  1. Form Generator
  2. Form Creator
  3. Form decorator
  4. Form builder

Answer: D) Form builder

Explanation:

To develop our form, we'll utilize a Rails functionality known as a form builder.

Discuss this Question


23. To assist us to cope with erroneous user input, Rails has a feature called ____.

  1. Vitiate
  2. Corroborate
  3. Validations
  4. Retrospect

Answer: C) Validations

Explanation:

To assist us to cope with erroneous user input, Rails has a feature called validations.

Discuss this Question


24. ____ returns true if this object has been destroyed, otherwise returns false.

  1. Destroy()
  2. Destroy!()
  3. Delete!()
  4. Destroyed?()

Answer: D) Destroyed?()

Explanation:

destroyed?() returns true if this object has been destroyed, otherwise returns false.

Discuss this Question


25. Does the delete statement also deletes the records marked as #readonly?

  1. Yes
  2. No

Answer: A) Yes

Explanation:

Yes, the delete statement will also delete the records marked as #readonly.

Discuss this Question


26. Which of the following statement is True?

  1. Statement 1: redirect_to will trigger a new request from the browser.
  2. Statement 2: redirect_to will render the supplied view for the current request.

Answer: A) Statement 1: redirect_to will trigger a new request from the browser.

Explanation:

Statement 1 is correct i.e., redirect_to will trigger a new request from the browser.

Discuss this Question


27. There is no callback execution, and the row is simply deleted with an SQL ____ statement.

  1. DELETE
  2. DESTROY
  3. DELETE!
  4. DESTROY!

Answer: A) DELETE

Explanation:

There is no callback execution, and the row is simply deleted with an SQL DELETE statement.

Discuss this Question


28. What is the difference between destroy and delete?

  1. Delete runs any callbacks on the model while Destroy doesn't.
  2. Destroy runs any callbacks on the model while Delete doesn't.

Answer: B) Destroy runs any callbacks on the model while Delete doesn't.

Explanation:

Destroy and delete differ in a certain that destroy executes any callbacks on the model while delete does not.

Discuss this Question


29. Which of the following updates a single attribute and saves the record?

  1. update_columns(attributes)
  2. update!(attributes)
  3. update_column(name, value)
  4. update_attribute(name, value)

Answer: D) update_attribute(name, value)

Explanation:

update_attribute(name, value) updates a single attribute and saves the record.

Discuss this Question


30. ____ uses an UPDATE SQL query to make changes to the attributes directly in the database and sets them in the receiver.

  1. update_columns(attributes)
  2. update!(attributes)
  3. update_column(name, value)
  4. update_attribute(name, value)

Answer: A) update_columns(attributes)

Explanation:

update columns(attributes) uses an UPDATE SQL query to make changes to the attributes directly in the database and sets them in the receiver:

Discuss this Question


31. Which of the following is the fastest way to update attributes?

  1. update_columns(attributes)
  2. update!(attributes)
  3. update_column(name, value)
  4. update_attribute(name, value)

Answer: A) update_columns(attributes)

Explanation:

update columns(attributes) is the fastest way to update attributes because it goes straight to the database.

Discuss this Question


32. Rails offers how many built-in assertions which are designed to make testing routes simpler?

  1. 5
  2. 4
  3. 3
  4. 2

Answer: C) 3

Explanation:

To make testing routes easier, Rails comes with three built-in assertions:

  • assert_generates
  • assert_recognizes
  • assert_routing

Discuss this Question


33. Which of the following can be used with default routes or custom routes, and it claims that a specific set of options produces a specific path?

  1. assert_generates
  2. assert_recognizes
  3. assert_routing

Answer: A) assert_generates

Explanation:

Assert_generates can be used with default routes or custom routes, and it claims that a specific set of options produces a specific path.

Discuss this Question


34. Among assert_recognizes and assert_routing which of the following is the inverse of assert_generates?

  1. assert_recognizes
  2. assert_routing

Answer: A) assert_recognizes

Explanation:

assert_recognizes is the inverse of assert_generates.

Discuss this Question


35. Which of the following option allows you to override the named route helper names that are typically used?

  1. :over
  2. :method
  3. :as
  4. :override

Answer: C) :as

Explanation:

The :as option allows you to override the named route helper names that are typically used.

Discuss this Question


36. ____ allow the program to keep track of user-specific data while users engage with it.

  1. Transactions
  2. Sessions
  3. Cycles

Answer: B) Sessions

Explanation:

Sessions allow the program to keep track of user-specific data while users engage with it.

Discuss this Question


37. Which of the following assertion verifies the route in both directions: it verifies that both the path and the options are generated?

  1. assert_generates
  2. assert_recognizes
  3. assert_routing

Answer: C) assert_routing

Explanation:

The assert_routing assertion verifies the route in both directions: it verifies that both the path and the options are generated.

Discuss this Question


38. Cookies have a size limit of ____.

  1. 10KB
  2. 100KB
  3. 4KB

Answer: C) 4KB

Explanation:

Cookies have a size limit of 4 kB.

Discuss this Question


39. You can redirect any path to another path by using the ____ helper in your router.

  1. Divert
  2. Pass
  3. Routes
  4. Redirect

Answer: D) Redirect

Explanation:

You can redirect any path to another path by using the redirect helper in your router.

Discuss this Question


40. With the ____ option, you can specifically designate a controller to use for the resource.

  1. :routingengine
  2. :redirect
  3. :path
  4. :controller

Answer: D) :controller

Explanation:

With the :controller option, you can specifically designate a controller to use for the resource.

Discuss this Question


41. Cookies are stored on the ____.

  1. Client-side
  2. Server-side

Answer: A) Client-side

Explanation:

Cookies are stored on the client-side.

Discuss this Question


42. Cookies are ____ by nature.

  1. Permanent
  2. Temporary

Answer: B) Temporary

Explanation:

Cookies are temporary by nature.

Discuss this Question


43. Rails ____ cookies by default?

  1. Decrypt
  2. Encrypt
  3. None

Answer: B) Encrypt

Explanation:

By default, Rails encrypts cookies. Without compromising the cookie's encryption, the client is unable to view or modify its information.

Discuss this Question


44. The ____ command combines the results of two SQL searches into a single set.

  1. Intersection
  2. Append
  3. Union

Answer: C) Union

Explanation:

The UNION command combines the results of two SQL searches into a single set.

Discuss this Question


45. An ____ attack involves injecting malicious code or parameters into a web application to run it within a secure environment

  1. Hijacking
  2. CSRF
  3. Injection

Answer: C) Injection

Explanation:

An injection attack involves injecting malicious code or parameters into a web application to run it within a secure environment.

Discuss this Question


46. To remove an attachment from a model, use the ____ command on the attachment.

  1. Revoke
  2. Remove
  3. Delete
  4. Purge

Answer: D) Purge

Explanation:

To remove an attachment from a model, use the purge command on the attachment.

Discuss this Question


47. Active Storage supports how many ways to serve files?

  1. 2
  2. 3
  3. 4
  4. 5

Answer: A) 2

Explanation:

Active Storage supports two ways to serve files: redirecting and proxying.

Discuss this Question


48. All Active Storage controllers are ____ by default.

  1. Privately accessible
  2. Publicly accessible

Answer: B) Publicly accessible

Explanation:

All Active Storage controllers are publicly accessible by default.

Discuss this Question


49. Rails offers how many standard spots to place initialization code?

  1. 2
  2. 3
  3. 4
  4. 5

Answer: D) 5

Explanation:

Rails offers four standard spots to place initialization code:

  • config/application.rb
  • Environment-specific configuration files
  • Initializers
  • After-initializers

Discuss this Question


50. Which method is used to specify a filter that is executed before to a controller action?

  1. before_router
  2. before_action
  3. before_engine
  4. before_component

Answer: B) before_action

Explanation:

before_action method is used to specify a filter that is executed before a controller action.

Discuss this Question


51. Instance variable in Ruby begins with ____.

  1. @@
  2. @
  3. &
  4. __

Answer: B) @

Explanation:

The instance Variable in Ruby begins with @ symbol.

Discuss this Question


52. Which of the following inheritance does Ruby support?

  1. Multilevel
  2. Multiple
  3. Hierarchical
  4. Single
  5. All of the above

Answer: D) Single

Explanation:

Ruby only supports single inheritance.

Discuss this Question


53. CSRF stands for ____.

  1. Combine system request forgery
  2. Crucial site render forgery
  3. Cross-site render forgery
  4. Cross-site request forgery

Answer: D) Cross-site request forgery

Explanation:

CSRF stands for Cross-Site Request Forgery.

Discuss this Question


54. ____ is a sort of attack when the attacker sends a form to a separate website on your behalf that might result in harm or the disclosure of sensitive data.

  1. Crypto-jacking
  2. CSRF
  3. DDOS
  4. Injection

Answer: B) CSRF

Explanation:

CSRF is a sort of attack when the attacker sends a form to a separate website on your behalf that might result in harm or the disclosure of sensitive data.

Discuss this Question


55. Class variable in Ruby begins with ____.

  1. @@
  2. @
  3. &
  4. __

Answer: A) @@

Explanation:

Class Variable in Ruby begins with @@ symbol.

Discuss this Question


56. Is Ruby an object-oriented programming language?

  1. Yes
  2. No

Answer: A) Yes

Explanation:

Ruby is an object-oriented programming language inspired by PERL and Python.

Discuss this Question


57. Global variable in Ruby begins with ____.

  1. @@
  2. $$
  3. &
  4. $

Answer: D) $

Explanation:

Global Variable in Ruby begins with $ symbol.

Discuss this Question


58. ____ are modules that offer techniques that your view can use right away.

  1. Component
  2. Assertions
  3. Helpers

Answer: C) Helpers

Explanation:

Helpers are modules that offer techniques that your view can use right away.

Discuss this Question


59. Which of the following access modifiers are not used in Ruby?

  1. Public
  2. Private
  3. Protected
  4. None

Answer: D) None

Explanation:

Ruby has three access modifiers: public, protected, and private.

Discuss this Question


60. In Ruby, the scaffolding is done automatically?

  1. True
  2. False

Answer: A) True

Explanation:

In Ruby, the scaffolding is done automatically.

Discuss this Question


61. Which of the following type of variable is available in the Ruby class?

  1. Local Variables
  2. Global Variables
  3. Class Variables
  4. Instance Variables
  5. All of the above

Answer: E) All of the above

Explanation:

Types of variables available in Ruby Class are,

  • Local Variables
  • Global Variables
  • Class Variables
  • Instance Variables

Discuss this Question


62. When a model object changes, ____ are in charge of terminating or expiring caches.

  1. Injectors
  2. Janitors
  3. Sweepers

Answer: C) Sweepers

Explanation:

When a model object changes, sweepers are in charge of terminating or expiring caches.

Discuss this Question


63. Plugins are installed ____.

  1. In the application folder
  2. On a machine

Answer: A) In the application folder

Explanation:

The plugin is also ruby code, it is installed in the application folder and only available for that specific application.

Discuss this Question


64. Ruby ____ is a technique for adding a string to a literal.

  1. Interpolation
  2. Substitution
  3. Injection

Answer: A) Interpolation

Explanation:

Ruby interpolation is a technique for adding a string to a literal.

Discuss this Question


65. What is a gem?

  1. A gem is a just ruby code that is installed on a machine
  2. A gem is a just ruby code that is installed in the application folder

Answer: A) A gem is a just ruby code that is installed on a machine

Explanation:

A gem is a just ruby code that is installed on a machine and accessible to any Ruby programs running on that computer.

Discuss this Question




Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.