Koofers

Past Exam for CMSC 330 - ORGNZTN PROGM LANG with Tseng at Maryland (UMD)

Exam Information

Material Type:Exam 1
Professor:Tseng
Class:CMSC 330 - ORGNZTN PROGM LANG
Subject:Computer Science
University:University of Maryland
Term:Spring 2008
Keywords:
  • Ruby Regular Expression
  • Transitions
  • Different Models
  • Provided That
  • Ruby Program
  • Organization
  • Regular Expression
  • The Message
  • You Have...
  • Programming
Login / Sign Up to View Document
Preview Page 1Preview Page 2

Sample Document Text

CMSC330 - SUMMER 2006 - MIDTERM 1 INSTRUCTOR: GUILHERME FONSECA . Write all answers in the answers book provided. . You can keep the exam. Only return the answers book. . You are allowed to consult one letter-size paper, handwritten on one side. Besides that, the exam is closed book, closed notes. . There are 8 question, totaling 110 points, in this exam. You have 1 hour and 20 minutes to finish it. (1) (20 points) What is the output of each Ruby program below? Ignore any possible warning message. (a) puts("ab" + if nil "cd" else "ef" end) (b) a = b = ["c", "a", "b"] a = a.sort puts b (c) a = [1, 2, 3] b = ["x", "y"] c = [a, b, [a, b]] puts c[-1][0] (d) h = Hash.new(0) h["a"] = h["b"] h["b"] = 7 h["c"] += 2 puts "#{h["a"]} #{h["b"]} #{h["c"]}" (2) (10 points) Write a Ruby program that reads several lines from the input, and prints only the lines that contain exclusively the following characters: uppercase and lowercase letters, digits, and underscore. For example, lines that cont...

Related Documents

Ruby Regular Expression Exam
Ruby Regular Expression Exam
Ruby Regular Expression Exam
Ruby Program Exam
Ruby Program Exam
Ruby Program Exam
Ruby Standard Library Exam
Ruby Standard Library Exam
Implicit Variable Declarations Exam
Implicit Variable Declarations Exam
Implicit Variable Declarations Exam
Binary Numbers Exam
Text Processing Exam
Text Processing Exam
Text Processing Exam
Small Syntax Errors Exam
155, "/var/app/current/tmp/"