Sample Chapter

advertisement
TABLE OF CONTENTS
LO1: Understand core mathematical skills for software engineers ................................................................... 2
A1. Solve the following linear and quadratic equations: .................................................................................... 2
A2. Solve the following sets of simultaneous equations by (a) algebraic method (b) graphical
method .................................................................................................................................................................................... 3
A3) Find the volume of the following shapes to three significant figures by showing your work
step by step ........................................................................................................................................................................... 5
A4) Using Pythagoras’ theorem, proof that triangle ∆ABC (9:12:15) is a right-angled triangle ....... 6
A5) Two robots, Alice and Bob are pulling a box as shown on the figure:.................................................. 7
LO2: Understand the application of algebraic concepts .......................................................................................... 9
B1) A certain British company has three departments. Following sets are showing departments,
surnames and annual salaries of employees of this company: ........................................................................ 9
B2) A small ICT firm, has three branches in .......................................................................................................... 11
B3. Create a magic square by identifying values of p, q, r, s, t, u, x, y, z in matrix A-............................. 12
B4. Show that if .................................................................................................................................................................. 15
LO3: Be able to apply the fundamentals of formal methods ............................................................................... 16
C1. Suppose that two sets are A and B, defined by ............................................................................................. 16
C2. Suppose we have a universal set ........................................................................................................................ 18
C3. For all of the following sets defined in set−theoretic notation, list out all of the elements: ...... 19
C4. For the circuit shown below, construct a truth table for each intermediate function. Hence,
find the output function X. ............................................................................................................................................ 20
C5. Suppose that a salesman has 4 differently-located customers. ............................................................. 21
LO4: Be able to apply statistical techniques to analyse data ............................................................................... 22
D1. A research in 157 households found that the number of children per household is ................... 22
D2. A company has ten sales territories with approximately the same number of sales people
working in each territory. Last month the sales orders achieved were as follows: ............................. 23
D3. Identify a topic in one of the following areas and conduct a research on its application in
software development. ................................................................................................................................................... 26
Boolean Algebra ..................................................................................................................................................................... 26
Application of Boolean Algebra in Software Development .................................................................................. 27
Computer Systems consists of GATES ...................................................................................................................... 27
Analysis of Boolean Algebra.............................................................................................................................................. 28
1|Page
LO1: Understand core mathematical skills for software engineers
A1. Solve the following linear and quadratic equations:
(i)
2(3 – 5x) = 15 firstly open the
(ii)
x2 + x -20 = 0
bracket
x2 + 5x -4x -20 = 0
(2 * 3) – (5x * 2)=15
x(x + 5) – 4(x + 5) =0
6-10x=15
(x – 4) (x + 5) =0 compare of
6-15=10x
variable equal zero
9=10x
Either x – 4 = 0
9/10=x
or x + 5 =0
X=-0.9
hence x can be
x = 4 , -5
2|Page
A2. Solve the following sets
of simultaneous equations
by (a) algebraic method (b)
graphical method
(i)
y=2x; y=-2x+1; y=2x and
Y = -2x+1
Y=2x
y=-2x+1 solve these
Equation find value of x
2x = -2x+1
4x=1
X=0.25
and y=2x put value of x
and find value of x
Hence Y= 2 * 0.25
Y=0.50
Y = -5x +1
(ii)
Y = 5x+1
y = 5x + 1; y =−5x + 1
y = 5x + 1 and y =−5x + 1 solve these equations find value of x
3|Page
-5x+1=5x+1
1-1=5x+5x
10x=0 compare value of x
10 !=0 them value of x=0
X=0 and y=5x+1 put value of x find
value of y
2y = x + 5
−6y = 3x − 4
Y=5 * 0+1
Y=1 and X=0
(iii)
−6y = 3x − 4; 2y = x + 5
// solve these two equation and find the value of x and y
3(2y-5)+6y=4 or 6y-15+6y=4
19
12y=19 or Y=12= 1.58 // put the value of y in second equation
19
And x=2y-5 or x =2 ∗ 12 – 5= -1.83
Hence vale of coordinate x=-1.83, y=1.58
4|Page
A3) Find the volume of the following shapes to three significant figures by showing
your work step by step
(i)
A cube with a length of one side 27 meters
Volume of a cube = a3 (Where a is side of the cube)
a= 27
hence valume of cube
a = (27)3 = 27 * 27 * 27 = 19683 m3
Hence volume of a cube is 19683 m3.
(ii)
A sphere with radius 20 inches hence r=20(radius of sphere)
5|Page
Where = π =
4
V= 3 ∗
22
7
22
7
∗ 20 ∗ 20 ∗ 20 // calculate all these value and find the volume of sphere
V= 33523.80 cubic inches
A4)Using Pythagoras’ theorem, proof that triangle ∆ABC (9:12:15) is a right-angled
triangle
X
9
Y
(i)
15
12
Z
Calculate sine, cosine and tangent for each angles of ∆ABC.
𝑆𝑖𝑛 𝜃 =
opposite side
hypotenuse
𝐶𝑜𝑠 𝜃 =
Adjacent side
hypotenuse
𝑇𝑎𝑛 𝜃 =
opposite side
Adjacent side
6|Page
For proof of Pythagoras’ theorem using above triangle
First taken angle of x and
Second taken angle of y
Sin Z = 1
find the value of Sin X
and find the value of Sin
Cos Z= 0
and Cos X and Tan X
Y and Cos Y and Tan Y
Tan Z= undefined
12
4
9
Sin X = 15= 5
Cos X =
Tan X =
(ii)
9
=
15
12
9
3
Sin Y = 15 = 5
3
5
4
=3
Cos Y=
12
15
9
=
4
5
4
Tan Y = 12 = 3
Using an appropriate Excel function, demonstrate on a spreadsheet that ∆ABC is
a right-angled triangle.
if a
2
2
2
+ b = c , a triangle exists with sides a, b and c such that a right angle lies between the sides of length a
and b using side of triangle and them put to formula if both side have equal theme proof that given triangle is
right triangle
9*9 + 12*12 = 15*15
81 + 144 = 225
225 = 225
Hence it is proofed that triange above triangle (ABC) is a right angle triangle.
A5) Two robots, Alice and Bob are
pulling a box as shown on the figure:
7|Page
a)
Calculate vector c = a+b.
Calculate the vector using this formula
for
add two or more vectors
C= (13,20) + (5,-6)
C=(13+5,20-6)
C=(18,14)
b)
Calculate magnitude of vector c.
Find vector magnitude using these formula
or
c = (18,14)
|c| =√(18 ∗ 18 + 14 ∗ 14)= √1040=22.80
c)
Write a Pseudo code for calculating magnitude of vector c.
Algorithm: magnitude Of Vector(x, y) // find the magnitude of vector c using
programming language
Purpose: magnitude of a vector whose 2 components are given
Pre: Given both components of vector
Post: None
8|Page
Return: Magnitude
{
magnitudesqrt(x*x + y*y)
Return magnitude // return variable value
}
LO2: Understand the application of algebraic concepts
B1) A certain British company has three departments. Following sets are showing
departments, surnames and annual salaries of employees of this company:
A= {Martin, Marriott, Boast, Preston, Kans} // set value of A
B= {24k, 25k, 26k, 27k, 30k} //Set Value of B
C= {Production, Sales, Finance} // Set Value Of C
Mr Martin and Mrs Marriott are working at production department as give table data,
Mrs Boast and Mrs Preston working at sales department and Mr Kans works at Finance
department all data matching the table.
a)
Find the Cartesian product of set A and set B. (R=A×B)
Cartesian of a product (R= A X B) // these cross product set using set theory of set and
them cross of two set
(R= A X B) = {Martin, Marriott, Boast, Preston, Kans} X{24k, 25k, 26k, 27k, 30k},
9|Page
={Martin , 24k},{Martin , 25k},{Martin , 26k},{Martin , 27k},{Martin , 30k}, {Marriott ,
24k},{Marriott , 25k},{Marriott , 26k},{Marriott , 27k},{Marriott , 30k}, {Boast , 24k},
{Boast , 25k}, {Boast , 26k}, {Boast , 27k}, {Boast , 30k}, {Preston , 24k}, {Preston , 25k},
{Preston , 26k}, {Preston , 27k}, {Preston , 30k}, {Kans , 24k}, {Kans , 25k}, {Kans ,
26k},{Kans , 27k},{Kans , 30k} // final all set value
b)
Find the Natural join of R and C.
(R =(Production, Martin, 24K),(Production, Marriott, 25K), (Sales, Boast, 26K),(Sales,
Preston, 27K), (Finance, Kans, 30K) // join using set theory formula..
c)
Fill in the below table by using provided information:
Employee Name
Salary
Department
Martin
24,000
Production
Marriott
25,000
Production
Boast
26,000
Sales
Preston
27,000
Sales
Kans
30,000
Finance
10 | P a g e
B2)A small ICT firm, has three branches in
1. Redbridge,
2. Enfield and
3. Barnet.
Five technicians with following details are working at this company;





Ali (Location: Barnet, age: 25, salary: £21,000),
Steve (Location: Redbridge, age: 45, salary: 23,000),
Mike (Location: Enfield, age: 50, salary: 19,000),
Linda (Location: Barnet, age: 55 , salary: 24,000 ),
Carol (Location: Redbridge, age: 43, salary: 27,000)
a) Draw required number of tables and fit in the above information there.
Employee Name
Age
Location
Salary (pounds)
Ali
25
Barnet
21,000
Steve
45
Redbridge
23,000
Mike
50
Enfield
19,000
Linda
55
Barnet
24,000
11 | P a g e
Carol
43
Redbridge
27,000
b) List individuals satisfying the conditions below:
1. (Age<46) AND (Salary> £ 23,000) {Carol}
2. (Age>26 ) OR (Salary < £24,000)Steve,Mike,Linda,Carol,Ali
3. (Age< 53) AND (Salary>29) OR (Location=1)Steve,Carol
4. (Age> 25) XOR (Salary>30) OR (Location=2)Steve,Mike,Linda,Carol
B3. Create a magic square by identifying values of p, q, r, s, t, u, x, y, z in matrix A01 15 14 p 
12 06 q r 


8 s
t u


 x 3 y z
Magic numbers 4X4 , the total should be equal to 34 from all the sides and diagonals. All the
number 1 to 16 should be used to solve the matrix using each number only one.
STEPS
Taking 1st row
12 | P a g e
Sum of all 4 elements should be 34
01 + 15 + 14 + P = 34 or 30+p=34, p=34-30 theme value of P = 4
Taking 1st Column
Sum of all 4 elements should be 34
01 + 08 + 12 + x = 34 or 21+x=34, x=34-21 them value ofx = 13
Taking 2nd Column
15 + 6 + s + 3 = 34 or 24+s=34, s=34-24 them value of s = 10
Taking right side diagonal (PQSX)
x + s + q + p = 34 // put value of s, x and p
13 + 10 + q + 4 = 34 or 27+q=34, q=34-27 them value of q q = 7
Taking left side diagonal (01 6 t z)
1 + 6 + t + z = 34 t +z = 27 -------------------------------- (1)// solve these equation
Taking 3rd Column
14 + q + t + y = 34
14 + 7 + t + y = 34 t + y = 13 --------------------------------- (2)// solve these equation
Taking 2nd ROW
12 + 6 + q + r = 34 // put value of q
13 | P a g e
12 + 6 + 7 + r = 34 r = 9 // find value of r
Taking 3rd ROW
8 + s + t + u = 34// put value of s and them find the equation
8 + 10 + t + u = 34 t + u = 16 ----------------------------- (3)// solve the equation
Taking 4th ROW
x + 3 + y + z = 34// put value of x and find new equation
13 + 3 + y + z = 34 y + z = 18 ------------------------------ (4)
Solving equation 4 & 2 // solve both equation and get new equation
Equation (2) – Equation (3) // and them solve equation 2 and 3
z – t = 5 ------------------------------------ (5)
Solving Equation 1 and 5 // solve these both equation
Adding both equation
2z = 32 z = 16 // find value of z
Hence t = 11
Putting value of t in equation 2 // find value of u
u=5
Putting value of t in equation 1
14 | P a g e
t + y = 13
11 + y =13 y=2 // now finding all element of matrix and them get new matrix
01 15 14 4 
12 06 7 9 


 8 10 11 5 


13 3 2 16
B4. Show that if
Then P is the inverse of Q
If P is inverse of Q then below statements should hold true: PQ= QP = I where I= as below
I=[
1 0
]
0 1
15 | P a g e
1
PQ = [
3
=[
=[
2 −2
1
][
]
4 1.5 −0.5
1 ∗ (−2) + 2 ∗ 1.5 1 ∗ 1 + 2 ∗ (−0.5)
]
3 ∗ (−2) + 4 ∗ 1.5 3 ∗ 1 + 4 ∗ (−0.5)
1 0
]=I
0 1
Same we similarly we will check QP // fallow of identity rule
−2
1
1
QP = [
][
1.5 −0.5 3
=[
=[
2
]
4
−2 ∗ 1 + 1 ∗ 3
−2 ∗ 2 + 1 ∗ 4
]
1.5 ∗ 1 + (−0.5) ∗ 3 2 ∗ 1.5 + (−0.5) ∗ 4
1 0
]=I
0 1
PQ = QP = IHence P is inverse of Matrix Q (Q, the inverse is written Q-1. When Q is
multiplied by Q-1 the result is the identity matrix I. Non-square matrices do not have
inverses.)
LO3: Be able to apply the fundamentals of formal methods
C1. Suppose that two sets are A and B, defined by
A = {g, e, r, m, a, n, i}// define first set
B = {p, o, l, a, n, d}// define second set
Identify the following statements as true or false: // using set theory rule
16 | P a g e
A⋂B = {a,n}// find common element in both set
AUB = {g, e, r, m, a, n, I, p, o, l, d}// combine value of both set
(i)
a ∈ A = Truea is an element of set A // this only true when a belong to set A
(ii)
b ∈ B = Falseb is not an element in set B // It false because b not belong to set
B
(iii)
d ∉ B = Falsed is an element of set B // condition is false because d belong to
set B
(iv)
u ∉ A = Trueu is not an element of A // condition is true because u does not
belong to set A
(v)
a ∈ A⋂B = True a is an element of A⋂B // condition is true because a belong
to both set A and B
(vi)
|A| = |B| = Falsethe no of elements in set A is 7 and no of elements in set B
6.// Condition is false because both set not equal
(vii)
{ i, r, a, n} ⊂ A = True { i, r, a, n} is a subset of set A // condition is true because
given set subset of Set A
(viii)
|A⋃B| = 8 =False= |A⋃B| = 11 // condition is false because both not equal
17 | P a g e
C2. Suppose we have a universal set
{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27} and consider two
sets P and O defined as follows:
P = “all multiples of 3”
O = “the first ten even numbers”
Represent all of the elements in a Venn diagram and identify the elements in P⋂O, P⋃O and
PΔO. P = [3, 6, 9, 12, 15, 18, 21, 24, 27] and O= [ 2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
P⋃O= { 2, 3, 4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 27}
P⋂O = {6, 12, 18}
̅̅̅̅̅̅̅̅̅
PΔO= P⋃O/P⋂O={ 𝑃 ∪ 𝑂}⋂{𝑃
∩ 𝑂}
={ 2, 3, 4, 8, 9, 10, 14, 15, 16, 20, 21, 24, 27}⋂{ 2, 3, 4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24,
27} = {2,3,4,8,9,10,14,15,16,20,21,24,27} // common value of both set
P
O
P∩𝑄
2, 4,
3, 9,
8, 10,
6 , 12 , 15,21,
14,16, 18, 18
24 ,27
20
VENN DIAGRAM
18 | P a g e
C3. For all of the following sets defined in set−theoretic notation, list out all of the
elements:// solve the equality of set theory
S1 = {x: x = 2n, where 1 ≤ n ≤ 6}
n is greater and equal to 1 and less than and equal to 6. n : {1, 2, 3, 4, 5, 6)
S1 is set of x and x = 2n henceS1={2,4,6,8,10,12}
S2 = {x: x = 3n2, where 1 ≤ n ≤ 5}
n is greater and equal to 1 and less than and equal to 5.n : {1, 2, 3, 4, 5)
S2 is set of x and x = 3n2 hence S2={3,12,27,48,75}
S3 = {y: y = 5n3, where 1 ≤ n ≤ 4}
n is greater and equal to 1 and less than and equal to 4. n : {1, 2, 3, 4)
S3 is set of x and x = 5n3 hence S3={5,40,135,320}
S4 = {x: x = √n, where 3 < n < 5}
n is greater than 3 and lesser than 5. Hence n has only one value. n : {4}
S4 is set of x and x = = √n hence S4={2}
19 | P a g e
C4. For the circuit shown below, construct a truth table for each intermediate
function. Hence, find the output function X.
B
C
B.C
A.(B.C)
NOT
A
A.(B.C)
0
0
0
0
1
0
0
1
0
0
1
1
1
0
0
0
1
0
1
1
1
1
0
1
20 | P a g e
C5. Suppose that a salesman has 4 differently-located customers.
a) Find the number of different ways that the salesman can leave home, visit two different
customers and then return home.
Total no of customer = 4(value of n)
We have to choose 2 customer (value of r) // choose 2 out of 4 using formula !n/!n-r
𝟒!
No of ways to choose 2 out of 4 = 𝟒𝒑 = 𝟐!𝟐! = 6 ways // chose way of customer using
𝟐
permutation
b) Write a pseudocode for calculating the answer for the previous section.
a) Algorithm: Combination Of two number(a,b)
Purpose: No of ways of a out of b with no repetation
Pre: Given both a and b
Post: None
// Java program to print all possible strings of length k
class PrintAllKLengthStrings {
// Driver method to test below methods
public static void main(String[] args) {
System.out.println("First Test");
char set1[] = {'a', 'b'};
int k = 3;
printAllKLength(set1, k);
System.out.println("\nSecond Test");
char set2[] = {'a', 'b', 'c', 'd'};
k = 1;
printAllKLength(set2, k);
}
// The method that prints all possible strings of length k. It is
// mainly a wrapper over recursive function printAllKLengthRec()
static void printAllKLength(char set[], int k) {
int n = set.length;
printAllKLengthRec(set, "", n, k);
}
21 | P a g e
// The main recursive method to print all possible strings of length k
static void printAllKLengthRec(char set[], String prefix, int n, int k) {
// Base case: k is 0, print prefix
if (k == 0) {
System.out.println(prefix);
return;
}
// One by one add all characters from set and recursively
// call for k equals to k-1
for (int i = 0; i < n; ++i) {
// Next character of input added
String newPrefix = prefix + set[i];
// k is decreased, because we have added a new character
printAllKLengthRec(set, newPrefix, n, k - 1);
}
}
}
LO4: Be able to apply statistical techniques to analyze data
D1. A research in 157 households found that the number of children per household
is
a) Calculate the Mean of frequency distribution for the above case.
Mean of Households = X =
∑X
𝑛
(x is house hold) // find sum of house hold and
divided children
∑X = Sum of all X element = (32+35+37+29+15+8+1)
X=
∑X 157
=
= 22.43
𝑛
7
22 | P a g e
b) What is the Mode value of number of children’s per household?
Mode value = None
D2. A company has ten sales territories with approximately the same number of
sales people working in each territory. Last month the sales orders achieved were as
follows:
For these sales calculate the following:
(i)
Arithmetic mean X: = Sum Of Sales/Total No Of sales
X=
150+130+140+150+140+300+110+120+140+120
10
X = 1500/10
23 | P a g e
X =150
(ii)
For mode we will keep the same order which is given
There are ten numbers in the list, so the middle one will be the =
10+1
2
=5 // where n is
odd
So 5th no will be Mode = 140
(iii)
1st we have to rewrite the list in increasing order.
110, 120, 120, 130, 140, 140, 140, 150, 150, 300
No we will take middle value. There are ten numbers in the list, so the middle one will
be the =
10+1
2
=5
So 5th no will be median=140
(iv)
First arrange list in increasing order
110, 120, 120, 130, 140, 140, 140, 150, 150, 300
Now divide it in quarter
There are 10 nos so
Quartile 1 (Q1) = 3rd no = 120
Quartile 2 (Q2) = =
140+140
2
= 140
Quartile 3 (Q3) = 8th no = 150
Lower quartile=3rd No in order = 120
(v)
Upper quartile= Q3= 150
(vi)
Quartile deviation==
(vii)
X = Sales
𝑄3 − 𝑄1 150 − 120
=
=15
2
2
24 | P a g e
Variance =
=
X
Mean
X - Mean
|X – Mean |
(X-Mean)2
150
150
0
0
0
130
150
-20
20
400
140
150
-10
10
100
150
150
0
0
0
140
150
-10
10
100
300
150
150
150
22500
110
150
-40
40
1600
120
150
-30
30
900
140
150
-10
10
100
120
150
-30
30
900
∑(X−mean)
2
𝑁
(Where N is total number of values, N = 10)
0+400+100+0+100+22500+1600+900+100+900
10
or 26600/10 = 2660 (value of variance)
Standard deviation = √Variance = 51.57=52
25 | P a g e
(viii)
Mean deviation =
ϵ |X−mean | 0+20+10+0+10+150+40+30+10+30
=
𝑁
10
or 300/10 =
30(value of mean deviation)
D3.In Software Development Using Boolean Algebra and Identify a topic in one of
the following areas and conduct a research on its application in software
development.
Using Boolean Algebra
‘True’ and ‘False’ are the two terms that define the favorable and unfavorable outcomes of an effort.
This does not leave out a third option of a doubtful momentum to opt for. Boolean Algebra is something
very similar that determines the possibilities of switching on and switching off in electronics. It is widely
known that digital systems work on the basis of binary coding i.e. 0 and 1. Hence, it is quite convenient
to term ‘0’ as false and ‘1’ as true.
26 | P a g e
Now coming back to more elaborate and relevant terms, 0 implies the switching off and 1 refers to the
switching on process in a digital system. It is highly relevant and quite common to mention that a
computer system is an amalgam of ‘n’ number of switches that can be compared to the motions of ‘on’
and ‘off’. The process of calculating terms in the basis of binary digits is termed as Boolean Algebra.
In the next section, we will take a look at the introductory form of Boolean Algebra and its applications
in the field of computer science. Here, we will be discussing things at a layman approach, to establish a
clear conclusion in the further sections.
Application of Boolean Algebra in Software Development
It is known that every computer system constitutes several magnetic cores which are supposed to have
a number of switches. The motion of switches can be easily compared to the ‘on’ and ‘off’ motion of
Boolean Algebra. Hence, when the switches of magnetic cores are turned off, it represents ‘0’ value,
whereas, they are turned on, it represents ‘1’ value.
Computer Systems consists of GATES
It is no new thing that computer is build up of many integrated circuits, which are then connected
through wires. These resemble GATES (logic gates, as defined by Boolean). Here, we will take a look at
the practical application of Boolean Algebra in the field of computer science, to be precise, software
development.
The memory addresses in a computer system are identified as binary members. Hence, one needs to
determine the actual address with the help of decoder.
Now, we will discuss the application of Boolean Algebra in the form of combinational circuits. A
combinational circuit is the type of digital logic that is represented by the instantaneous nature of the
output which relies on the levels at input terminals. This does not depend upon the computer’s
memory.
27 | P a g e
In a combinational circuit, the circuit selects the information from a number of input lines and
propagates it to the output line. Instantaneous selection is performed in this process and only one input
signal is selected at one time and others are cut off from the signal.
A combinational circuit highly represents a multiplexer in a time-sharing computer. This is named so
considering the fact that they have multiple number of inputs, but a single output. Now, let’s compare
the digital diagram to the actual working of a time-sharing operating system.
In a time-sharing computer, time sharing occurs between multiple users located at multiple locations.
This enables them to access the same computer system simultaneously. This is done by alleviating the
response time to each task. Switches play a major role in lessening the response time in time-sharing
processes. Here, the switches changes very frequently and at a very rapid pace.
Analysis of Boolean Algebra
In terms of machine communication, it is required that the networks and connectivity should be
done in a logical manner. Boolean Algebra presents the logical mannerism for describing the
digital specifications of the computer. The logic is largely an amalgam of circuits, digital
elements that enable storage, entry and data processing in a computer system. However,
following the Boolean Algebra was never a necessity in constructing the computers (as depicted
in earlier generation computers), it is followed in order to build up an organized arrangement of
the computer system. It should always be considered that if the basic organization of the
computer system is not free of ills, one cannot act to the rescue of the network, by just
following the Boolean Algebra specifications.
28 | P a g e
Download