Professional Documents
Culture Documents
University of Peradeniya
University of Peradeniya
Faculty of Engineering
MID SEMESTER EXAMINATION, MARCH 2009
QE106 - Computing
Time: One Hour E/........./.................
Underline the correct answer (there will be only one) from the given multiple answers.
2. Identify the devices which can be used for both input and output
a. Keyboard, Mouse
b. Monitor, Printer
c. Modem, Network Cards
d. Modem, Printer
3. Which one of the following is the two‟s complement form of the negative number -34 in sixteen bits
memory word:
a. 0000 0000 0010 0010
b. 0000 0000 1101 1110
c. 1111 1111 1101 1110
d. 1111 1111 1110 0010
4. ASCII is the standard code used for information interchange and communication between data
processing systems. Here, ASCII stands for
a. Amsterdam Subversive Center for Information Interchange
b. American Standard Code for Information Interchange
c. Australian Standard Code for Information Interchange
d. Arizona Society for Computer Information, inc
6. Which one of the following unit is used to measure the speed of a central processing unit (CPU)?
a. Hertz
b. Kilobits
c. Megabytes
d. Gigabytes
E/........../.................
9. Select the wrong statement/s about Matlab from the following list
a. An interactive system for numerical computations
b. It‟s a compiled language
c. Quick for performing matrix operations
d. A general purpose programming language
10. Which one of the following is correct about the Matlab diary command
a. It is used to record the day to day activity of the Matlab user
b. It could be used to store all the commands and the outputs of the command window
c. It only stores the correct commands and outputs
d. All the above statements are incorrect
For Questions 12-15, find the correct answer when evaluating the expressions in Matlab
12. 2+3/5*9
a. 2.0667
b. 9.000
c. 0.111
d. 7.400
13. (5+8^2-8/4)
a. 65
b. 4144
c. 1381
d. 0
14. (5+3)~=8
a. 0
b. false
c. 1
d. Operator is not allowed
15. round(abs(-5)+sqrt(3))
a. 6.731
b. 7
c. 6
d. 8
Page 2 of 6
E/........../.................
20. The answer of the prod(Q) after performing the operation on Q as of Question 19.
a. 210
b. 120
c. 168
d. 248
Answer Questions 22-26 using the following matrices in the context of Matlab
A = [1 2 3 4; 5 6 7 8; 9 0 1 2]; B = [1 3 3 4; 2 6 8 8; 7 6 1 4];
C = [9 2 3 4 5 6 7 8 9]; D = [9 8 6 4 5 3 7 2 1];
Page 3 of 6
E/........../.................
24. What is the answer you get by executing the command C*D′
a. 252
b. 224
c. 248
d. Operation is not allowed
25. What is the command to be executed to get the answer G=[1 0.25 0.50 1 1 2 1 4 9]′
a. G=C/D
b. G=C./D
c. G=C′/.D′
d. a and b both are correct
26. Suppose after executing all the commands from 22 to 25, you are executing command M followed by
command N. If what you have after this in the command window are the following, identify
commands M and N.
Your variables are:
A BCDEFG
a. clc and whos
b. clear and who
c. clc and who
d. clear and whos
27. The graph of the exponential function e2t in Matlab can be generated by
a. t = 0:.1:2; plot(t,exp(2*.t))
b. t = 0:.1:2; plot(t,exp(2*t))
c. t = 0:.1:2; plot(t,exp(2t))
d. t = 0:.1:2; graph(t,exp(2*.t))
28. Select the output of the following Matlab command: roots([1 -7 12])
a. [1 NaN 3.4641]
b. [3 4]
c. [1 2.6458i 3.4641]
d. An error message as the roots function will not operator on a row vector
29. If the title of a graph is "Variation of velocity with time". The correct order of adding the title to the
graph
a. title(„Variation of velocity with time‟); plot(t, v);
b. title(“Variation of velocity with time”); plot(t, v);
c. plot(t, v); title(„Variation of velocity with time‟);
d. plot(t, v); title(“Variation of velocity with time”);
1
y 3sin( x) 1; z cos(x)
x5
30. Identify the correct steps to assign the above functions to y and z
a. y=3sin(x)+1; z=cos(x)+1/x+5;
b. y=3*sin(x)+1; z=cos(x)+1./x+5;
c. y=3*sin(x)+1; z=cos(x)+1/(x+5);
d. y=3*sin(x)+1; z=cos(x)+1./(x+5);
Page 4 of 6
E/........../.................
33. Suppose we need to save the above graph in directory C:\ in the jpeg image format. Choose the
correct command
a. print -djpg My_Plot
b. print -d C:\ My_Plot
c. print -djpg C:\My_Plot
d. print -djpg C:\ My_Plot
38. Which one of the following is the best answer about „top down‟ approach
a. It breaks down bigger problem into smaller sub problems
b. It is an approach used in designing computer programs
c. The atomic steps in the top down approach could be put together to form an algorithm
d. All the above statements are correct
input your_gpa
if(your_gpa < 3.7) then
output 'second class'
else
output 'first class'
39. Which one of the followings is incorrect about the above algorithm
a. It can be used to compute your pass category based on your GPA
b. If your GPA is 3.4, the answer your algorithm will give is "second class"
c. If your GPA is 4.0, the answer your algorithm will give is "second class"
d. This algorithm expects only one input
40. Suppose the input to the above algorithm is 3.7, the output you are expected to get
a. fail
b. third class
c. second class
d. first class
Page 6 of 6