Exam 2 Sample Questions - 1 Sample Exam 2 Questions Problem...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: 1 Sample Exam 2 Questions Problem #1 Based on the current balance in a money market account at a local Lafayette bank, two different bonus levels are applied to a base interest rate. The following MATLAB code applies after the variable current_balance has been assigned a value: i_rate = 0.7 if (current_balance >= 7500) & (current_balance < 25000) i_rate = i_rate + 0.65 elseif current_balance >= 25000 i_rate = i_rate + 1.3 end fprintf( ' Interest rate = %3.2f percent \n ' ,i_rate) a) Determine exactly what will be printed to the MATLAB command window for current_balance values of: i) 3,000 ii) 40,000 iii) 20,000 b) Construct a flowchart from which the above MATLAB code could have been developed. Remember that no MATLAB code should appear in the flowchart. Problem #2 The following MATLAB code was written in a script file: clear all n=8; if n>=10 disp('Range 3') elseif n>=5 disp('Range 2') elseif n>=0 disp('Range 1') end a . (4 points) When the MATLAB script is executed, Range 2 is displayed. Why doesnt Range 1 also display? b . (4 points) Since someone reading the program could find it confusing that Range 1 does not display, how should the program be modified to avoid confusion? 2 Problem #3 A phase diagram for Carbon and Platinum is shown below (Graphite is a particular phase of Carbon). After making a flowchart, a novice materials engineer knows enough to write the code below, but you need to finish it. All phase boundaries in the diagram are linear and the endpoints of the upper phase boundary line are shown. a. Line 1 defines the equation of the line for the boundary between the L and L + Graphite regions. Compute the slope and intercept for this line and write them on the answer sheet. b. Line 2 shows the condition to determine if the phase is Pt + Graphite. The engineer may have forgotten to include conditions in lines 4, 6 and 8. Assuming your equation in part a (above) is correct: Determine if conditions are needed (check the appropriate box on the answer sheet). If conditions are needed, write the correct condition on the answer sheet. 1. phase_line =____*massC + _____; % equation for phase boundary 2. if Temperature < 1700 % Solid mixture Phase 3. phase = 'Pt + Graphite'; 4. elseif ______________________ % Eutectic line 5. phase = 'Pt, Graphite, and Liquid'; 6. elseif ______________________ % Liquid Phase 7. phase = 'Liquid'; 8. else ______________________ % Liquid + graphite Phase 9. phase = 'Liquid + Graphite'; 10. end L L + Graphite Pt + Graphite Eutectic line 3 Problem #4 I am forming teams and workgroups for an engineering project based on rules that match team members schedule and staffing needs. I have four independent conditions I want to test, so each can be analyzed without knowledge of the others. The first letter of the persons name is used as the variable. In part a and c, circle which MATLAB logic phrase...
View Full Document

This note was uploaded on 02/20/2012 for the course ENGR 195 taught by Professor Staff during the Spring '08 term at Purdue University-West Lafayette.

Page1 / 9

Exam 2 Sample Questions - 1 Sample Exam 2 Questions Problem...

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

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