Docsity

QRG Computer Science, Exercises of Computer Systems Networking and Telecommunications

Partial preview of the text

Download QRG Computer Science and more Exercises Computer Systems Networking and Telecommunications in PDF only on Docsity!

QUICK REFRESHER GUIDE

For

Computer Science

Information Technology

By

www.thegateacademy.com

 - THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30th Cross, 10th Main, Jayanagar 4th Block, Bangalore- 
  • #1.Mathemathics 1 – Topic Page No.
    • 1.1Linear Algebra 1 –
    • 1.2Probability and Distribution 9 –
    • 1.3Numerical Methods 15 –
    • 1.4Calculus 20 –
  • #2.Discrete Mathematics and Graph Theory 31 –
    • 2.1Mathematical Logic 31 –
    • 2.2Combinatorics 37 –
    • 2.3Sets and Relations 43 –
    • 2.4Graph Theory 57 –
  • #3.Data Structures and Algorithms 71 –
    • 3.1Data Structure and Algorithm Analysis 71 –
    • 3.2Elements of Discrete Mathematics for Data Structure 76 –
    • 3.3Abstract Data Type (ADT)
    • 3.4Stacks
    • 3.5Queue
    • 3.6Trees 81 -
    • 3.7 Height Balanced Trees (AVL Trees, B and B+) 86 –
    • 3.8Hashing 95 –
    • 3.9Graph Algorithms 98 –
    • 3.10Sorting Algorithms 101 –
  • #4. Operating System 106 –
    • 4.1Introduction to Operating System 106 –
    • 4.2Process Management 109 –
    • 4.3Threads 124 –
    • 4.4CPU Scheduling 126 –
    • 4.5Deadlocks 129 –
    • 4.6Memory Management & Virtual Memory 134 –
    • 4.7File System 145 –
    • 4.8I/O Systems 150 –
    • 4.9Protection and Security 154 –
  • #5.Data Base Management Systems 158 –
    • 5.1ER Diagrams 158 –
    • 5.2Functional Dependencies & Normalization 164 –
    • 5.3Relational Algebra & Relational Calculus 171 –
      • THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30th Cross, 10th Main, Jayanagar 4th Block, Bangalore- Quick Refresher Guide Contents
    • 5.4SQL 175 - : 080-65700750,  [email protected] © Copyright reserved. Web: www.thegateacademy.com Page.II
    • 5.5Transactions and Concurrency Control 181 –
    • 5.6File Structures (Sequential files, indexing B & B+ trees) 189 –
  • #6.Theory of Computation 194 –
    • 6.1Introudction
    • 6.2Finite Automata 195 –
    • 6.3Regular Expression 199 –
    • 6.4Context free grammar 209 –
    • 6.5Turing Machines 219 –
  • #7.Computer Organization 239 –
    • 7.1Introduction of Computer Organization 239 –
    • 7.2Memory Hierarchy 245 –
    • 7.3Pipelining 253 –
    • 7.4Instruction Types 259 –
    • 7.5Addressing Modes 264 –
    • 7.6I/O Data Transfer 267 –
  • #8.Digital Logic 279 –
    • 8.1Number Systems & Code Conversions 279 –
    • 8.2Boolean Algebra &Karnaugh Maps 281 –
    • 8.3Logic Gates 283 –
    • 8.4Combinational Digital Circuits 287 –
    • 8.5Semiconductor Memory
  • #9. Compiler Design 293 –
    • 9.1 Introduction 293 –
    • 9.2Syntax Analysis 301 –
    • 9.3Syntax Directed Translation 326 –
    • 9.4Run Time Environment 335 –
    • 9.5Intermediate Code Generation 337 –
    • 9.6Code Optimization 343 –
    • 9.7Code Generation 345 –
  • #10. Computer Networks 350 –
    • 10.1 Introduction to Computer Networks 350 –
    • 10.2Multiple Access Protocols 358 –
    • 10.3The Data Link Layer 361 –
    • 10.4Routing & Congestion Control 366 –
    • 10.5TCP/IP, UDP and Stocks, IP(V4) 370 –
    • 10.6Application Layer 377 –
    • 10.7Network Security 379 –

Quick Refresher Guide Contents

THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30th^ Cross, 10th^ Main, Jayanagar 4th^ Block, Bangalore- : 080-65700750,  [email protected] © Copyright reserved. Web: www.thegateacademy.com Page.III

#11. Software Engineering and Web Technology 382 – 417

11.1Introduction 382 – 389

11.2Process Models and Software Estimation

11.3 Validation and Verification

11.4 HTML

11.5 XML & DTDs

# Reference Book 418 – 419

THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30th^ Cross, 10th^ Main, Jayanagar 4th^ Block, Bangalore-

Symmetric Matrix = A Skew Symmetric Matrix = - A

1.1.1.6 Unit Matrix (or Identity Matrix)

A Diagonal matrix in which all the leading diagonal elements are ‘ ’.

e.g. = (^) [ ]

1.1.1.7 Null Matrix (or Zero Matrix)

A matrix is said to be Null Matrix if all the elements are zero. e.g.[ ]

1.1.1.8 Symmetric and Skew Symmetric Matrices:  Symmetric, when a = +a for all i and j. In other words = A  Skew symmetric, when a = - a In other words = - A

Note: All the diagonal elements of skew symmetric matrix must be zero. Symmetric Skew symmetric

[

a h g h b g c

] [

h g h g

]

1.1.1.9 Triangular Matrix  A matrix is said to be “upper triangular” i all the elements below its principal diagonal are zeros.  A matrix is said to be “lower triangular” i all the elements above its principal diagonal are zeros.

[

a h g b c

] [

a g b h c

]

Upper Triangular Matrix Lower Triangular Matrix

1.1.1.10 Orthogonal Matrix: If A.A = , then matrix A is said to be Orthogonal matrix.

1.1.1.11 Singular Matrix: If |A| = 0, then A is called a singular matrix.

1.1.1.12 Unitary Matrix: If we define, A = (A̅)^ = transpose of a conjugate of matrix A Then the matrix is unitary if A. A =

THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30th^ Cross, 10th^ Main, Jayanagar 4th^ Block, Bangalore-

1.1.1.13 Hermitian Matrix: It is a square matrix with complex entries which is equal to its own conjugate transpose.

A = A or a = a̅̅̅

1.1.1.14 Note: In Hermitian matrix, diagonal elements always real

1.1.1.15 Skew Hermitian matrix: It is a square matrix with complex entries which is equal to the negative of conjugate transpose.

A = A ora = a̅̅̅

Note: In Skew-Hermitianmatrix , diagonal elements either zero or Pure Imaginary

1.1.1.16 Idempotent Matrix

If A = A, then the matrix A is called idempotent matrix.

1.1.1.17 Multiplication of Matrix by a Scalar:

Every element of the matrix gets multiplied by that scalar.

Multiplication of Matrices:

Two matrices can be multiplied only when number of columns of the first matrix is equal to the number of rows of the second matrix. Multiplication of (m n) and(n p) matrices results in matrix o (m p)dimension [ ] [ ] = [ ].

1.1.1.18 Determinant:

An n order determinant is an expression associated with n n square matrix.

If A = [a ] , Element a with ith^ row, jth^ column.

For n = 2 , D = det A = |

a a a a |^ =^ a^ a^ -^ a^ a

Determinant o “order n”

D = |A| = det A = (^) |^ |

a a a a a a

a a a

THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30th^ Cross, 10th^ Main, Jayanagar 4th^ Block, Bangalore-

11. (A+B)T^ = A + B
12. (AB)T^ = B. A
13. (AB)-1^ = B. A
14. A A = A A =
  1. (kA)T^ = k.A (k is scalar, A is vector)
  2. (kA)-1^ =. A (k is scalar , A is vector)
  3. (A ) = (A )
  4. (A ̅̅̅ ̅) = (A̅) (Conjugate of a transpose of matrix= Transpose of conjugate of matrix)
  5. If a non-singular matrix A is symmetric, then A is also symmetric.
  6. If A is a orthogonal matrix , then A and A are also orthogonal.
  7. If A is a square matrix of order n then (i) |adj A|=|A| (ii) |adj (adj A)|=|A|(^ ) (iii) adj (adj A) =|A| A

1.1.1.22 Elementary Transformation of a Matrix:

  1. Interchange of any 2 lines
  2. Multiplication of a line by a constant (e.g. k )
  3. Addition of constant multiplication of any line to the another line (e. g. + p )

Note:  Elementary trans ormations don’t change the ran o the matrix.  However it changes the Eigen value of the matrix.

1.1.1.23 Rank of Matrix

If we select any r rows and r columns from any matrix A,deleting all other rows and columns, then the determinant formed by these r r elements is called minor of A of order r.

Definition: A matrix is said to be of rank r when, i) It has at least one non-zero minor of order r. ii) Every minor of order higher than r vanishes.

Other definition: The rank is also defined as maximum number of linearly independent row vectors.

Special case: Rank of Square matrix

Rank = Number of non-zero row in upper triangular matrix using elementary transformation.

Note:

  1. r(A.B) min { r(A), r (B)}
  2. r(A+B) r(A) + r (B)
  3. r(A-B) r(A) - r (B)
  4. The rank of a diagonal matrix is simply the number of non-zero elements in principal diagonal.
  5. A system of homogeneous equations such that the number of unknown variable exceeds the number of equations, necessarily has non-zero solutions.
  6. If A is a non-singular matrix, then all the row/column vectors are independent.
  7. If A is a singular matrix, then vectors of A are linearly dependent.

THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30th Cross, 10th Main, Jayanagar 4th Block, Bangalore- Quick Refresher Guide Contents

  1. r(A)=0 iff (if and only if) A is a null matrix.
  2. If two matrices A and B have the same size and the same rank then A, B are equivalent matrices.
  3. Every non-singular matrix is row matrix and it is equivalent to identity matrix.

1.1.1.24 Solution of linear System of Equations:

For the following system of equations A X = B

Where, A =

[

a a a a a

a a a ]

[

x x

x ]

, B =
[ ]

A= Coefficient Matrix, C = (A, B) = Augmented Matrix

r = rank (A), r = rank (C), n = Number of unknown variables (x , x , - - - x )

Consistency of a System of Equations:

For Non-Homogenous Equations (A X = B) i) If r r , the equations are inconsistent i.e. there is no solution. ii) If r = r = n, the equations are consistent and there is a unique solution. iii) If r = r < n, the equations are consistent and there are infinite number of solutions.

For Homogenous Equations (A X = 0) i) If r = n, the equations have only a trivial zero solution ( i.e. x = x = - - -x = 0). ii) If r < n, then (n-r) linearly independent solution (i.e. infinite non-trivial solutions).

Note:

Consistent means: one or more solution (i.e. unique or infinite solution)

Inconsistent means: No solution

Cramer’s ule

Let the following two equations be there

a x +a x = b ---------------------------------------(i)

a x +a x = b ---------------------------------------(ii)

D = |

a a b b |

D = |

b a b a |

THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30th^ Cross, 10th^ Main, Jayanagar 4th^ Block, Bangalore-

ii) Eigen value of A is λ iii) Eigen value of kA are λ (k is scalar) iv) Eigen value of A are λ + k v) Eigen value of (A )^2 are ( )

Properties of Eigen Vectors

  1. Eigen vector X of matrix A is not unique. Let is Eigen vector, then C is also Eigen vector (C = scalar constant).
  2. If λ , λ , λ..... λ are distinct, then ,..... are linearly independent.
  3. If two or more Eigen values are equal, it may or may not be possible to get linearly independent Eigen vectors corresponding to equal roots.
  4. Two Eigen vectors are called orthogonal vectors if T∙ = 0. ( , are column vector) (Note: For a single vector to be orthogonal , A = A or, A. A = A. A =  )
  5. Eigen vectors of a symmetric matrix corresponding to different Eigen values are orthogonal.

Cayley Hamilton Theorem: Every square matrix satisfies its own characteristic equation.

1.1.1.26 Vector:

Any quantity having n components is called a vector of order n.

Linear Dependence of Vectors  If one vector can be written as linear combination of others, the vector is linearly dependent.

Linearly Independent Vectors  If no vectors can be written as a linear combination of others, then they are linearly independent.

Suppose the vectors are x x x x

Its linear combination is λ x + λ x + λ x + λ x = 0  Ifλ , λ , λ , λ are not “all zero” they are linearly dependent.  If all λ are zero they are linearly independent.

THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30th^ Cross, 10th^ Main, Jayanagar 4th^ Block, Bangalore-

1.2 Probability and Distribution

1.2.1 Probability

Event: Outcome of an experiment is called event.

Mutually Exclusive Events (Disjoint Events): Two events are called mutually exclusive, if the occurrence o one excludes the occurrence o others i.e. both can’t occur simultaneously.

A B =φ, P(A B) = 0

Equally Likely Events: If one of the events cannot happen in preference to other, then such events are said to be equally likely.

Odds in Favour of an Event =

Where m no. o ways avourable to A

n no. o ways not avourable to A

Odds Against the Event =

Probability: P(A)= =

. .

P(A)+ P(A’)=

Important points:  P(A B) Probability of happening of “at least one” event o A & B  P(A B) ) Probability of happening of “both” events o A & B  If the events are certain to happen, then the probability is unity.  If the events are impossible to happen, then the probability is zero.

Addition Law ofProbability: a. For every events A, B and C not mutually exclusive P(A B C)= P(A)+ P(B)+ P(C)- P(A B)- P(B C)- P(C A)+ P(A B C) b. For the event A, B and C which are mutually exclusive P(A B C)= P(A)+ P(B)+ P(C)

Independent Events: Two events are said to be independent, if the occurrence of one does not affect the occurrence of the other.

If P(A B)= P(A) P(B) Independent events A & B

Conditional Probability: If A and B are dependent events, then P( ) denotes the probability of

occurrence of B when A has already occurred. This is known as conditional probability.

P(B/A)= (^ ( ))

THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30th^ Cross, 10th^ Main, Jayanagar 4th^ Block, Bangalore-

Discrete Cumulative Distribution Function (CDF) or Distribution Function

The Cumulative Distribution Function F(x) of the discrete variable x is defined by,

(x) = (x)= P(X x) = P(x )= (x )

Continuous Cumulative Distribution function (CDF) or Distribution Function:

If (x) = P(X x) =∫ (x)dx, then F(x) is defined as the cumulative distribution function or

simply the distribution function of the continuous variable.

CDF has the following properties:

i)

( ) = (x) =f(x) 0 ii) 1 (x) 0 iii) If x x then (x ) (x ) , i.e. CDF is monotone (non-decreasing function) iv) (^ )^ = 0 v) (^ )^ = 1 vi) P(a x b) =∫ (x)dx =∫ (x)dx - (^) ∫ (x)dx = (b) (a)

Expectation [E(x)]:

  1. E(X) = x (x ) (Discrete case)
  2. E(X) =∫ x (x )dx (Continuous case)

Properties of Expectation

  1. E(constant) = constant
  2. E(CX) = C. E(X) [C is constant]
  3. E(AX+BY) = A E(X)+B E(Y) [A& B are constants]
  4. E(XY)= E(X) E(Y/X)= E(Y) E(X/Y)

E(XY) E(X) E(Y) in general

But E(XY) = E(X) E(Y) , if X & Y are independent

Variance (Var(X))

Var(X) =E[(x ) ]

Var(X)= (x x ) (xx ) (Discrete case)

Var(X)=∫ (xx ) f(x)dx (Continuous case)

Var(X) =E( )-[E(x)]

Properties of Variance

  1. Var(constant) = 0
  2. Var(Cx)= C Var(x) -Variance is non-linear [here C is constant]

THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30th^ Cross, 10th^ Main, Jayanagar 4th^ Block, Bangalore-

  1. Var(Cx D)=C Var(x) -Variance is translational invariant [C & D are constants]
  2. Var(x-k) = Var(x) [k is constant]
  3. Var(ax+by) =a Var(x) +b Var(y) 2ab cov(x,y) (if not independent) [A & B are constants] = a Var(x) +b Var(y) (if independent)

Covariance

Cov (x,y)=E(xy)-E(x) E(y)

If independent covariance=0, E(xy) = E(x). E(y)

(if covariance = 0, then the events are not necessarily independent)

Properties of Covariance

  1. Cov(x,y) = Cov(y,x) (i.e. symmetric)
  2. Cov(x,x) = Var(x)
  3. |Cov(x,y)|

Standard Distribution Function (Discrete r.v. case):

  1. Binomial Distribution : P(r) = C p

Mean = np, Variance = npq, S.D. =√np

  1. Poisson Distribution: Probability of k success is P (k) =

no. o success trials ,n no. o trials , P success case probability mean o the distribution For Poisson distribution: Mean = , variance = , and =np

Standard Distribution Function (Continuous r.v. case):

  1. Normal Distribution (Gaussian Distribution): f(x) = (^) √ e

( )

Where and are the mean and standard deviation respectively  P( < x < ) = 68%  P( < x < ) = 95.5%  P( < x < ) = 99.7%  Total area under the curve is is unity i.e. ∫ (x)dx =

 P(x 1 < x < x 2 ) =∫ (^) √ e

( ) dx = Area under the curve from x 1 to x 2

  1. Exponential distribution : f(x) = λe , x , here λ = , x
  2. Uniform distribution: f(x)= , b f(x) a

= , otherwise

  1. Cauchy distribution : f(x)= (^) .( )
  2. Rayleigh distribution function : f(x) = e , x

Mean:  For a set of n values of a variant X=(x , x , ….. , x )

THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30th^ Cross, 10th^ Main, Jayanagar 4th^ Block, Bangalore-

̅̅̅̅^ is called the regression coefficient of x on y and is denoted by bxy.

Joint Probability Distribution: If X & Y are two random variables then Joint distribution is defined as, Fxy(x,y) = P(X x ; Y y)

Properties of Joint Distribution Function/ Cumulative Distribution Function:

  1. ( , ) =
  2. ( , ) =
  3. ( , ) = { ( , ) = P( y) = 0 x 1 = 0 }
  4. (x, ) = P(^ x ) = (x). = (x)
  5. ( , y) = (y)

Joint Probability Density Function:

Defined as (x, y) = (x, y) Property: (^) ∫ ∫ (x, y) dx dy =

Note: X and Y are said to be independent random variable

If fxy(x,y) = fx(x). fy(y)

THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30th^ Cross, 10th^ Main, Jayanagar 4th^ Block, Bangalore-

1.3 Numerical Methods

1.3.1 Solution of Algebraic and Transcendental Equation / Root Finding :

Consider an equation f(x) = 0

  1. Bisection method

This method inds the root between points “a” and “b”.

If f(x) is continuous between a and b and f (a) and f (b) are of opposite sign then there is a root between a & b (Intermediate Value Theorem).

First approximation to the root is x 1 =.

If f(x 1 ) = 0, then x 1 is the root of f(x) = 0, otherwise root lies between a and x 1 or x 1 and b.

Similarly x 2 and x 3..... are determined.  Simplest iterative method  Bisection method always converge, but often slowly.  This method can’t be used or inding the complex roots.  Rate of convergence is linear

  1. Newton RaphsonMethod (or Successive Substitution Method or Tangent Method)

xn+1 = xn – ( (^ ))  This method is commonly used for its simplicity and greater speed.  Here (x) is assumed to have continuous derivative ’(x).  This method ails i ’(x) =.  It has second order of convergence or quadratic convergence, i.e. the subsequent error at each step is proportional to the square of the error at previous step.  Sensitive to starting value, i.e. The Newton’s method converges provided the initial approximation is chosen sufficiently close to the root.  Rate of convergence is quadratic.

  1. Secant Method x =x (^) ( ) – ( ) (x )

 Convergence is not guaranteed.  If converges, convergence super linear (more rapid than linear, almost quadratic like Newton Raphson, around 1.62).

  1. RegulaFalsiMethod or (Method of False Position)

 Regulafalsi method always converges.  However, it converges slowly.  If converges, order of convergence is between 1 & 2 (closer to 1).