Docsity

EngE1114 Test 2 Spring 2007: Engineering Education Exam - Prof. Tamara Wright Knott, Exams of Engineering

Toggle sidebar
bg1
EngE1114 Test 2 Spring 2007 Page 1 of 7
Virginia Polytechnic Institute & State University
Engineering Education
EngE 1114 TEST 2 Spring 2007
(60 Minutes)
FORM A
NAME_____________________________________________________________________
(Print: Last Name, First Name)
LECTURER___________ WORKSHOP: CRN _____________LEADER_________________
I have neither given nor received unauthorized assistance on this test.
__________________________________________
(Signature)
______________________________________________________________________________
DO NOT OPEN THIS TEST BOOKLET UNTIL
INSTRUCTED TO DO SO.
Complete the following items and darken appropriate circles on your op-scan:
NAME Last, First
ID NUMBER Your VT number that starts 90…
FORM Test form
SEAT NO The last 3 digits of your CRN.
Incompletely or incorrectly filling out this information on the OPSCAN will result in a 5 point
deduction to your test grade.
This test is closed book and closed notes.
This test is 100% multiple-choice. Select the BEST response.
Circle your response on the test form and record your answers on the op-scan sheet. The op-scan form
will not be returned to you. Additional time at the end of the test will NOT be allowed to fill in your
op-scan form.
This test, in its entirety, counts towards your programming average for ENGE 1114. A 60%
average on all programming assignments is required to pass this course.
pf3
pf4
pf5
pf8

Partial preview of the text

Download EngE1114 Test 2 Spring 2007: Engineering Education Exam - Prof. Tamara Wright Knott and more Exams Engineering in PDF only on Docsity!

Virginia Polytechnic Institute & State University

Engineering Education

EngE 1114 TEST 2 Spring 2007

(60 Minutes)

FORM A

NAME_____________________________________________________________________

(Print: Last Name, First Name)

LECTURER___________ WORKSHOP: CRN _____________LEADER_________________

I have neither given nor received unauthorized assistance on this test.

__________________________________________

(Signature)


DO NOT OPEN THIS TEST BOOKLET UNTIL

INSTRUCTED TO DO SO.

Complete the following items and darken appropriate circles on your op-scan: NAME Last, First ID NUMBER Your VT number that starts 90… FORM Test form SEAT NO The last 3 digits of your CRN. Incompletely or incorrectly filling out this information on the OPSCAN will result in a 5 point deduction to your test grade.

This test is closed book and closed notes.

This test is 100% multiple-choice. Select the BEST response.

Circle your response on the test form and record your answers on the op-scan sheet. The op-scan form will not be returned to you. Additional time at the end of the test will NOT be allowed to fill in your op-scan form.

This test, in its entirety, counts towards your programming average for ENGE 1114. A 60% average on all programming assignments is required to pass this course.

Multiple Choice Questions

Questions 1-4 refer to the algorithm in the flowchart at right

  1. The algorithm is best classified as:
    1. Sequential
    2. Selection
    3. Repetition
    4. None or not enough information given.
  2. If the algorithm is coded as a MATLAB function file the output symbol would be coded as:
    1. output C, A
    2. fprintf( ' C = %f in, A = %f sq in ' , C , A)
    3. [ C, A ] = mycircle ( R ) ;
    4. function [ C , A ] = mycircle ( R );
  3. If the algorithm is coded as a MATLAB script file the output symbol would be coded as:
    1. output C, A
    2. fprintf( ' C = %f in, A = %f sq in ' , C , A)
    3. [ C, A ] = mycircle ( R ) ;
    4. function [ C , A ] = mycircle ( R );
  4. If the algorithm is coded as a MATLAB script file the input symbol would be coded as:
    1. input R
    2. R = input ( ' Enter the radius: ' );
    3. [ C, A ] = mycircle ( R ) ;
    4. function [ C, A ] = mycircle ( R );
  5. A major difference between the execution of script files and the execution of function files is:
    1. There is no difference.
    2. A function file can be executed from the command window while a script file cannot.
    3. Variable names in a function file are only available to the function while variable names in a script file are added to the workspace.
    4. A script file can call a user-defined function while a function file cannot call a user-defined function.
  6. When calling a user-defined function
    1. Functions access the workspace for the needed values.
    2. The variable names in the call statement must be the same as the variable names used in the function file.
    3. Values are received by the function based on the order of the arguments, independent of the variable names.
    4. The order of the arguments in the call is not important if the same variable names are used in the function file and the function call.

START

INPUT

R

C = 2 R

A = R^2

OUTPUT

C,A

STOP

For questions 10-13 consider the four flowchart segments below:

  1. When the second (lower) diamond in FLOWCHART A is reached:
    1. both of the conditions X<=100 and X>=0 need to be checked.
    2. the condition X>=0 is already known to be true and does not need to be checked
    3. the condition X<=100 is already known to be true and does not need to be checked
    4. both of the conditions X<=100 and X>=0 are known to be true and neither needs to be checked.
  2. If a MATLAB program were written for FLOWCHART B, how many else statements would be used?
    1. 3
    2. 2
    3. 1
    4. 0
  3. If a MATLAB program were written for FLOWCHART D, the diamond would be coded as:
    1. if 0<=X<=
    2. if -1<X<
    3. if 0<=X & X<=
    4. if 0>X | X>
  4. Which algorithm does NOT result in the same value of V being output as the others for all values of X?
    1. A
    2. B
    3. C
    4. D
    5. All result in the same output
    6. None result in the same output

-Flowchart B-

X > 100^ if

inputX T F

X < 0^ if T F

outputV

V = ‘Invalid”

V = ‘Invalid”

V = ‘Valid”

-Flowchart A- -Flowchart C-

X > 100^ if

inputX T F

X<=100 and X >= 0^ if^ T F

outputV

V = ‘Invalid”

V = ‘Valid”

V = ‘Invalid”

-Flowchart D-

if 0≤X and X≤

V = ‘INVALID’ V = ‘VALID’

input X

output V

T

F

  1. When N is an integer greater than one, the output statement in the code to the right
    1. outputs only one value
    2. will be repeated N times
    3. outputs N values in a row
    4. outputs N values in a column
  2. The code to the right
    1. multiplies X by J
    2. sums the values of J
    3. builds a vector
    4. asks the user to enter a value N times
  3. Which statements added in lines 2 and 5 in the code below result in the correct output of T, where T is the sum of the S values ( T = Σ Sk )
    1. Line 2: nothing; Line 5: T = S(K) + 1;
    2. Line 2: S = 0; Line 5: T = S + S;
    3. Line 2: T = 0; Line 5: T = S + S;
    4. Line 2: T=1; Line 5: T = T + 1;
    5. Line 2: T=0; Line 5: T = T + S(K);
    6. Line 2: S = 0; Line 5: T = S(C) + T;
    7. None of the above
  4. When the code to the right terminates, what value is stored in Q?
    1. 9
    2. 6
    3. 3
    4. 1
    5. 0
    6. None of the above

-Code for Q14 and Q15-

1- N = input('\nEnter N: '); 2- for J = 1:1:N 3- X(J) = J+J; 4- end 5- fprintf('\n %f', X(J))

1- C = 10;

3- for K = 1:1:C 4- S(K) = input('Enter S'); 5- 6- fprintf( ' %12.2f %12.2f ' , K, S(K)) 7- end 8- fprintf(' T = %12.2f\n ', T)

1- Q = 0;

2- for J = 1:1: 3- for K = J:1: 4- Q = Q + 1; 5- end 6- end

For problems 23-27 consider an algorithm that will create a table of surface area as a function of length for a cylinder that has a central hole cut through it along the length. The cross-sectional shape of the hole is a rectangle. Input to the algorithm is the cylinder diameter, d, and the cross-sectional dimensions, w and h, of the rectangular hole. The length of the object, L, must be allowed to vary from 1 to 5 inches in one-inch increments. Table columns must be the object length and surface area. Your algorithm must check input values and create the table only if the hole cross-sectional dimensions entered are each less than 50% of the entered cylinder diameter, and otherwise stop. You may not use vectors in your algorithm.

  1. Given the following terms (A, B, C, and D) the surface area of the object is:

A = ππππ d^2 /4 B = w+h C = ππππ d D = w · h

  1. (C + 2D) · L + 2A
  2. 2(A-D) + (C + 2B) · L
  3. 2C·L – 2(A + D )
  4. A·L + 2(C-D)
  5. An efficient algorithm requires:
  6. selection within a loop.
  7. a loop within a repetition structure.
  8. a loop within a selection structure.
  9. repetition within a loop.
  10. The calculation of the area of the ends of the object is best done
  11. before the loop because this area does not change within the loop.
  12. inside the loop because this area varies for each object.
  13. after the loop because this area is a constant.
  14. the area of the ends of the object is not needed.
  15. The check to see whether or not the table should be created
  16. can only be done with a single if statement using a logical operator
  17. can only be done with an elseif
  18. must be done with a nested if or an elseif
  19. must be done with a nested if or a logical operator
  20. can be done with a nested if, an elseif, or a single if statement using a logical operator
  21. Which of the following is true of the statement(s) needed to output the object length and surface area?
  22. The output statement may be placed either inside or after the loop.
  23. The output statement should be placed inside the loop.
  24. The output statement should be placed after the loop
  25. There must be one output statement inside the loop and another after the loop.

w h^ L

d

Test 2 Key

  • ENGE 1114 Spring - 1. FORM A - 2. - 3. - 4. - 5. - 6. - 7. - 8. - 9.