Faculty of Arts and Science
School of Computing
CISC101 Sample Midterm Examination
Instructor: D.B. Skillicorn
Fall Term 2011
1. You have ﬁfty minutes. Attempt all questions.
2. You may bring in one 8.5x11 sheet of paper containing notes, and use it during this
3. Answer questions on the examination paper. Nothing else will be marked. Use the
amount of space under each question as a guide to the detail of your answer. You may
use scrap paper and the back of the examination paper pages for rough working.
4. If you do not understand a question, make reasonable assumptions, write them down
5. Make sure your name is on every page of the examination paper.
6. The total mark for this midterm is 50. The midterm counts for 10% or 20% of your
ﬁnal grade, depending on which would give you the better mark.
STUDENT NUMBER Student number: Page 2 of 4
1. (1 minutes) What is the meaning of semicolons in Matlab programs?
2. (2 minutes) Explain the meaning of precedence in arithmetic expressions.
3. (3 minutes) Explain what the image command does in Matlab.
4. (3 minutes) Explain what the disp command does in Matlab.
5. (2 minutes) What is meant by a target or class attribute in a dataset?
6. (2 minutes) What is prediction from a dataset?
7. (2 minutes) What is meant by an attribute in a dataset?
8. (3 minutes) Explain what the following Matlab code does.
9. (3 minutes) Explain how you would label the axes of the plot resulting from a plot3
command, and provide the ﬁgure with a title.
10. (4 minutes) Write logical or boolean expressions that evaluate as true for the following
▯ a is greater than 3
▯ a is negative
▯ a lies between -2 and -2 or between +1 and +2
▯ a is less than twice the value in b
11. (10 minutes) Write a loop that, given a vector x of length n, will replace all values
greater than 25 or smaller than -25 by zeroes.
12. (10 minutes) Write a loop that, given a vector x of length n, will count the number
of times that the value 3 appears in the vector.
13. (10 minutes) Suppose that a is a 100▯100 matrix. Write the single Matlab commands
that will select the following pieces of the matrix:
▯ the 5th column;
▯ the 17th row;
▯ the upper left hand corner submatrix of size 10 ▯ 10;
▯ the elements of the 12th column in odd numbered rows.
14. (5 minutes) Explain two diﬀerent ways of normalizing data in a dataset. Student number: Page 3 of 4
15. (10 minutes) Write Matlab code to compute the column means of a matrix named b
of size n rows and m columns, without using the built-in commands mean or sum.
16. (25 minutes) Write Matlab