Department of Computer Science
Computer Science 101: Mid Term Exam I (60 minutes)
![]()
Name: NetID:
Lab
Section: Date:
![]()
No questions
will be answered during this examination.
If you do not understand a question, read it again. If you still do not understand it, make reasonable assumptions and write them
down. (Points will be deducted if unreasonable assumptions are made.)
DO NOT CHEAT: Cheating includes not only copying from another person but
also allowing someone to copy from you.
Anyone who copies or allows someone to copy will receive a score of
zero. So be defensive and protect your
work.
This examination contains 8 pages including this page. Check that your copy is complete, and ask for a replacement if it is not. Do all your work on these pages. For your own protection, in case pages come apart, write your NetID at the TOP of each page before beginning work.
The number of points for a question is roughly proportional to the amount of time you may need for it. Don’t spend too much time on any one question.
Do not forget to sign the attendance list and to write your signature on the line below:
_______________________________________________________________________
(If your exam is misplaced and you did not sign the attendance list then you
will receive a zero score for the exam.)
You may not use any electronic devices, book, notes or other references during this examination.
Section |
Possible Score |
Score |
Grader |
|
1 |
6 |
|
|
|
2 |
6 |
|
|
|
3 |
6 |
|
|
|
4 |
4 |
|
|
|
5 |
6 |
|
|
|
6 |
6 |
|
|
|
7 |
4 |
|
|
|
8 |
9 |
|
|
|
9 |
4 |
|
|
|
10 |
4 |
|
|
|
11 |
8 |
|
|
|
12 |
9 |
|
|
|
13 |
10 |
|
|
|
14 |
4 |
|
|
|
15 |
8 |
|
|
|
16 |
9 |
|
|
|
17 |
9 |
|
|
|
18 |
13 |
|
|
|
Total |
125 |
|
|
1. Fill in the blanks
below using Matlab expressions to flip the values of y = [ 1 3 5 7 11].
>> flipy =
y( _____________ : _______________ : _______________ )
flipy =
11 7 5 3 1
2.
Write the output the
following Matlab commands produce.
>> x =
linspace(100,200,300);
>> x(1)
ans =
____________________________________________
>> length(x)
ans =
_____________________________________________
>> x(end)