CS100 Midterm 2009 - Lahore University Of Management...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Lahore University Of Management Sciences School of Science and Engineering Roll # : Total Pages: 11 (including this page) Problem Solving using Comptuters Quarter : Winter Course Title : Academic Year : 2008–2009 Course Code : CS 102 Date : 16 Feb 2009 Instructor : Sohaib Khan & Arif Zaman Time Allowed : 90 mins. Exam : Midterm Exam Total Marks : 90 points The instructions below must be followed strictly. Failure to do so can result in serious grade loss. DO NOT OPEN THIS EXAM UNTIL TOLD TO DO SO. Read all questions very carefully before answering them. Keep your eyes on your own paper. You may not talk to anyone once the exam begins. leave the examination room and then return. Specific instructions : Open book/notes, help sheet: Closed book Calculator usage: No calculators Write in pen/pencil: Pencil or Pen Any other instruction(s): After each question, a rectangular answer box is provided for the solution. The solution MUST be written only in this answer box. I will ONLY read what is written there. That means that you can do your rough anywhere you like (other than the boxes). The questions are ordered from shorter/easier questions to longer/harder ones. 1 6 11 2 7 12 3 8 13 4 9 14 5 10 15 Total:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
1. (3 points) What is the value of b at the end of this program? b = 0; for a=1:5 b = [b a^2]; end Answer box The value of b at the end of this program is ________________________________________ 2. (3 points) What is the value of b(5) at the end of this program? b = ones(1,5); for a=2:5 while b(a) <= b(a-1) b(a) = 2*b(a); end b(a) = b(a) + 3; end Answer box The value of b(5) at the end of this program is ________________________________________ 3. (3 points) List the output displayed by the following code: a = 10; b = -5; while b < a b = b + 1; a = a - 2; disp(num2str(a + b)); end ; Answer Box
Background image of page 2
4. (3 points) The code below draws four circles. figure; axis equal; axis([0 100 0 100]); x = [10 90 90 10]; y = [10 10 90 90]; for p=1:4 rectangle('position', [[x(p), y(p)]-4 8 8], 'curvature', [1 1]); end Cross out one of the two words in each of the four boxes below: The first circle is drawn near the upper / lower left / right corner. The second circle is drawn near the upper / lower left / right corner.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.
  • Spring '11
  • SohaibKhan,ArifZaman,MurtazaTaj
  • Harshad number, Lahore University of Management Sciences, School of Science and Engineering, elseif rand, Arif Zaman

{[ snackBarMessage ]}

Page1 / 11

CS100 Midterm 2009 - Lahore University Of Management...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online