CS100_SampleQuestion_PastQuizzes.pdf

# Total score possible 10 mean 415 median 4 mode 25 5

• 24

This preview shows page 11 - 14 out of 24 pages.

Total Score Possible 10 Mean 4.15 Median 4 Mode 2.5, 5 Range 0 - 9 Quartile 1 2.5 Quartile 3 5.5 Standard Deviation 2.15 Part 1, Question 1 (Multiple Choice (single correct)) What will be the value of a after the following code has been executed? a = 1; n = 1; while a < 100 a = a*n; n = n + 1; end 43 Responses 24 19 Responses 100 48 Responses 120 6 Responses 72 Responses 116 % Students All Correct 41 Part 1, Question 2 (Multiple Choice (single correct)) What does rand(3) generate in matlab? 2 Responses 3 x1 matrix of random numbers between 0 and 3 45 Responses 3 x 1 matrix of random numbers between 0 and 1 28 Responses Tests & Quizzes My Workspace 1201 Computational Problem Sol (CS 100 Sec:1) 1201 Computer Graphics (CS 452 Sec:1) PHD_QE Fall 2012 1102 Multiview Geometry in Computer (CMPE

Subscribe to view the full document.

10/16/12 Learning Management System : 1201 Computational Problem Sol (CS 100 Sec:1) : Tests & Quizzes 2/4 lms.lums.edu.pk/portal/site/…/20461864-bca6-4164-bf42-2e76b3f407e4 M = 1 1 1 2 2 2 3 3 3 M = 1 2 3 4 5 6 7 8 9 M = 1 4 7 2 5 8 3 6 9 M = 9 6 3 8 5 2 7 4 1 28 Responses 3 x 3 matrix of random numbers between 0 and 1 43 Responses 1x3 matrix of random numbers between 0 and 1 Responses 118 % Students All Correct 23 Part 1, Question 3 (Multiple Choice (single correct)) Which matrix will result from evaluating the nested for loop below? counter = 1; for j = [1:3] for i = [1:3] M(i,j) = counter; counter = counter + 1; end end 17 Responses 39 Responses 55 Responses 3 Responses Responses 114 % Students All Correct 48 Part 1, Question 4 (Fill in the Blank) Consider the following code fragment: for p = 1 : 10 for q = 1 : 3 disp(`I like to move it move it'); end disp(`You like to...MOVE IT'); end How many times will the phrase 'You like to...MOVE IT' will be printed on the screen ? ____ 89 Responses
10/16/12 Learning Management System : 1201 Computational Problem Sol (CS 100 Sec:1) : Tests & Quizzes 3/4 lms.lums.edu.pk/portal/site/…/20461864-bca6-4164-bf42-2e76b3f407e4 89 Responses 10 Responses 117 % Students All Correct 76 Part 1, Question 5 (Multiple Choice (single correct)) Given below is a for loop that adds up even numbers from 1to 100 and displays the sum. If you think there is/are errors in the code provided, identify the line number/numbers where that error may exist. 1. for i=1:100 2. if (mod(2,i) == 0) 3. sum_evens = sum_evens + i; 4. end 5. end 6. disp(sum_evens); 17 Responses No error 31 Responses 2 only 28 Responses 3 only 41 Responses 2 and 3 both Responses 117 % Students All Correct 35 Part 1, Question 6 (Multiple Choice (single correct)) What will be the value of x(5) at the end? x(1) = 0; for j = 1:5 x(j+1) = x(j) + j*10; end 16 Responses 150 33 Responses error : index out of bounds 55 Responses 100 5 Responses 0 8 Responses 50 0 Responses N/A 0 Responses N/A 0 Responses N/A 0 Responses N/A Responses 117 % Students All Correct 13 Part 1, Question 7 (Fill in the Blank) For the code given below x=1; for n=1:20 if rand< 10 x = x - 1 else if rand<0.5 x = x + 1; end end

Subscribe to view the full document.

10/16/12 Learning Management System : 1201 Computational Problem Sol (CS 100 Sec:1) : Tests & Quizzes 4/4 lms.lums.edu.pk/portal/site/…/20461864-bca6-4164-bf42-2e76b3f407e4 What will be the value of x at the end of this for loop? ____ 33 Responses -19 Responses 99 % Students All Correct 33 Part 1, Question 8 (Multiple Choice (single correct))
You've reached the end of this preview.
• Spring '13
• SaraScott
• Learning management system, Montreal Metro, Management Sciences, Sakai Project, Sakai Foundation, Lear ning Management

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern