Thursday, December 5, 2024
HomeC Programmingruby on rails interview

ruby on rails interview


 

1.A module can’t be subclassed or instantiated.

A.True 

B.False 

2.What Comes after <% form_for()…?

A. redirect_to “…”

B. the request parameters desk 

C. do |f| (the place ‘f’ might be something)

D. <%=f.text_field:identify%>    

3.Which of the next languages syntax matches with the Rubys syntax?

A.Perl 

B.PHP

C.Jquery

D.Java

4.Which sequence can be utilized to substitute the worth of any ruby expression in a string?

A.#(expr)

B.#{expr}

C.#expr

D.not one of the above 

5.Once you put one thing into an array,does the array maintain a separate copy?

A.no.arrays simply maintain references to things saved in reminiscence.

B.the info being introduced by the online web page 

C.it isn’t related to a mannequin 

D.the request paramters desk

6.Which of the next will not be a sound library perform?

A.Places 

B.Print 

C.Will get

D.Get

7.What is the distinction between mannequin identify and controller names?

A.the tactic throughout the controller to name 

B.the info being introduced by the webpage 

C.mannequin names are singular,controller(and desk) names are plural

D.within the controller:respond_to do |format| …finish 

8.what steps get you from file.erb to file.html?

A. knowledge from mannequin objects AND the web page template 

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

C. the tactic throughout the controller to name 

D. the info being introduced by the online web page 

9.what’s the filter code that calls on the “check_logged_in” methodology for under the “edit” and “replace” strategies?

A.the info being introduced by the online web page 

B.HTTP strategies(submit,get,put,delete)

C.knowledge from mannequin objects AND the web page template 

D.before_filter:check_logged_in, :solely =>[:edit,:update]

10.What’s the output of the next? I’m studying ruby language.size 

A. 27 

B. 23 

C. 26

D. 18

11.Convert database information to things is known as ________.

A. for advert in @advertisements 

B. integration check 

C. Representational State Switch 

D. an object-relational mapping library 

12.the place do you add the filter code?

A. rails generate migration AddPhoneToTickets cellphone:string

B. the info being introduced by the online web page 

C. knowledge from mannequin objects AND the web page template 

D. proper after the road introductitng the category within the controller 

13.what environments does Rails have by default?

A. growth,check,manufacturing 

B. render:partial 

C. RAILS_ENV(RAILS_ENV=manufacturing)

D. integration check 

14.how do you generate common mannequin code (not scaffolding)?

A. simply change the phrase “scaffold” with the phrase “mannequin”

B. it isn’t related to a mannequin 

C. username==”admin” && password==”some_password”

D. do |f| (the place “f” might be something)

15.What would be the output of the next?Ruby.reverse.upcase 

A. RUBY 

B. ybuR

C. YBUR

D. YBUr

16.how do you tie an motion to that solely kicks in for the edit,replace,and destroy strategies?

A.index,present,new,edit,create,replace,destroy

B. code=tweet; :methodology => :delete url=/tweets/1 

C.before_filter:get_tweet,:solely=>[:edit,:update,:destroy]

D.@tweet=Tweet.create(:standing=>params[:tweet][:status])

17.What’s the output of the given code? “Ruby”.size #to search out the size of given string 

A.4 to search out the size of given string 

B.4 

C.To seek out the size of given string

D.Ruby

18.How do you outline a “standing” parameter(inside a “tweet” parameter)?

A.code=tweet,url=/tweets/1

B.@tweet=Tweet.create(:standing=>params[:status])

C.params = {:tweet =>{:standing=> “I’ m useless”}}

D.@tweet=Tweet.create(:standing => params[:tweet][:status])

19.What does %Q{Be taught ruby language} represents?

A.”Be taught Ruby language”

B.”%{Be taught Ruby language}”

C.”Be taught Ruby language”

D.not one of the talked about

20.When Whitespace characters corresponding to areas and tabs can’t ignored in Ruby code?

A. Whereas utilizing strings

B. Whereas utilizing integer

C. whereas utilizing float worth

D. All the above

21.Which character is used to present remark in ruby?

A. !

B. @

C. #

D. $

22.Which of the next are legitimate floating level literal?

A. 0.5

B. 5

C. 0.5

D. 5

23.Which of the next will not be a Reserved Phrases in Ruby?

A. start

B. guarantee

C. retry

D. cross

24.Block remark conceals a number of traces from the interpreter with?

A. =start and =finish

B. =begin and =finish

C. =right here and =finish

D. =start and =ending

25.Which of the next options does the two.0 model of ruby helps?

A. New literals

B. Safety fixes

C. Methodology key phrase arguments

D. All the above

26.Ruby 2.7.1 model launch date?

A. 31-03-2019

B. 31-01-2020

C. 31-03-2020

D. 31-04-2019

27.Which assertion is used to declares code to be known as earlier than this system is run?

A. Begin

B. Start

C. Right here

D. Finish

28.Ruby was written in?

A. C

B. C++

C. Java

D. Goal C

29.what environments does Rails have by default?

A.growth, check, manufacturing

B.render :partial

C.RAILS_ENV (RAILS_ENV=manufacturing)

D.integration check

30.how do you generate common mannequin code (not scaffolding)?

A.simply change the phrase “scaffold” with the phrase “mannequin”

B.it isn’t related to a mannequin

C.username == “admin” && password == “some_password”

D.do |f| (the place “f” might be something)

31.what does Embedded Ruby (ERb) course of as inputs?

A.knowledge from mannequin objects AND the web page template

B.HTTP strategies (submit, get, put, delete)

C.it isn’t related to a mannequin

D.their names start with an underscore

32.what’s “format” in “repond_to do |format|”?

A.underscores

B.an object

C.a responder object

D.integration check

33.how do you add an error (known as “there was an error”) within the validate methodology?

A.redirect_to ” … “

B.errors.add_to_base(“there was an error”)

C.the phrase “non-public”

D.their names start with an underscore

34.if the desk Seats is related to the desk Flights, how must you identify the desk column in Seats to point its flight?

A.an object

B.flight_id

C.ruby make

D.#{1+1}

35.what methodology identify signifies to rails that it ought to validate earlier than saving/updating?

A.validate

B.ActionPack

C.flight_id

D.ruby make

36.When is it finest to make use of an array somewhat than a hash?

A.An array makes use of indices and a hash makes use of “keys”

B.places (pronounced “put-ess”)

C.Purple refers to writing a failing check

D. When the order issues, use an array.

37.What’s the essential profit {that a} Class will get by inheritance from ApplicationController?

A.An array makes use of indices and a hash makes use of “keys”

B. When a request is made for, say, /pages/residence, the Pages controller executes the code within the “residence” motion after which routinely renders the view similar to the motion — on this case, residence.html.erb.

C.This maps requests for the URL /pages/residence to the house motion within the Pages controller.

D.When the order issues, use an array.

38.how do you outline a “standing” parameter (inside a “tweet” parameter)?

A.code = tweet,url = /tweets/1

B.@tweet = Tweet.create(:standing =>params[:status])

C.params = {:tweet => {:standing => “I am useless” }}

D. @tweet = Tweet.create(:standing =>params[:tweet][:status])

39.how do you tie an motion to that that solely kicks in for the edit, replace, and destroy strategies?

A. index, present, new, edit, create, replace, destroy

B.code = tweet, :methodology => :delete url = /tweets/1

C.before_filter :get_tweet, :solely => [:edit, :update, :destroy]

D.@tweet = Tweet.create(:standing =>params[:tweet][:status])

40.what do you employ to ship messages to the person?

A. t.errors

B.:standing

C. a flash

D.@tweet

41.Objects of which class does the integer from the vary -2^30 to 2^(30-1) belong to ?

A. Fixnum 

B. Binary 

C. Bignum 

D. Octal

42.Block remark conceals a number of traces from the interpreter with ?

A. =begin and =finish 

B. =start and =ending 

C. =right here and =finish 

D. =start and =finish 

43.what must you write in routes.rb to present that means to http://mebay.com/advertisements/3?

A. from basic to particular (‘/advertisements/’ after which ‘/advertisements/:id’)

B. map.join ‘/advertisements/:id’, :controller=>’advertisements’, :motion=>’present’

C. embrace check.xml to root of “public” folder and ,render (:partial=>’map’, :locals=>{:knowledge=>’/check.xml’})

D. form_for(@object, :url=>{:motion=>’create’})

44.how does Rails select to appropriate format to generate?

A. within the controller: respond_to do |format| … finish

B. it isn’t related to a mannequin

C. redirect_to ” … “

D. the info being introduced by the online web page

45.why do you solely have to name “render” within the controller typically and never at all times?

A. .:format (that interval is a concatenation interval)

B. redirect_to ” … “

C. errors.add_to_base(“there was an error”)

D. if you happen to’re pleased with the default template, you may omit “render”

46.aRESTful software makes use of … to outline an interplay with the info.

A. a responder object

B. it isn’t related to a mannequin

C. HTTP strategies (submit, get, put, delete)

D.the request parameters desk

47.what does a mannequin object do earlier than it saves or updates knowledge?

A. underscores

B. it runs its validators

C. validate

D.rake db:migrate

48.what methodology identify signifies to rails that it ought to validate earlier than saving/updating?

A. validate

B. ActionPack

C. flight_id

D. ruby make

49.When is it finest to make use of an array somewhat than a hash?

A. An array makes use of indices and a hash makes use of “keys”

B. places (pronounced “put-ess”)

C. Purple refers to writing a failing check

D. When the order issues, use an array.

50.so as to add login safety, which two items of code do you want?

A.1.all necessary knowledge is a resource2. each useful resource has a correct identify (URL)

B..:format (that interval is a concatenation interval)

C.the tactic throughout the controller to name

D.1. login methodology (that checks a username and password) and a pair of. a filter (that calls the login methodology when wanted)

Query no Reply
1 A
2 C
3 A
4 B
5 A
6 D
7 C
8 B
9 D
10 A
11 D
12 D
13 A
14 A
15 C
16 C
17 B
18 D
19 A
20 A
21 C
22 A
23 D
24 A
25 D
26 C
27 B
28 A
29 A
30 A
31 A
32 C
33 B
34 B
35 A
36 D
37 B
38 D
39 C
40 C
41 A
42 D
43 B
44 A
45 D
46 C
47 B
48 A
49 D
50 D
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments