MCQGeeks
0 : 0 : 1
CBSE
JEE
NTSE
NEET
English
UK Quiz
Quiz
Driving Test
Practice
Games
Quiz
Computer Science
Ruby
Quiz 2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Q.1
What is the output of the the given code? puts "My name is #{Name}"
Error in compilation
Name variable not defined earlier
My name is #{Name}
Undefined Error
Q.2
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} "
Error in compilation
Give your address
What’s your address? ChennaiTamil Nadu600048I am from Chennai city, Tamil Nadu state, pincode: 600048
None of the mentioned
Q.3
What is the output of given code?puts "what is your first name?" name=gets.chomp puts "what is your surname?" surname=gets.chomp
Error in compilation
What is your first name?xyz(enter any name)What is your surname?wtu(enter your surname)
Name=xyz
None of the mentioned
Q.4
For getting an input from the user which method is used?
get
gets.chomp
get-s
chomp
Q.5
We use semicolon or parentheses after every print or puts statement.
True
False
Q.6
What is the output of the given code?print "Hey" puts "Everyone!" print "We are learning Ruby"
Error
Hey everyone we are learning Ruby
Hey everyone
Hey EveryoneWe are learning Ruby
Q.7
Why is the library function ‘puts’used for?
Prints whatever is given and print it to the screen
Prints whatever is given and insert a new(blank) line
Gets input from the user
None of the mentioned
Q.8
Which of the following is not a valid library function?
Puts
Print
Gets
Get
Q.9
The Ruby method for getting input from the user.
puts
print
gets
.chomp
Q.10
Ruby can be used for developing internet and intranet applications.
True
False
Q.11
Text that Ruby won't run as code. Single Line Comments are declared using #. Comments are good for clarifying code and reminders.
Multiple Line Comment
Single Line Comment
Comment
Single-Line Comment
Q.12
Ruby does NOT require a keyword when declaring variables. Ruby uses = (assignment operator) to assign values to variables.
Methods
Basic Ruby arithmetic operators
Variables in Ruby
Print
Q.13
Puts - adds a new (blank) line after the thing you want to print. NOT used with print, use puts rather than print.Example:puts "Hello World!"
Puts
Print
Method
Line Comment
Q.14
Ruby can be embedded into Hypertext Markup Language(HTML).
True
False
Q.15
Which of the following are valid floating point literal?
.5
2
0.5
None of the mentioned
Q.16
Print - takes whatever you give it and prints it to the screenExample:print "Hello World!"
Multi-Line Comments
Single Line Comment
Puts
Print
Q.17
What is the extension used for saving the ruby file?
.ruby extension
.rb extension
.rrb extension
None of the mentioned
Q.18
Creator of the Ruby programming language.
Isoraku "Isoku" Yamamoto
Yukihiro "Matz" Matsumoto
Kobayashi "Rindo-Senpai" Rindo
Shunsuke "Shunka-san" Nakamura
Q.19
Which of the following languages syntax matches with the Ruby’s syntax?
Perl
PHP
Java
Jquery
Q.20
Which of the following is supported by Ruby?
Multiple Programming Paradigms
Dynamic Type System
Automatic Memory Management
All of the Mentioned
0 h : 0 m : 1 s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Report Question
×
What's an issue?
Question is wrong
Answer is wrong
Other Reason
Want to elaborate a bit more? (optional)
Support mcqgeeks.com by disabling your adblocker.
×
Please disable the adBlock and continue.
Thank you.
Reload page