Showing posts with label BCA Assignments. Show all posts
Showing posts with label BCA Assignments. Show all posts

Saturday, February 25, 2012

IGNOU BCA CS-06 Solved Assignment 2011



There are five questions in this assignment.  Answer all the questions. You may use illustrations and diagrams to enhance the explanations.  Please go through the guidelines regarding assignments given in the Programme Guide for the format of presentation.  Answer to each part of the question should be confined to about 300 words.


Question 1:  What is Normalization? Explain the condition under which a relation needs to be normalized to 3 NF from 2 NF with the help of   an example?                    (5 Marks)
Ans:
Normalization : Database normalization is a technique for designing relational database tables to minimize duplication of
Information and, in so doing, to safeguard the database against certain types of logical or structural problems, namely data anomalies. For example, when multiple instances of a given piece of information occur in a table, the possibility exists that these instances will not be kept consistent when the data within the table is updated, leading to a loss of data integrity. A table that is sufficiently normalized is less vulnerable to problems of this kind, because its structure reflects the basic assumptions for when multiple instances of the same information should be represented by a single
Instance only.

A relation R is in Second normal form (2NF) if
(a) R is 1NF, and
(b) All non-prime attributes are fully dependent on the candidate keys
Third normal form (3NF) requires that there are no functional dependencies of non-key attributes on something other than a candidate key.
Here an example of a relation needs to be normalized to 3 NF from 2 NF
2 NF
3NF

Module
Dept
Lecture
M1
D1
L1
M2
D1
L1
M3
D1
L2
M4
D2
L3
M5
D2
L4

Lecture
Dept
L1
D1
L2
D1
L3
D2
L4
D2

Module
lecture
M1
L1
M2
L1
M3
L2
M4
L3
M5
L4

Another example
Tabel1

 

Emp ID
Emp name
Address
Age
Date  of Birth
Dept Code
Department name
Here every Non key attribute are depend on Key attribute, But there is a Transitive dependency
 So, table 1 is not in 3 NF
Table 1.1
Emp ID
Emp name
Address
Age
Date  of Birth
Dept Code

Table 1.2
Dept Code
Department name



Question 2: Compare primary, secondary and clustering indexes. Which of these indexes are dense and which are not?                                                                             (5 Marks)
ANS:
Two Types of Indices
         Ordered index (Primary index or clustering index) – which is used to access data sorted by order of values.

Ordered Index
         Hash index (secondary index or non-clustering index) - used to access data that is distributed uniformly across a range of buckets.
Hash Index


Which of these indexes are dense and which are not.
The ordered indices are dense or not
         Dense index - an index record appears for every search-key value in the file.

figure101

         Sparse index - an index record that appears for only some of the values in the file.

      
figure106

Question 3: What is difference between B tree and B+   tree? Why a B+   tree is a better tree structure than a B tree for implementation of an indexed sequential file.   (5 Marks)

Ans:
In a B- tree you can store both keys and data in the internal/leaf nodes. But in a B+ tree you have to store the data in the leaf nodes only. The principal advantage of B+ trees over B trees is they allow you to in pack more pointers to other nodes by removing pointers to data, thus increasing the fan-out and potentially decreasing the depth of the tree

B+   tree is a better tree structure than a B tree for implementation of an indexed sequential file .
In a B+ tree, in contrast to a B-tree, all records are stored at the leaf level of the tree; only keys are
Question 4:
Consider the following employee database schema:
        
Employee ( ESSN ,ENAME , DOB , DEPT-NO , SALARY)
   Dependent (ESSN, DEPENDENT_NAME, RELATION, DOB)
   Department (DEPT_NO, DEPT_NAME, MANAGER)                            

         Perform the following queries using SQL                                                               (5 Marks)
      
(a)    Find the details of dependent for employee having name ABC.
SELECT     DEPENDENT.*
FROM         DEPENDENT INNER JOIN
                     EMPLOYEE ON DEPENDENT.ESSN = EMPLOYEE.ESSN
WHERE     (EMPLOYEE.ENAME = 'ABC') stored in interior nodes
(b)   Find the name of manager of the department in which employee  whose ESSN code is     1234 
SELECT     DEPARTMENT.MANAGER
FROM         DEPARTMENT INNER JOIN
                      EMPLOYEE ON DEPARTMENT.DEPT_NO = EMPLOYEE.DEPT_NO
WHERE     (EMPLOYEE.ESSN = '1234')
(c)    Find the name of all employees whose age is less than 18 years.   
SELECT    ENAME
FROM         EMPLOYEE
Where FLOOR (DATEDIFF (DAY, DOB, SYSDATE) / 365.25) <18

(d)   Find the DOB of the son  of  employee  having employee code ESSN 5078 
SELECT DEPENDENT.DEPENDENT_NAME,DEPENDENT.DOB, EMPLOYEE.ESSN
FROM  DEPENDENT INNER JOIN
       EMPLOYEE ON DEPENDENT.ESSN = EMPLOYEE.ESSN
WHERE     (EMPLOYEE.ESSN = '5078')



IGNOU BCA 2 SEM Assignment MCS-013


Course Code : MCS-013
Course Title : Discrete Mathematics
Assignment Number : MCA(1)/013/Assign/2012
Assignment Marks : 100
Last Date of Submission : 30th April,2012
There are eight questions in this assignment, which carries 80 marks. Rest 20 marks are
for viva-voce. Answer all the questions. You may use illustrations and diagrams to enhance
the explanations. Please go through the guidelines regarding assignments given in the
Programme Guide for the format of presentation.
Question 1:
Marks ( 4 + 4 +4)
a) Make truth table for
i) ~p→(q  ~ r)  ~p  q
Ans:
p q r ~p ~r (q V ~r) (~p ^ q) (q V ~r) ^ (~p ^ q) ~p→(q  ~ r)  ~p  q
0 0 0 1 1 1 0 0 0
0 0 1 1 0 0 0 0 0
0 1 0 1 1 1 1 1 1
0 1 1 1 0 1 1 1 1
1 0 0 0 1 1 0 0 1
1 0 1 0 0 0 0 0 1
1 1 0 0 1 1 0 0 1
1 1 1 0 0 1 0 0 1
i) ~p→r  ~q  ~p  ~r
p q r ~p ~q ~r (~q ^ ~p) [r V(~q ^ ~p)] [(r V (~q ^ ~p)) V ~r] ~p→r  ~q  ~p  ~r
0 0 0 1 1 1 1 1 1 1
0 0 1 1 1 0 1 1 1 1
0 1 0 1 0 1 0 0 1 1
0 1 1 1 0 0 0 1 1 1
1 0 0 0 1 1 0 0 1 0
1 0 1 0 1 0 0 1 1 0
1 1 0 0 0 1 0 0 1 0
1 1 1 0 0 0 0 1 1 0
b) What are conditional connectives? Explain use of conditional connectives with an example.
Ans:
Given any two propositions p and q, we denote the statement ‘If p, then q’ by p → q. We also read this
as ‘p implies q’. or ‘p is sufficient for q’, or ‘p only if q’. We also call p the hypothesis and q the
conclusion. Further, a statement of the form p → q is called a conditional statement or a conditional
proposition.
So, for example, in the conditional proposition ‘If m is in Z, then m belongs to Q.’ the hypothesis is ‘m 
Z’ and the conclusion is ‘m ∈ Q’.
Mathematically, we can write this statement as
∈ → m ∈ Q.
Let us analyse the statement p → q for its truth value. Do you agree with the truth table we’ve given
below (Table 3)? You may like to check it out while keeping an example from your surroundings in mind.
Table 3: Truth table for implication
p q p->q
T T T
T F F
F T T
F F T
Eg
‘If Ayesha gets 75% or more in the examination, then she will get an A grade for the course.’. We can
write this statement as ‘If p, and q’, where
p: Ayesha gets 75% or more in the examination, and
q: Ayesha will get an A grade for the course.
therefore, P->Q
c) Write down suitable mathematical statement that can be represented by the following symbolic
properties.
i) (  x) (  y) (  z) P
ii)  (x) (  y) (  z) P
Question 2:
Marks (4 + 4)
a) What is proof? Explain method of direct proof with the help of one example.
Ans :
proof of a proposition p is a mathematical argument consisting of a sequence
of statements p1 , p2 , · · · , pn from which p logically follows. So, p is the conclusion of this
argument.
The statement that is proved to be true is called a theorem.
Direct Proof
This form of proof is based entirely on modus ponens. Let us formally spell out the strategy.
Definition: A direct proof of p ⇒ q is a logically valid argument that begins with the
assumptions that p is true and, in one or more applications of the law of detachment, concludes
that q must be true.
So, to construct a direct proof of p ⇒ q, we start by assuming that p is true. Then, in one or more
steps of the form p ⇒ q1, q1⇒ q2, ……., qn ⇒ q, we conclude that q is true. Consider the following
examples
Example : Give a direct proof of the statement ‘The product of two odd integers is odd’.
Solution: Let us clearly analyse what our hypotheses are, and what we have to prove.
We start by considering any two odd integers x and y. So our hypothesis is p: x and y are odd.
The conclusion we want to reach is
q: xy is odd.
Let us first prove that p ⇒ q.
Since x is odd, x = 2m + 1 for some integer m.
Similarly, y = 2n + 1 for some integer n.
Then xy = (2m + 1) (2n + 1) = 2(2mn + m + n) +1
Therefore, xy is odd.
So we have shown that p ⇒ q.
Now we can apply modus ponens to p ∧ ( p ⇒ q) to get the required conclusion.
b) Show whether 17 is rational or irrational.
Ans:
Let us try and prove the given statement by contradiction. For this, we begin by assuming that
17 is rational. This means that there exist positive integers a and b such that 17 = a/b, where
a and b have no common factors.
This implies a = 17 b
⇒ a
2
= 17b
2
⇒ 17 | a
2
⇒ 17 | a.
Therefore, by definition, a = 17c for some c ∈ Z.
Therefore, a
2
= 289c
2
.
But a
2
= 17b
2
also.
So 289c
2
= 17b
2
⇒ 17c
2
= b
2
⇒ 17 | b
2
⇒ 17 | b
But now we find that 17 divides both a and b, which contradicts our earlier assumption that a and
b have no common factor.
Therefore, we conclude that our assumption that 17 is rational is false, i.e, 17 is irrational.
Question 3:
Marks (5 + 5)
a) What is Boolean algebra? Explain how Boolean algebra methods are used in logic circuit design.
Ans :
Definition: A Boolean algebra B is an algebraic structure which consists of a set X (≠ Ø) having
two binary operations (denoted by ∨ and ), one unary operation (denoted by ' ) and two specially
defined elements and (say), which satisfy the following five laws for all x, y, z ∈ X.
B1. Associative Laws: ∨ (y ∨ z) = (x ∨ y) ∨ z,
∧ (y ∧ z) = (x ∧ y) ∧ z
B2. Commutative Laws: ∨ y = y ∨ x,
∧ y = y ∧ x
B3. Distributive Laws: ∨ (y ∧ z) = (x ∨ y) ∧ (x ∨ z),
∧ (y ∨ z) = (x ∧ y) ∨ (x ∧ z)
B4. Identity Laws: ∨ = x,
∧ = x
B5. Complementation Laws: ∧ x' = O,
∨ x'= I.
We write this algebraic structure as = (X, ' , O, I), or simply B, if the context makes the
meaning of the other terms clear. The two operations ∨ and ∧ are called the join operation and
meet operation, respectively. The unary operation ' is called the complementation.
Boolean algebra methods to circuit design.
While expressing circuits mathematically, we identify each circuit in terms of some Boolean variables.
Each of these variables represents either a simple switch or an input to some electronic switch.
Definition: Let = (S, , ', O, I) be a Boolean algebra. A Boolean expression in variables
x1, x2 , . . . , xk (say), each taking their values in the set is defined recursively as follows:
i) Each of the variables x1 , x2 , . . . , xk , as well as the elements and of the Boolean algebra are
Boolean expressions.
ii) If X1 and X2 are previously defined Boolean expressions, then X1 ∧ X2 , X1 ∨ X 2 and X'1 are also
Boolean expressions.
For instance, x1 ∧ x'3 is a Boolean expression because so are x1 and x'3 , Similarly,
because x1 ∧ x2 is a Boolean expression, so is (x1 ∧ x2 ) ∧ (x1 ∧ x'3 ).
If is a Boolean expression in n variables x1 , x2 , . . . , xn (say), we write this as
X = X(x1 , . . . , xn ) .
In the context of simplifying circuits, we need to reduce Boolean expressions to simpler ones.
`Simple' means that the expression has fewer connectives, and all the literals involved are distinct.
We illustrate this technique now.
Example : Reduce the following Boolean expressions to a simpler form.
X(x1, x2 ) = (x1 ∧ x2 ) ∧ (x1 ∧ x'2 );
Solution: (a) Here we can write
(x1 ∧ x2 ) ∧ (x1 ∧ x'2 ) = ((x1 ∧ x2 ) ∧ x1 ) ∧ x'2 (Associative law)
= (x1 ∧ x2) ∧ x'2 (Absorption law)
= x1 ∧ (x2 ∧ x'2 ) (Associative law)
= x1 ∧ (Complementation law)
O. (Identity law)
Thus, in its simplified form, the expression given in (a) above is O, i.e., a null expression.
b) If p and q are statements, show whether the statement [(~p→q)  (q)] → (p  ~q)
is a tautology or not.
Ans : Tautology :
A compound proposition that is true for all possible truth values of the simple propositions
involved in it is called a tautology.
p q ~p ~q ~p ->q [(~p→q)  (q)] (p  ~q) [(~p→q)  (q)] → (p  ~q)
0 0 1 1 0 0 1 1
0 1 1 0 1 1 0 0
1 0 0 1 1 0 1 1
1 1 0 0 1 1 1 1
Question 4:
Marks (4 + 4 +2)
a) Make logic circuit for the following Boolean expressions:
i) (x′.y + z) + (x+y+z)′ +(x+y+z)
X Y Z
O
ii) ( x'+y).(y′+ z).(y+z′+x′)
X Y Z
O
b) What is dual of a Boolean expression? Find dual of boolean expression of the
output of the following logic circuit:
Ans: If p is a proposition involving ~, ∧ and , the dual of p, denoted by pd, is the proposition
obtained by replacing each occurrence of ∧ (and/or ) in p by ∨ (and/or , respectively) in pd .
For example, x ∨ (x ∧ y) = x is the dual of x (x ∨ y) = x.
The principle of duality: If s is a theorem about a Boolean algebra, then so is its dual sd .
Corresponding dual expressions of given figures:
Fig(a) : Given expression = [{(A’ + B) + B’}’ . C]’
Dual of expression = [{(A’. B) . B’}’ + C]’
Fig(b) : Given expression = [(A.B)+{(B’+C)}’]’
Dual of expression = [(A+B).{(B’.C)}’]’
c) Set A,B and C are:
A = {1, 2, 3, 4, 5,6,9,19,15}, B = { 1,2,5,22,33,99 } and C { 2, 5,11,19,15},
Find A  B C and A   C
Ans : A  B C => {1,2,5}U{2,5,11,19,15}
 {1,2,5,11,19,15}
  C => {1,2,3,4,5,6,9,19,15,22,33,99} U {2,5,11,15,19}
 {1,2,3,4,5,6,9,11,15,19,22,33,99}
Question 5: Marks (3+4 +4)
a) Draw a Venn diagram to represent followings:
i) (A  B)  (C~B)
A B
C
U
ii) (A  B)  (B  C)
A B C
b) Give geometric representation for following
i) R x { 3}
321
-3-2-10123
-1
-2
-3
Y
X
ii) {-1, -2) x (-3, -3)
321 -
3
-
2
-
1
0
1
2
3
-1
-2
-3
Y
X
(-1,-3)
(-2,-3)
c) What is counterexample? Explain the use of counterexample with the help of an example.
Ans:
In logic, and especially in its applications to mathematics and philosophy, a counterexample is an exception to a
proposed general rule. For example, consider the proposition "all students are lazy". Because this statement makes
the claim that a certain property (laziness) holds for all students, even a single example of a diligent student will
prove it false. Thus, any hard-working student is a counterexample to "all students are lazy". More precisely, a
counterexample is a specific instance of the falsity of a universal quantification (a "for all" statement).
In mathematics, this term is (by a slight abuse) also sometimes used for examples illustrating the necessity of the full
hypothesis of a theorem, by considering a case where a part of the hypothesis is not verified, and where one can
show that the conclusion does not hold.[citation needed]A counterexample may be local or global in an argument.
eg
Suppose that a mathematician is studying geometry and shapes, and she wishes to prove certain theorems about
them. She conjectures that "All rectangles are squares". She can either attempt to prove the truth of this statement
using deductive reasoning, or if she suspects that her conjecture is false, she might attempt to find a counterexample.
In this case, a counterexample would be a rectangle that is not a square, like a rectangle with two sides of length 5
and two sides of length 7. However, despite having found rectangles that were not squares, all the rectangles she did
find had four sides. She then makes the new conjecture "All Rectangles have four sides". This is weaker than her
original conjecture, since every square has four sides, even though not every four-sided shape is a square.
The previous paragraph explained how a mathematician might weaken her conjecture in the face of
counterexamples, but counterexamples can also be used to show that the assumptions and hypothesis are needed.
Suppose that after a while the mathematician in question settled on the new conjecture "All shapes that are
rectangles and have four sides of equal length are squares". This conjecture has two parts to the hypothesis: the
shape must be 'a rectangle' and 'have four sides of equal length' and the mathematician would like to know if she can
remove either assumption and still maintain the truth of her conjecture. So she needs to check the truth of the
statements: (1) "All shapes that are rectangles are squares" and (2) "All shapes that have four sides of equal length
are squares". A counterexample to (1) was already given, and a counterexample to (2) is a parallelogram or a
diamond. Thus the mathematician sees that both assumptions were necessary.
Question 6:
Marks (5+4)
a) What is inclusion-exclusion principle? Also explain one application of inclusion-exclusion principle.
b) Find inverse of the following functions
i) f(x) =
3
3 5
x
x
 3
ii) f(x) =
4
7
2
3
x
x
 2
Question 7:
Marks ( 4 + 3 + 3)
a) Find how many 4 digit numbers are even? How many 4 digit numbers are composed of odd
digits.
Ans
4 digit numbers number means we have to put 0-9 digit at 4 places....ABCD
at the position of A (first place) we can put any digit 1-9 not 0, otherwise it will not a 4 digit number, so by
9 ways
at the position of B (second place) we can put 0-9 i.e by 10 ways...
at the position of C (third place) we can put 0-9 i.e by 10 ways...
at the position of D (fourth place) we can put 0,2,4,6 or 8 i.e by 5 ways...
so, total no. of digit = 9*10*10*5 = 4500
Total no. of four digit even numbers =4500
Ii)
Since we need only those four digit numbers ,whose digits are odd,
This can be in following ways
There can only be 1,3,5,7,9 numbers at each place in following ways
First place= 5ways
Second place = 5 ways
Third place=5 ways
Fourth place=5ways
So total numbers = 5x5x5x5=625
b) How many different 15 persons committees can be formed each containing at least
2 Accountants and at least 3 Managers from a set of 10 Accountants and 12 Managers.
Ans:
3 Accountants and 12 Managers in C(10,3)*C(12,12)=120 WAYS
4 Accountants and 11 Managers in C(10,4)*C(12,11)=2520 WAYS
5 Accountants and 10 Managers in C(10,5)*C(12,10) =16632 ways
6 " and 9 " in C(10,6)*C(12,9)=46200 ways
7 " and 8 " in C(10,7)*C(12,8)=59400 ways
8 " and 7 " in C(10,8)*C(12,7)=35640 ways
9 " and 6 " in C(10,9)*C(12,6)=9240 ways
10 " and 5 " in C (10,10)*C(12,5)=792 ways
therefore different committees can be formed in
(120+2520+16632+46200+59400+35640+9240+792)= 170544 ways
b) What is a function? Explain one to one mapping with an example.
Question 8:
Marks ( 4 +4 +2)
a) What is Demorgan’s Law? Also explain the use of Demorgen’s law with example?
b) How many ways are there to distribute 15 district object into 5 distinct boxes with
i) At least two empty box.
Ans: 15P3= 15!/(15-3)!
15!/12! = 2730
ii) No empty box.
Ans c(15,5)=15!/5!(15-5)!
= 21 x 13x 11
= 3003
c) In a fifteen question true false examination a student must achieve five correct
answers to pass. If student answer randomly what is the probability that student will fail.
Ans:
5C1 + 5C2 + 5C3 +5C4+ 5C5
so, n(s) = 15C5
so, P(E) = (5C1 + 5C2 + 5C3 +5C4+ 5C5)/(15C5)
= (5+10+10+5+1)/2983
= 0.010