quiz1-example-soln-fall11

quiz1-example-soln-fall11 - CMSC330 Fall 2011 Example Quiz...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CMSC330 Fall 2011 Example Quiz #1 Solutions 1. (4 pts) Describe a benefit of using implicit declarations in Ruby. Reduce programming effort. 2. (12 pts) What is the output (if any) of the following Ruby programs? Write FAIL if code does not execute. a. (3 pts) puts “Win” if 1 < 0 # Output = The Future puts “The” if 0 < 1 if 0 then puts “Future” end b. (3 pts) a = [5,”foo”, 2.1] # Output = Found foo puts “Found #{x[1]}” c. (3 pts) a = { } # Output = nil a[“foo”] = 2
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/13/2012 for the course CMSC 330 taught by Professor Staff during the Fall '08 term at Maryland.

Ask a homework question - tutors are online