Tutorials

Empowering academic aid to discover, learn and succeed


Ruby Multiple Choice Questions (MCQs)

1 .
Topic:  Output
Question:
What is the output of the following ruby code puts 'd' .. 'a'
A
a,b,c,d
B
a,b,c
C
d,c,b,a
D
" "

Answer: D
2 .
Topic:  Variables
Question:
In ruby how do you check if a variable is defined as in the script or not
A
instance
B
defined?
C
defined
D
local

Answer: B
3 .
Topic:  System Variables
Question:
What is the System variable in Ruby used to specifies line number last read by gets
A
$.
B
$_
C
$*
D
$@

Answer: A
4 .
Topic:  Variables
Question:
The ________ variables are associated with a class and all instances of a class have the same class variable copy
A
local variable
B
instance variable
C
global variable
D
class variable

Answer: D
5 .
Topic:  Blocks & Props
Question:
The ________ objects are blocks of code bound to a set of local variables
A
class
B
private
C
proc
D
instance

Answer: C
6 .
Topic:  Exception Handling
Question:
In ruby __________ clause to handle exception
A
raise
B
rescue
C
ensure
D
Exception

Answer: B
7 .
Topic:  Blocks & Props
Question:
What is the operator used to explicitly convert between a block and object
A
@
B
&
C
%
D
%{ }

Answer: B
8 .
Topic:  ActionController
Question:
A controller integrates the model with the view using __________ methods
A
model
B
private
C
action
D
public

Answer: D
9 .
Topic:  ActiveRecord
Question:
The _________ method is used o create an Active Record object that is saved in the database table
A
new
B
create
C
connection
D
update

Answer: B
10 .
Topic:  ActionController
Question:
The request parameters are available to the controller action with the ________ method
A
action
B
render
C
params
D
partial

Answer: C
11 .
Topic:  Routes
Question:
To map matching URLs to controllers actions using
A
Scaffolding
B
Rail Routes
C
Rail Helpers
D
JavascriptGenerator

Answer: B
12 .
Topic:  Templates
Question:
The modules that are available to the associated view templates
A
ErB
B
Routes
C
Helpers
D
templates

Answer: C
13 .
Topic:  Views
Question:
The variables defined in the views are available in
A
layout
B
view
C
routes
D
action

Answer: A
14 .
Topic:  Views
Question:
In view to update one or more elements on a web page by using
A
layout
B
except
C
only
D
partial

Answer: D
15 .
Topic:  Patterns
Question:
Rail models are typically based on ___________ design pattern
A
Action
B
Controller
C
Route
D
ActiveRecord

Answer: D
16 .
Topic:  Basic
Question:
Which one of the following ruby code create the string "Hello Ruby"
A
%{Hello Ruby%
B
@Hello Ruby
C
%(Hello Ruby)
D
%Hello Ruby!

Answer: C

Advertisements