Sunday, December 13, 2015

University Of Pune Question Paper,CORE RUBY,2010 Question Paper,M. C. M. (Semester - II),

University Of Pune Question Paper
M. C. M. (Semester - II) Examination - 2010
CORE RUBY
(New 2008 Pattern)
Time : 3 Hours] [Max. Marks : 70
Instruction :
Question Nos. 1 and 7 are compulsory. Solve any four from the
rest.
Q.1) Find output of the following : (Any Five) [15]
(a) arr = [1, 2, 3, 4, 5]
sum = 0
arr.each {|i| sum + = i}
puts sum
(b) s = ‘Ruby=Gems’
i = s.index(‘=’)
puts s[0...i]
puts s[i + 1, s.length]
(c) i = 0
while (i < 15)
i + = 1
next if i % 2 == 0
puts i
end
[3877]-205 1 P.T.O.
(d) class Square
def initialize (side_length)
@side_length = side_length
end
def area
@side_length * @side_length
end
end
a = Square.new(25)
puts a.area
(e) x = {“a” = > 5, “b” = > 7, “c” = > 9}
x.each {|key, value| puts “#{key} equals#{value}”}
puts x.keys.inspect
(f) def basic_method
x = 75
puts x
end
x = 10
basic_method
puts x
(g) a = [2, 4, 6, 8 10, 12]
puts a[1..4].inspect
a[1..3] = [“a”, “b”, “c”]
puts a.inspect
[3877]-205 2 Contd.
Q.2) Write a program to print prime numbers between 200 to 300. [10]
Q.3) Write a program that reads a file and prints total number of words
in the file. [10]
Q.4) Design a class for Book_Master with instance variables (Bookid,
Bookname, AuthorName, and Price)
Write a routine to accept 10 records and store it in array.
Write a method MaxBooks that prints author’s name who had
written maximum books and also prints book details of that author. [10]
Q.5) Accept an array of 10 integers and count total number of odd
and even numbers. [10]
Q.6) Write a Ruby program to print the following pattern : [10]
12 3 4 3 2 1
1 2321
121
1
Q.7) Write short notes : (Any Three) [15]
(a) Nested Classes
(b) Blocks and Iterators
(c) Collections
(d) Procs and Lamdas
(e) Exception Handling
Share This
Previous Post
Next Post

B.E Civil Engineer Graduated from Government College of Engineering Tirunelveli in the year 2016. She has developed this website for the welfare of students community not only for students under Anna University Chennai, but for all universities located in India. That's why her website is named as www.IndianUniversityQuestionPapers.com . If you don't find any study materials that you are looking for, you may intimate her through contact page of this website to know her so that it will be useful for providing them as early as possible. You can also share your own study materials and it can be published in this website after verification and reviewing. Thank you!

0 comments:

Pen down your valuable important comments below

Search Everything Here