Choose a topic to test your knowledge and improve your Ruby skills
Which of the following is supported by Ruby?
Which of the following features does the 2.0 version of ruby supports?
Which of the following languages syntax matches with the Rubyβs syntax?
What is the extension used for saving the ruby file?
Which of the following are valid floating point literal?
Which of the following datatypes are valid in Ruby?
What will any variable evaluate to if it is of Boolean data type?
Why can not we use quotation marks (β or β) with boolean?
What is the size of an integer data type in ruby?
What is the output of the given code? boolean_1 = 77<78 puts(boolean_1)
Objects of which class does the integer from the range -2^30 to 2^(30-1) belong to?
What does the notataion stands for?
What is the output of the given code? my_string=Ruby puts(my_string)
Which of the following is not a valid datatype?
What is the range of octal notation ( nn)?
Which of the following is not a valid library function?
Why is the library function βputsβused for?
For getting an input from the user which method is used?
What is the output of given code? puts "what is your first name?" name=gets.chomp puts "what is your surname?" surname=gets.chomp
Which sequence can be used to substitute the value of any ruby expression in a string?
Why is gets not preferred instead of gets.chomp?
What is the output of the given code? print "What's your address" city,state,pin=gets.chomp,gets.chomp,gets.chomp puts "Iam from #{city} city, #{state} state, pincode: #{pin} "
What is the output of the the given code? puts "My name is #{Name}"
What is the output of the given code? Ans=Ruby puts "#{Ans} is an oop language" puts "It is very efficient langauge" puts "#{expr} is used on rails platform"
What is the output of the given code? Ans=Ruby puts "#[Ans] is an oop language"
Which of the following is not a valid library function?
Which of the following is the valid string method?
What is the output of the following? "Iam learning ruby language".length
What will be the output of the following? "Eric".irreverse
What does the .upcase method do?
What will be the output of the following? "Ruby".reverse.upcase
What will be the output of the given code? "I'am learning Ruby Language".length.reverse.upcase
What will we the output of the given code? "I'am Learning RUBY Language".downcase
What is the output of given code? string="I'am Learning RUBY Language".downcase string.upcase
What will be the output of the given code? "Come let's learn.reverse Ruby.length language".upcase
What will we the output of the given code? I'am Learning RUBY Language.downcase
What is the use of .capitalize method?
What is the role of ! at the end of the capitalize method?
What is the output of the code? print "What's your first name?" first_name=gets.chomp a=first_name.capitalize first_name.capitalize! print "What's your last name?" last_name=gets.chomp b=last_name.capitalize last_name.capitalize! puts "My name is #{first_name} #{last_name}"
What is the output of the code? print "What's your first name?" first_name=gets.chomp a=first_name.capitalize first_name.capitalize! print "What's your last name?" last_name=gets.chomp b=last_name.capitalize last_name.capitalize puts "My name is #{first_name} #{last_name}"
What is the output of the given code? print "what's your first name?" first_name=gets.chomp a=first_name.capitalize "first_name.capitalize!".reverse puts"My name is #{first_name}"
What is the output of the given code? print "what's your first name?" first_name=gets.chomp a=first_name.capitalize "a".reverse puts"My name is #{a}"
What is the output of the given code? print "What's your first name?" first_name=gets.chomp a=first_name.capitalize a=a.reverse puts"My name is #{a}"
What do we mean by expression substitution?
What is the output of the given code? x, y, z = 12, 36, 72 puts "The value of x is #{ x }." puts "The sum of x and y is #{ x + y }." puts "The average was #{ (x + y + z)/3 }."
What does %{Learn ruby language} represents? a) β b) β%{Learn Ruby language}β c) β d) None of the mentioned
What does %Q{ Learn ruby language } represents? a) β
What does %x!ls! represents?
Why do we use comments?
How to comment multiple lines in ruby? a)
How to comment multiple lines in ruby?
How to comment a single line?
What is the output of the given code? βRubyβ.length #to find the length of given string
Why do we use =begin and =end?
What is the output of the given code? "Ruby Language".length =begin calculate length =end
What is the output of the given code? "Ruby Language".length = begin calculate length = end
If expression. The expression can be of which type?
What is the output of the following? if 1<2 print "one is less than two" end
What is the output of the code? if 11<2 print "Eleven is less than two" end print "11 is greater"
What is the output of the given code? if 11>2 puts "Eleven is greater than two" end print "You'r right"
What is the output of the given code? test_1 = 17 > 16 puts(test_1) test_2 = 21 <= 30 puts(test_2) test_3 = 9 >= 9 puts(test_3) test_4 = -11 > 4 puts(test_4)
What is the output of the given code? a="string" b="strings" if(a==b) print ("a and b are same") else print "Not same" end
What is the output of the given code? a=10 b=9 if(a>b) print ("a greater than b") else print "Not greater" end
Which of the following are used for comparison?
What is the output of the given code? if(a==10 && b=9) print "true" else print "false" end
What is the output of the given code? counter=1 if counter<=5 puts (counter) counter=counter+1
Which of the following is a valid boolean operator?
What will the following expression evaluate to? true && false
What will be the output of the given code?boolean_1 = 77 < 78 && 77 < 77 puts boolean_1
What will the following expression evaluate to? true || false mentioned
What will the following expression evaluate to? (true && false) || (!true)
What will the following expression evaluate to? !true && !false
What will be the output of the given code? boolean_1 = (3 < 4 || false) && (false || true) puts boolean_1
What will be the output of the given code? boolean_1 = !(3 < 4 || false) && (false || true) puts boolean_1
What will be the output of the given code? boolean_1 = false || -10 > -9 puts boolean_1
What will be the output of the given code? boolean_1 = !(700 / 10 == 70) puts boolean_1
What will be the output of the given code? boolean_1 = !true puts boolean_1 boolean_2 = !true && !true puts boolean_2
What will be the output of the given code? boolean_2 = !true && (!true || 100 != 5**2) puts boolean_2
Which of the following is a valid assignment operator?
What does the **= assignment operator do?
What is the output of the given code? counter = 1 while counter < 11 puts counter counter+=1 end
What is the output of the given code? counter = 100 while counter > 0 puts counter counter/=5 end
What is the output of the given code? counter = 100 while counter > 0 puts counter counter-=25 end
What is the output of the given code? counter = -50 while counter <0 puts counter counter+=10 end
What is the output of the given code? a = 22.5 while a >11.5 puts a a-=3.5 end
What is the output of the given code? a = 5 b=10 while a <10 && b<20 puts a+b a+=2 b+=2 end
What is the output of the given code? a = 5 b=10 while a <10 && b<20 puts a*b a+=2 b+=2 end
What is the output of the given code? a= 5 b=10 while a <10 && b<20 puts a-b a+=2 b+=2 end
What is the output of the given code? a = 5 b=10 while a <10 || b<20 puts a*b a+=2 b+=2 end
What is the output of the given code? a = 5 b=10 while (a <10 || b<20)&&true puts a*b a+=2 b+=2 end