CS 1401, Quiz #3

Date: Tuesday, February 7, 2006
Class section (9 am or 10:30 am): ______________________
Name: ______________________________________________________________________

1. Write down three lines of code which do the following:

(a) declare a variable of type String whose name is year:

String year;

(b) assign to the variable year (already defined elsewhere) the new value 2006:

year = "2006";

(c) declare a constant (give it any name you want) with the value "Computer Science":

final String DEPARTMENT = "Computer Science";

2. Write down a method which takes a string which contains the first name (for example, "John") and returns a longer string which says "My name is (the name of the input)." For example, if the input is "John", then your method should return the string "My name is John." Your methods should not read or write anything, just take a string and return a longer string.

public String quiz3(String firstName){
  return "My name is " + firstName + ".";

3. Mark which topics are covered in the chapter that you were supposed to read by today.

a) arithmetic operations - covered

b) arithmetic expressions - covered

c) division - covered

d) arrays

e) writing into a file