Correct Answers | Verified | Updated (Actual
Exam) 2026/2027
1. In the MVC (Model-View-Controller) architecture, the Model is responsible for:
A. Handling user input and responding to requests
B. Managing the application's data and business logic
C. Rendering the user interface
D. Managing the database schema
Correct Answer: B
Rationale: In MVC, the Model represents the application's data and business logic. It
interacts with the database and contains the validation and business rules.
2. In MVC architecture, the View is responsible for:
A. Handling user input and responding to requests
B. Managing the application's data and business logic
C. Rendering the user interface
D. Managing the database schema
Correct Answer: C
Rationale: The View is responsible for rendering the user interface and presenting data
to the user.
3. In MVC architecture, the Controller is responsible for:
A. Handling user input and responding to requests
B. Managing the application's data and business logic
C. Rendering the user interface
D. Managing the database schema
Correct Answer: A
Rationale: The Controller handles user input, processes requests, and coordinates
between the Model and the View.
4. Which of the following is the correct order of the MVC request cycle?
,A. Controller → Model → View → Response
B. Model → Controller → View → Response
C. View → Controller → Model → Response
D. Controller → View → Model → Response
Correct Answer: A
Rationale: The typical MVC request cycle is: Router → Controller → Model → View →
Response. The controller receives the request, interacts with the model, and renders the
view.
5. Which Rails command creates a new Rails application?
A. rails new myapp
B. rails create myapp
C. rails generate myapp
D. rails start myapp
Correct Answer: A
Rationale: rails new myapp is the command used to create a new Rails application.
6. Which file contains the database configuration for a Rails application?
A. config/database.yml
B. config/application.rb
C. config/routes.rb
D. config/environment.rb
Correct Answer: A
Rationale: config/database.yml contains the database configuration for each
environment (development, test, production).
7. Which file contains the routing configuration for a Rails application?
A. config/database.yml
B. config/application.rb
C. config/routes.rb
D. config/environment.rb
Correct Answer: C
Rationale: config/routes.rb contains the routing configuration that maps URLs to
controller actions.
,8. The Gemfile is used to:
A. Configure the database
B. Configure the routes
C. Specify the gems required for the application
D. Specify the application configuration
Correct Answer: C
Rationale: The Gemfile specifies the gems required for the Rails application and their
versions.
9. Which of the following is a Rails environment?
A. development
B. test
C. production
D. All of the above
Correct Answer: D
Rationale: Rails has three standard environments: development, test, and production.
10. The rails server command is used to:
A. Create a new Rails application
B. Start the Rails development server
C. Generate a new controller
D. Run database migrations
Correct Answer: B
Rationale: rails server (or rails s) starts the Rails development server on port 3000.
11. Which of the following is a generator command in Rails?
A. rails generate model
B. rails generate controller
C. rails generate migration
D. All of the above
Correct Answer: D
Rationale: Rails has generators for models, controllers, migrations, and many other
components.
, 12. The rails generate model command creates:
A. A model file, migration file, and test files
B. Only a model file
C. Only a migration file
D. Only a controller file
Correct Answer: A
Rationale: rails generate model creates a model file, a migration file, and test files.
13. The rails db:migrate command is used to:
A. Create the database
B. Run database migrations
C. Rollback database migrations
D. Seed the database
Correct Answer: B
Rationale: rails db:migrate runs pending database migrations.
14. The rails db:create command is used to:
A. Create the database
B. Run database migrations
C. Rollback database migrations
D. Seed the database
Correct Answer: A
Rationale: rails db:create creates the database defined in config/database.yml.
15. The rails db:seed command is used to:
A. Create the database
B. Run database migrations
C. Rollback database migrations
D. Populate the database with seed data
Correct Answer: D
Rationale: rails db:seed populates the database with seed data from db/seeds.rb.
16. The rails console command is used to: