Our team has conducted extensive research to compile a set of Ruby on Rails MCQs. We encourage you to test your Ruby on Rails knowledge by answering these multiple-choice questions provided below.
Simply scroll down to begin!
A. rake db:rollback STEP=5
B. database_undo
C. rake db:drop
D. rake db:rollback
A. $
B. %
C. @
D. @@
A. [1, 2, 3, 4, 5]
B. [1, [2, 3, 4, 5]]
C. [2, 3, [4, 5]]
D. [1, 2, 3, [4, 5]]
E. {1: [2, 3, [4, 5]]}
A. 'rails new /path/to/new/app'
B. 'rails /path/to/new/app'
C. 'rails create /path/to/new/app'
A. big_data.del(1)
B. big_data.del[1]
C. big_data.delete(1)
A. $ in Ruby is treated as a class variable
B. $ in Ruby is treated as a global variable
A. class variable
B. instance variable
A. sandbox
B. test
C. development
D. production
A. A configuration item
B. Functionality in a package
A. .erb
B. .slim
C. .rabl
D. .haml
A. MVC are the initials of the creator, Michael Vincent Clantor.
B. mySQL is the database, vi is the text editor, and C++ is the language.
C. models represent the data, views display the data, and controllers respond to user interactions
D. manipulators handle data, validators ensure data integrity, and communicators transfer information between them.
A. gem install ruby_on_rails
B. gem install ror
C. gem install rails
A. database_create
B. rake db:migrate
C. rake db:create
D. rails create
A. rails destroy
B. rake db:drop
C. rake db:migrate
D. database_drop
A. @@
B. @
A. null
B. nil
A. database_update
B. rake db:migrate
C. rails update
D. rake db:rollback
A. generally affect only views and sometimes controllers.
B. can never be reversed.
C. back up a project by copying it to another location.
D. are considered poor programming and are not used significantly in Rails.
E. modify a database by adding or removing columns or tables.
A. validates :name, :presence => true
B. save!
C. before_save if name != nil return true end return false end
D. validates :name => not_null
A. "/monster"
B. "#{monster}"
C. {monster}
D. "{monster}"
A. foo*2
B. foofoo
C. Gives an Error
D. foo
A. ActiveRails
B. ActiveSupport
C. SQL
D. MySQL
E. ActiveRecord
A. .yml
B. .erb
C. .rb
D. .html.erb
A. db
B. lib
C. app
D. All of these are standard directories
E. config
A. app/assets/javascripts
B. app/javascripts
C. assets/javascripts
D. public/javascripts
A. db/default_data.rb
B. db/migrate/inital_load.rb
C. db/migrate/default_data.rb
D. db/seeds.rb
A. null
B. nil
C. 0
D. nul
A. yes
B. no
A. puts "Hello WORLD!"
B. print "Hello WORLD!"
C. disp( "Hello WORLD!" )
A. User.build(:name => 'david')
B. User.create(:name => 'david')
C. User.new(:name => 'david')
D. User.make(:name => 'david')
A. -VERSION
B. --version
C. -v
A. match '/person', :to => 'dog#show'
B. map.resources :person
C. map.resources :dog
D. map.resources :person => :dog
A. To find the value of a variable
B. To find the memory allocated to that variable
C. To determine if the variable is defined at the current scope
D. To find whether it is a constant or variable
A. rails.js
B. jQuery
C. rails-script
D. Prototype
A. instance variable
B. class variable
A. belongs_to :book
B. has_many: books
C. has_one :books
D. has_one :book
A. +some_partial.html.erb
B. some_partial.html.erb
C. @some_partial.html.erb
D. partial_some_partial.html.erb
E. _some_partial.html.erb
A. [1,2,3]
B. [4]
C. [1]
D. [1,2,3,4]
A. arr.length = arr.length+1 arr[length-1] = item
B. arr << item
C. arr.map(item.clone)
D. arr.append(item)
A. class A def a end end
B. class A def self.a end end
A. validates_numericality_of
B. validates_length_of
C. validates_form_of
D. validates_presence_of
E. validates_uniqueness_of
A. nothing
B. The entire migration
C. self.down
D. self.up
A. while i < 100 do # DO THINGS i += 1
B. while i < 100: # DO THINGS i += 1 end
C. while i < 100 do # DO THINGS i += 1 end
A. True
B. False
A. app/routes.rb
B. db/routes.rb
C. config/routes.rb
D. app/config/routes.rb
A. resources :person do member do post :short end collection do get :long end end
B. response.map{|person| => :restful}
C. resources :people
D. map.person => {:get, :post, :put}
A. symbols, belongs to the category of immutable
B. string, belongs to the category of immutable
A. true
B. false
A. Application.layout.Javascripts <<
B.
C. <%= javascript_include_tag
D. :render => {:javascript => 'FILE NEEDED'}
A. ||
B. <=
C. &&
D. =!
E. !=