CS 103 Test 3 Fall 2009 Problem 1. (15 points) Enter answers to this problem into the function p1 (in the provided M-file p1.m ). A. In computer programming, the word “robust” describes 1. a program that does something reasonable with all inputs 2. a computer language that provides all of the standard control constructs 3. a function that contains no infinite loops 4. a statement that never takes a false branch B. When the choice of the next statement to be executed depends on the value of x , which of the following is true? 1. A switch statement is better than an if-elseif statement when x can have only a small set of integer values. 2. A switch statement is better than an if-elseif statement when the choice depends on whether x is greater than pi . 3. An if-elseif statement is better than a switch statement when there is one branch for each of 5 values of x . 4. None of the above C. An example of short circuiting is 1. not evaluating Y in the statement if , when X is false. 2.
This is the end of the preview. Sign up
access the rest of the document.
This note was uploaded on 12/12/2009 for the course CS CS 103 taught by Professor Fitzpatrick during the Spring '09 term at Vanderbilt.