Coen 1
Fall 2000
Homework 4 Due: Monday, November 27
- Consider the following array declaration in Pascal. Write a Pascal assignment statement to set the first element of the array to 15. Write a Pascal assignment statement to set a variable Foo to the value of the seventh element of the array.
Question1: array (-5..11) of integer;
- Consider the following record declaration in Pascal. Write a Pascal assignment statement to set Calories_Consumed to 101.3.
Training_Run: record
Distance: real;
Time: real;
Effect: record
Calories_Consumed: real;
Felt_Good: boolean;
End;
Month: integer;
Day: integer;
Year: integer;
End;
- How many times does the following Pascal loop execute (how many values for Quant are printed out by the writeln statement)? The writeln statement is just a mechanism to print values out on the screen of the computer.
Quant := 1;
Ctr := -5;
while Ctr < 10 do
begin
if (Ctr < 0)
then Quant := Quant * 10;
writeln (Quant);
Ctr := Ctr + 2
end;
- How many times does the following Pascal loop execute?
Sum := 0:
for I := 6 to 20 by 3 do
Sum := Sum + I;
writeln (Sum);
- Why is a compiler referred to as a "translator?"
- How can the evolutionary software development model sometimes produce software systems that satisfy customer needs at less cost and in less time than other methods?