This preview shows pages 1–6. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS101 Fall 2011 Midterm I (60 minutes) Thursday, September 29th, 2011 READ and complete the following: • Bubble your Scantron only with a No. 2 pencil. • On your Scantron (shown in the figure below), bubble : 1. Your Name 2. Your NetID 3. Form letter " A " 4. Bubble the corresponding 3digit code (shown below) for your lab section on your Scantron. Time Monday Tuesday Wednesday Thursday 9:0010:50 101 104 107 109 11:0012:50 102 110 1:002:50 105 111 3:004:50 103 106 108 112 • No electronic devices, books, notes, or cheat sheets are allowed while taking this exam. • Please fill in the most correct answer on the provided Scantron sheet. • We will not answer any questions during the exam. • Each question has only ONE correct answer. • You must stop writing when time is called by the proctors. • Hand in both these exam pages and the Scantron. • DO NOT turn this page UNTIL the proctor instructs you to. 1. The following is typed into the MATLAB command prompt. >> x = 2 : 3 : 7 What value for x will MATLAB display? (a) 2 3 7 (b) 2 5 7 (c) 2 7 (d) 2 5 2. Given the following MATLAB command window entries, what will MATLAB display? >> x = 2 ; >> y = 4 ; >> z = ( 2 * x + 4y ) . / 5 (a) 20 (b) 5 (c) Error (d) 4 3. Given that the matrices A and B (shown below) have been entered at the MATLAB command prompt, which MATLAB expression will produce an error if entered at the MATLAB com mand prompt? >> A = [ 1 2 ; 3 4 ] ; >> B = [ 5 6 ; 7 8 ] ; (a) A * B (b) A + B (c) A ( B ) (d) B . / A 4. Which of the following commands can we use to display the current workspace variables in MATLAB? (a) what (b) who (c) why (d) syms 5. The following commands are typed in the MATLAB command window: >> y =  6 ; >> c = 3 ; >> x = change _ x ( y ) The function change _ x is given below. What is the output after executing the commands shown above? ( HINT : think local variables) function x = change _ x ( y ) x = c + y ; (a) 6 (b) 3 (c) (d) Error 6. The MATLAB function named fzero finds one root for a function y = f ( x ) . Which of the commands shown below, when entered into the MATLAB command window, will find the root of the function f ( x ) = sin ( x ) near x = 6? (a) fzero ( sin ( x ) , 6 ) (b) fzero ( sin , x = 6 ) (c) fzero ( @ sin ( x ) , 6 ) (d) fzero ( sin , x == 6 ) 7. 3D plotting in MATLAB can be achieved via a four step process: • Define and partition intervals for x and y ....
View
Full
Document
This note was uploaded on 01/19/2012 for the course CS 101 taught by Professor Gambill during the Spring '08 term at University of Illinois, Urbana Champaign.
 Spring '08
 Gambill

Click to edit the document details