prac1-fall09

prac1-fall09 - CMSC 330, Practice Problems 1 1. Programming...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CMSC 330, Practice Problems 1 1. Programming languages a. Explain how goals for programming languages have changed since the 1960’s. b. List 2 desirable attributes for a programming language where Ruby is better than C. Explain why. c. List 2 methods for executing a program. Which method is used by Ruby? 2. Ruby basics a. Write a Ruby method foo that takes an integer as a parameter. Call foo with 2 as its argument. Circle & label the formal and actual parameters in your code. b. Using different Ruby control statements, write 4 code fragments that iterate from i=1 to i=10. c. Explain the difference between explicit and implicit variable declarations. d. List two advantages of static types. e. Using Ruby, write a class Teacher that contains an integer field students and an integer field totalStudents that is shared across all objects of class Teacher. f. Give an example of shallow (reference) copy in Ruby. g.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

prac1-fall09 - CMSC 330, Practice Problems 1 1. Programming...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online