% CS99 Fall 2002 % Prelim 1 % Problem 1 %------------------------------------------------------------------------------ % 1a [1 point] Your lab instructor's name is GUN SRIJUNTONGSIRI. % 1b [1 point] Your lecture instructor's name is DAVID I. SCHWARTZ. % 1c [1 point] Programming is AUTOMATING PROBLEM SOLVING. % 1d [2 points] MATLAB stands for MATRIX LABORATORY. % 1e [1 point] True or False: Everything in MATLAB is an array: TRUE. % 1f [1 point] True or False: % The assignment statements a=10 and A=10 are identical: TRUE. % 1g [2 points] Demonstrate how to remove an assigned value from % the variable x from the command window. clear x % or just CLEAR % 1h [3 points] Show one expression statement that will evaluate: 17 * sqrt( 2 + 3 / ( 4 - 1 ) ) % 1i [2 points] What is the output from the following statements? x = 1; y = x + 1, z = x % output: y = 2 % z = 1 % 1j [2 points] What is the output from the following statement? ~(1 ~= ~1) | 1 % output: 1 % 1h [4 points] Write a MATLAB expression that generates a random % integer between -2 and 1, inclusive. % formula: floor(rand*(max-min+1)) + floor(min) % do some arithmetic: floor(rand*(1-(-2)+1)) + floor(-2) floor(rand*4) - 2