You are on page 1of 6

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.

Part A – Computer Hardware, Software and the Internet

1. Which one of the following is not a software layer:


a. Basic input output systems (BIOS)
b. Operating systems (OS)
c. Software applications
d. The Internet

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

5. Which one of the following is a primary storage device


a. Hard disk drive (HDD)
b. Optical (ZIP) disk
c. Random access memory (RAM)
d. Compact disk (CD ROM)

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/........../.................

7. Identify the correct statement from the following:


a. The central processing unit (CPU) is made out of a silicon chip
b. Gates are combined to form logical devices called transistors
c. Transistors are made out of vacuum tubes and relay switches
d. All of the above statements are correct

8. The World Wide Web (WWW)


a. Connects million of computers globally
b. Is a way of accessing information over the medium of the Internet
c. Carries various information resources and services.
d. a and c
Part B – Problem Solving with Matlab

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

11. Which one of the following is the valid assignment in Matlab


a. $first variable = 5
b. 1stvariable = 5
c. First_variable = 5
d. First variable = 5

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/........../.................

16. If A is a 3x1 matrix, then A(0) is


a. The first entry in the column vector
b. A times 0
c. The first entry in the row vector
d. There is no place to A(0)

17. If A(t) = exp(t), then A(2) is


a. The first entry in the column vector
b. The exponential function evaluated at 2
c. Depends both on the array and the function at 2
d. both b and c are correct

18. The Matlab command X = [1:2:10]′ generates


a. X=[2 4 6 8 10]
b. X=[2; 4; 6; 8; 10]
c. X=[1 3 5 7 9]
d. X=[1; 3; 5; 7; 9]

Answer Questions 19-21 using the following matrices

X = [1 2; 3 4] Y = [5 6; 7 8] Q = [4.3 5.5 6.8]

19. The answer of the Q=ceil(Q)


a. Q=[4 6 7]
b. Q=[5 6 7]
c. Q=[4 5 6]
d. Q is a matrix. ceil command cannot be used on a matrix

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

21. The value of A after the following assignment: A = prod(X) + sum(Y)


a. A=[3 8;12 14]
b. A=[15 22]
c. A=[3 8;15 22]′
d. A=[15 22]′

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];

22. What is the answer after executing E = B-[1]


a. E = [0 2 2 3; 2 6 8 8; 7 6 1 4];
b. E = [0 2 2 3; 1 5 7 7; 6 5 0 3];
c. The "-" operator cannot be used with two matrices
d. The "-" operator cannot be used with a matrix and a scalar

23. Find the value of F after the assignment, F = A(2:3,1:2)


a. F=[5 6 9 0]
b. Empty matrix: 2-by-0
c. F=[5 9 ;6 0]′
d. F=[5 6;9 0]′

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”);

Answer the Question 30-34 using the following functions

1
y  3sin( x)  1; z  cos(x) 
x5

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/........../.................

31. The command to draw both curves on the same plot


a. plot(x,y,z)
b. plot(x,y,x,z)
c. plot(x,‟y‟,x,‟z‟)
d. All of the above

32. Consider the following figure

Which of the following are the correct steps to plot y = 3sin(x) + 1


a. subplot(3,2,2); plot(x,y); title('y=3sin(x)+1'); grid on;
b. subplot(2,3,2); plot(x,y); title('y=3sin(x)+1'); grid on;
c. subplot(3,2,4); plot(x,y); title('y=3sin(x)+1'); grid on;
d. subplot(2,3,4); plot(x,y); title('y=3sin(x)+1'); grid on;

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

Part C – Designing Computer Programs

34. Identify the correct statement from the following:


a. Computers are very smart
b. Computers must be told exactly what to do
c. We care about computers because they are creative and intelligent
d. Computers are not that good for repeated computations

35. The following are the steps for creating software.


I. Specify the problem II. Maintain the design
II. Develop a design IV. Implement the design

Select the correct order in which they are followed:


a. III,IV,III,II
b. I,III,II,IV
c. I,III,IV,II
d. I,IV,III,II

36. Which of the following is not correct about algorithms


a. They are made up of a number of basic steps
b. They should have one or more entry points
c. They must have one or more exit points
d. They are specific and unambiguous
Page 5 of 6
E/........../.................

37. Which one of the following is not correct about pseudo-codes


a. They are independent of the programming language we will use to write the software
b. To display the value in variable x, we will use: output ‘x’
c. An input statement always consists of a variable name
d. A process statement is used to represent an atomic activity

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

Answer questions 39-40 using the following pseudo-code

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

- END OF THE EXAM -

Page 6 of 6

You might also like