Docsity

Problem Set: Integer Division Algorithm, Cyclomatic Complexity, and Propulsion Engineering, Exercises of Engineering

Toggle sidebar
bg1
C13-14
The problems in this problem set cover lectures C13 and C14
1.
a. Define a robust algorithm to carry out integer division using repeated subtraction.
Your algorithm accepts two integers and returns the quotient and the remainder.
Hint: What are the preconditions and postconditions of your algorithm?
b. Implement your algorithm as an Ada95 program, using exception handling to
provide robustness.
Turn in a hard copy of your algorithm and code listing, and an electronic copy of your
code.
2.
a. What is the cyclomatic complexity of the code fragment shown below?
loop
exit when Flag := True;
if A < 100 and B > 200 then
if A > 50 then
Sum := Sum +2;
else
Sum := Sum +1;
end if;
else
if B < 300 then
Sum:= Sum -1;
else
Sum := Sum -2;
end if;
end if;
end loop;
Hint: Draw the control flow graph
b. What is the minimum number of test cases needed to test the fragment of code
shown below? Justify your answer.
if A < 100 and B > 200 then
if A > 50 then
Sum := Sum +2;
else
Sum := Sum +1;
end if;
else
if B < 300 then
Sum:= Sum -1;
else
Sum := Sum -2;
end if;
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Problem Set: Integer Division Algorithm, Cyclomatic Complexity, and Propulsion Engineering and more Exercises Engineering in PDF only on Docsity!

C13-

The problems in this problem set cover lectures C13 and C

a. Define a robust algorithm to carry out integer division using repeated subtraction. Your algorithm accepts two integers and returns the quotient and the remainder. Hint : What are the preconditions and postconditions of your algorithm?

b. Implement your algorithm as an Ada95 program, using exception handling to provide robustness.

Turn in a hard copy of your algorithm and code listing, and an electronic copy of your code.

a. What is the cyclomatic complexity of the code fragment shown below? loop exit when Flag := True;

if A < 100 and B > 200 then if A > 50 then Sum := Sum +2; else Sum := Sum +1; end if ; else if B < 300 then Sum:= Sum -1; else Sum := Sum -2; end if ; end if ; end loop ; Hint : Draw the control flow graph

b. What is the minimum number of test cases needed to test the fragment of code shown below? Justify your answer.

if A < 100 and B > 200 then if A > 50 then Sum := Sum +2; else Sum := Sum +1; end if ; else if B < 300 then Sum:= Sum -1; else Sum := Sum -2; end if ;

end if ;

CURRENT

FUTURE

0.25 0.5 0.75 1 1.25 1.5^ 1.75^2

C

DO

CURRENT

FUTURE

0.25 0.5 0.75 1 1.25 1.5^ 1.75^2

K

Flight Mach number

Unified Engineering Spring Term 2004

Problem P6. (Propulsion) (L.O. E)

Evaluate the performance of a single stage sounding rocket to be

used for atmospheric research.

You are given the following design parameters:

Combustion chamber temperature = 4000 K

Combustion chamber pressure = 5 MPa

Nozzle throat area = 0.0006 m

Nozzle exit area = 0.01 m

Propellant mass = 35 kg

Total mass at takeoff = 50 kg

Gas constant = 300 J/kg-K

Ratio of specific heats = 1.

a) What are the Isp and take-off thrust for this rocket?

b) Assuming the rocket is launched vertically, and neglecting drag,

how high will it go?

Unified Engineering Spring Term 2004

Problem P7. (Propulsion) (L.O. F)

For this problem, consider the design of a turbojet engine for a

supersonic aircraft. Assume the engine uses conventional

hydrocarbon fuels (h = 42.8 MJ/kg and that γ = 1.4 and cp = 1000

J/(kg-K).

There are two important material temperature limits for gas turbine

engines. The first is the temperature at the inlet to the turbine (T T4 )

which may range as high as 2000K. The second is the temperature

at the exit of the compressor (TT3) which is typically limited to

less than 1000K. [The turbine can be run in conditions well above

the melting temperature of the metal because air from the exit of

the compressor is used to "cool" the turbine. This air is pumped

through the turbine blades and forced out small holes in the surface

forming a protective film (see picture below from Rolls-Royce,

The Jet Engine). Due to their very small size, it is much harder to

cool the compressor blades, so no active cooling is currently used.]

Reproduced with the kind permission of Rolls-Royce plc. Copyright Rolls-Royce plc 1986. Used with permission.

a) For a turbojet engine with a compressor pressure ratio of 25,

and a turbine inlet temperature of 1800K, under what flight

conditions (Mach number) would the compressor inlet temperature

limit be exceeded? Consider performance at sea-level

(Tatm=300K) and at 10km (Tatm = 216K)

b) At a constant flight Mach number of 1.2, how much do the

thermal and propulsive efficiency change between altitudes of sea-

level and 10km? Explain this behavior.

c) If you were forced to reduce the turbine inlet temperature to

1400K because the turbine durability group was having difficulty

designing the blades to withstand temperatures of 1800K, how

would it impact the performance of the vehicle (consider M=1.

and 10km only)?

  1. Explain why the noncausal filter is preferred in signal processing applications where it can be applied.