Professional Documents
Culture Documents
TEST 1
SEM 02-2014/15
TEST 1
SEMESTER 2, SESSION 2014/2015
COURSE CODE
SKAA3413
COURSE
COMPUTER PROGRAMMING
PROGRAMME
SKAW
DURATION
1 HOUR 30 MINUTES
DATE
MAY 2015
INSTRUCTION TO CANDIDATES:
1. ANSWER ALL QUESTIONS.
NAME
STUDENT ID
SECTION
LECTURER
WARNING!
Students caught copying/cheating during the examination will be liable for disciplinary
actions and the faculty may recommend the student to be expelled from the study.
This test question consists of (7) printed pages only.
SKAA3413
Q1
a)
TEST 1
SEM 02-2014/15
i)
is
22
7 .
1 3
r
3
k=
r 2 +4 bh
ii)
k=
iii
)
k=b+
2 rh
3 b 2 r
2r 3
(10 marks)
b)
b = [3 4 1]
c = [2 5 0]
d = [1 2 ; 3 4; 0 6]
e = b * c
ii)
e = a * b * c
iii
)
e = b + c ^ 2
iv
)
e = a * c * d
(5 marks)
c)
i)
10 > 30 / 2
ii)
(4<5)= =(4~=5)
iii
)
Return Value
SKAA3413
TEST 1
iv)
SEM 02-2014/15
Q2
a)
b = [3 4 1]
c = [2 5 0]
d = [1 2 ; 3 4;
q = c2ba
q =
ii)
2
a
r =
s =a-d2
s =
iii
)
r=
(6 marks)
b) The value of x, y and z in the following simultaneous equations can be solved using
linear algebra c=k-1d or c=inv(k)d. Where c is a column vector containing the
values of x, y and z.
x+2y-z -2=0
3y 2z +7 =0
3x-y+2z -5=0
2
f = 1
5
6
3
3
i) f = .........................................................
8
g = ..........................................................
2 ii)
SKAA3413
TEST 1
8
5
0
4
2
2
5
9
SEM 02-2014/15
iii)
h = ..........................................................
iv)
h ..........................................................
h .........................................................
(8 marks)
Q3
a)
MATLAB script
Variable
name
Variable values
(i)
y=
if y < 1582
true/false
1200
(ii)
(iii)
199
0
2000
else
c1=rem(y,400);
c1 =
c2=rem(y,100);
c2 =
c3=rem(y,4);
c3 =
true/false
r='CFRMD';
r=
else
r='NTSURE';
r=
end
fprintf(' y is %s\n',r)
end
*Answer printed in Command Window
(i)
(ii)
(iii)
(20 marks)
SKAA3413
Q4
TEST 1
SEM 02-2014/15
Figure Q4(a) shows a simply supported beam; over-hanged over the left support. It is
loaded by a uniformly distributed load the whole length of the beam.
Write a MATLAB program (script) for the problem stated below.
a) Determine the value of the maximum bending moment and its location.
(30 marks)
b) Plot the bending moment diagram (BMD). Sample for the BMD plotted in
MATLAB Figure Window is shown in Figure Q4(b).
(10 marks)
The general equation to solve the problem is given in Table Q4(a) and sample
result as shown in Table Q4(b).
Figure Q4(a)
Figure Q4(b)
Table Q4(a)
Reactions:
rb =
q ( a+l ) a+l
(
a)
l
2
ra = q(a+l) - rb
Table Q4(b)
Left overhang length 2.0
Support distance 5.0
Load intensity 8.0
Left support reaction, Ra = 39.20
Right support reaction, Rb = 16.80
Maximum BM is 17.64 at x= 4.9
SKAA3413
TEST 1
SEM 02-2014/15
SKAA3413
TEST 1
Write the MATLAB program for the above problem in the table below.
SEM 02-2014/15
SKAA3413
TEST 1
SEM 02-2014/15
SKAA3413
TEST 1
SEM 02-2014/15