CISC 130 - Problem Solving in the Natural Sciences - Exam 1 Closed Book - Closed Notes - Calculators Permitted 65 Minutes - 100 Points - ASCII Code Table NAME___________________________________________________________NAME DIRECTIONS: Answer all questions on this exam in the space provided. Show all work necessary in arriving at any result. 1. (5 pts.) Assume an 8-bit computer. Given the bit pattern 01010011, convert it to (interpret it as) a decimal integer. 2. (5 pts.) Assume an 8-bit computer. Given the bit pattern 01010011, convert it to (interpret it as) an ASCII character. 3. (4 pts.) Estimate 2 to the 35th power. CISC 130 2 Exam 1, Spring, 2010 4. (3 pts.) How many different values can be stored in 9 bits? 5. (3 pts.) What is the largest unsigned integer that can be validly stored in 9 bits? 6. (10 pts.) List a sequence of at least 5 general steps that will assist in problem solving CISC 130 3 Exam 1, Spring, 2010 7. (9 pts.) a. What is an algorithm? b. What is a heuristic? c. What's the difference? 8. (4 pts.) After execution of the following MATLAB statements, what is the value of x? x = 4; y = x; x = 5; y = 6; CISC 130 4 Exam 1, Spring, 2010 9. (6 pts.) Write MATLAB code that will compute the value of the smaller of two numbers. Assume the numbers are already stored in the variables x and y. 10. (7 pts.) (Kaplan, page 32, Exercise 2.2) Write in MATLAB (3-(5+2*8))/4 in functional style using plus, minus, times, and rdivide. 11. (7 pts.) Write a MATLAB statement to generate a vector named ix containing the odd numbers from 1 to 21. (That would be the vector 1 3 5 7 9 11 13 15 17 19 21, and ix = [1 3 5 7 9 11 13 15 17 19 21] is not an acceptable answer.) 12. (7 pts.) Using the vector ix from the previous problem, write a MATLAB statement to obtain the 1st, 3rd, 5th, 7th, 9th, … , 21st elements of a vector named mydata. (Using any constants, like 1, 3, 5, etc. in your answer is not acceptable.) CISC 130 5 Exam 1, Spring, 2010 13. (7 pts.) (Kaplan, page 33, Exercise 2.3) Write in MATLAB a statement to calculate a2 b2 and store the result in c. 14. (7 pts.) Write MATLAB code that will compute the total of all the elements in a numeric vector (array). Assume numbers are already stored in the vector data. 15. (8 pts.) Write MATLAB code that will generate a numeric vector containing the numeric values 0 to 50, inclusive. Then generate a second vector containing the squares of the numbers 0 to 50, inclusive. Finally, generate a third vector containing the square roots of the numbers 0 to 50, inclusive. (An answer involving more than 10 statements is not acceptable.) 16. (Kaplan, page 61, Exercise 3.3) (6 pts.) Make a MATLAB plot of the function e x sin 3 x over the domain from 1 to 4. Try to use the largest step size that gives visually reasonable results. (3 pts.) Explain what "visually reasonable" might mean. CISC 130 6 Exam 1, Spring, 2010 ASCII (American Standard Code for Information Interchange) Low order bits (4321) 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 000 001 NUL SOH STX ETX EOT ENQ ACK BEL BS HT LF VT FF CR SO SI DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US NUL SOH STX ETX EOT ENQ ACK BEL BS HT LF VT FF CR SO SI SP NULl Start Of Heading Start of TeXt End of TeXt End Of Transmission ENQuiry ACKnowledge BELl or alarm BackSpace (Horizontal) Tab Line Feed Vertical Tab Form Feed Carriage Return Shift Out Shift In SPace Control-@ Control-A Control-B Control-C Control-D Control-E Control-F Control-G Control-H Control-I Control-J Control-K Control-L Control-M Control-N Control-O High order bits (765) 010 011 100 101 SP ! " # $ % & ´ ( ) * + , . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US DEL @ A B C D E F G H I J K L M N O Control-P Control-Q Control-R Control-S Control-T Control-U Control-V Control-W Control-X Control-Y Control-Z Control-[ Control-\ Control-] Control-^ Control-_ P Q R S T U V W X Y Z [ \ ] ^ or _ or 110 111 ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~ DEL Data Link Escape Device Control 1 Device Control 2 Device Control 3 Device Control 4 Negative AcKnowledge SYNchronous idle End of Transmit Block CANcel End of Medium SUBstitute ESCape File Separator Group Separator Record Separator Unit Separator DELete