250+ TOP MCQs on Number Theory – Primes and Greatest Common Divisors

Discrete Mathematics Multiple Choice Questions on “Number Theory – Primes and Greatest Common Divisors”.

1. The prime factorization of 7007 is __________
a) 73.11.13
b) 72.11.13
c) 7.11.13
d) 7.113.13

Answer: b
Clarification: Perform successive division beginning with 2.

2. Out of following which one is Mersenne Primes?
a) 3
b) 7
c) 2047
d) 31

Answer: c
Clarification: 2047 = 23.89 also not in form of 2b-1 form.

3. Out of the following which of these integers is not prime?
a) 21
b) 35
c) 71
d) 101

Answer: b
Clarification: 35 = 5.7 which is the product of two prime numbers.

4. The prime factorization of 1001 is __________
a) 73.11.13
b) 72.11.13
c) 7.11.13
d) 7.113.13

Answer: c
Clarification: Perform successive division beginning with 2.

5. Which positive integer less than 21 are relatively prime to 21?
a) 18
b) 19
c) 21
d) 24

Answer: b
Clarification: gcd(19,21) = 1. According to the definition of relatively prime gcd of two numbers is 1.

6. Is 7, 8, 9, 11 are pairwise relatively prime.
a) True
b) False

Answer: a
Clarification: gcd(7, 9) = gcd(8, 9) = gcd(9, 11) = gcd(11, 7) = 1. The numbers 7 and 11 are prime and numbers 8 and 9 are relatively prime.

7. The greatest common divisor of 313.517 and 212.35 is __________
a) 30
b) 31
c) 33
d) 35

Answer: d
Clarification: gcd(a, b) = 3min(13, 5).5min(17, 0).2min(12, 0).

8. The greatest common divisor of 0 and 5 is ___________
a) 0
b) 1
c) 2
d) 5

Answer: b
Clarification: gcd(0, 5) = 0min(1, 0).5min(0, 1).

9. The lcm of 3 and 21 is ________ if gcd(3,21)=3.
a) 3
b) 12
c) 21
d) 42

Answer: c
Clarification: 3 * lcm(3, 21) = 63 hence, lcm(3, 21) = 63 / 3 = 21.

10. The least common multiple of 41.42 and 42.41 is ____________
a) 42
b) 41
c) 84
d) 41.42

Answer: d
Clarification: lcm(41 * 42, 42 * 42) = 41.42.42.41 / 41.42 = 41.42.

250+ TOP MCQs on Counting – Derangements and Answers

Discrete Mathematics Multiple Choice Questions on “Counting – Derangements”.

1. Determine the number of derangements of (2, 4, 6, 1, 3, 5) that end with integer 2, 4 and 6 in some order?
a) 128
b) 29
c) 54
d) 36

Answer: d
Clarification: The place of 2, 4, 6 is specified i.e. each of them will get their place out of the last 3 places only. So 1, 3, 5 will automatically get one of the places in the first 3 places. This must ensure that 2, 4 and 6 occupies one of the last 3 places each and 1, 3 and 5 one of 1st 3 places each. Hence, 1, 3 and 5 can be arranged in 3! ways and 2, 4 and 6 also in 3! Ways. So, no of such derangements = 3! * 3! = 6 * 6 = 36.

2. A nursery teacher has 5 pencil boxes to give out to her five students. Determine the probability that at least one student gets their name tag?
a) (frac{19}{30})
b) (frac{26}{47})
c) (frac{123}{537})
d) (frac{12}{79})

Answer: a
Clarification: There are 5!= 120 ways to give out the pencil boxes. By using complementary probability, the number of ways where nobody gets their pencil boxes is
5!((frac{1}{0!} – frac{1}{1!} + … – frac{1}{5!}))
= 44. Hence, the required probability is (frac{120 – 44}{120} = frac{19}{30}).

3. Farhan has received 9 gifts from 9 different people. In how many ways can Farhan receives the gifts such that no one gives him real gifts?
a) 133496
b) 326654
c) 218744
d) 745331

Answer: a
Clarification: By the derangements formula, the number of possible derangements should be 9!((frac{1}{0!} – frac{1}{1!} + … – frac{1}{9!})) = 133496. Hence, there are a total of ways to give the gifts to him such that no one distributes the real gifts.

4. There are 7 groups in a picnic who has brought their own lunch box, and then the 7 lunch box are exchanged within those groups. Determine the number of ways that they can exchange the lunch box such that none of them can get their own.
a) 655
b) 328
c) 1854
d) 3765

Answer: c
Clarification: This can be solved by the derangement formula:
!n = n!(1 – (frac{1}{1!} + frac{1}{2!} – frac{1}{3!} + … + frac{(-1)^n1}{n!})) ⇒ 7! = 1854.

5. Computational complexity of derangements is of __________
a) NP-complete
b) NP-hard
c) NP
d) P

Answer: a
Clarification: Computational complexity of derangements is NP-complete in order to determine whether a given permutation group consists of any derangements or not.

6. There are 5 different-colored boxes in a room each with a distinct cover. Find out the number of ways so that these covers can be put on the boxes such that none of the boxes can have right covers on it? (Assume that all the covers must be on the boxes).
a) 208
b) 137
c) 239
d) 24

Answer: d
Clarification: Let the box covers be A, B, C, D and E. The possible ways for the covers to not be in the exact order of A, B, C, D, E are: 4! = 24 ways. (Since correct order i.e., A, B, C, D and E must be eliminated from such arrangements).

7. A postman can put 12 letters into their respective envelopes such that exactly 5 will go into the right envelope. Find the number of ways of doing this work.
a) 2984300
b) 1610496
c) 5322167
d) 3768650

Answer: b
Clarification: The number of ways in which the 5 correct envelopes can be selected = 12C5 = 864
Derangement of the remaining 7 envelopes & letters = 1864 (derangement value for 7 is 1864)
Total No of ways of arrangement = 1864 * 864 = 1610496.

8. Determine the number of ways In a single competition a singing couple from 5 boys and 5 girls can be formed so that no girl can sing a song with their respective boy?
a) 123
b) 44
c) 320
d) 21

Answer: b
Clarification: This is a case of derangement of 5 boys and 5 girls. The required number of ways can be described as D = 5! (1 – (frac{1}{1!} + frac{1}{2!} – frac{1}{3!} + frac{1}{4!} – frac{1}{5!}) = 120(frac{11}{30})) = 44 ways.

9. What is the sum of all 6 digit numbers which can be formed using the digits 2, 3, 5, 6 and 9 exactly once?
a) 986546600
b) 25611866
c) 433338798
d) 319999680

Answer: d
Clarification: Note that sum of all possible numbers = (n-1)!(sum of the digits involved)(1111…n times), where n is the number of digits. Here n = 6, we have (6-1)!(2+3+5+6+9)(111111) = 5!*(24)*(111111) = 319999680.

10. Determine the average of all four digit numbers that can be made using all the digits 2, 3, 5, 7 and 11 exactly once?
a) 3993
b) 1555
c) 5486
d) 1347

Answer: b
Clarification: First we need to find the sum of all possible numbers and then divide it by the total such numbers possible to gain an average of all the numbers. So, we have (n-1)!(sum of digits)(1111…n times)/n!. Here n = 4. Therefore, (5-1)!(2+3+5+7+11)(1111)/5! = 1555.

250+ TOP MCQs on Types of Relations and Answers

Discrete Mathematics Multiple Choice Questions on “Types of Relations”.

1. The binary relation {(1,1), (2,1), (2,2), (2,3), (2,4), (3,1), (3,2)} on the set {1, 2, 3} is __________
a) reflective, symmetric and transitive
b) irreflexive, symmetric and transitive
c) neither reflective, nor irreflexive but transitive
d) irreflexive and antisymmetric

Answer: c
Clarification: Not reflexive -> (3,3) not present; not irreflexive -> (1, 1) is present; not symmetric -> (2, 1) is present but not (1, 2); not antisymmetric – (2, 3) and (3, 2) are present; not asymmetric -> asymmetry requires both antisymmetry and irreflexivity. So, it is transitive closure of relation.

2. Consider the relation: R’ (x, y) if and only if x, y>0 over the set of non-zero rational numbers,then R’ is _________
a) not equivalence relation
b) an equivalence relation
c) transitive and asymmetry relation
d) reflexive and antisymmetric relation

Answer: b
Clarification: Reflexive: a, a>0
Symmetric: if a, b>0 then both must be +ve or -ve, which means b, a > 0 also exists
Transitive: if a, b>0 and b, c>0 then to have b as same number, both pairs must be +ve or -ve which implies a, c>0. Hence, R’ is an equivalence relation.

3. Let S be a set of n>0 elements. Let be the number Br of binary relations on S and let Bf be the number of functions from S to S. The expression for Br and Bf, in terms of n should be ____________
a) n2 and 2(n+1)2
b) n3 and n(n+1)
c) n and n(n+6)
d) 2(n*n) and nn

Answer: d
Clarification: For a set with n elements the number of binary relations should be 2(n*n) and the number of functions should be nn. Hence Br = 2(n*n) and Bf = nn.

4. Let A be a set of k (k>0) elements. Which is larger between the number of binary relations (say, Nr) on A and the number of functions (say, Nf) from A to A?
a) number of relations
b) number of functions
c) the element set
d) number of subsets of the relation

Answer: a
Clarification: For a set with k elements the number of binary relations should be 2(n*n) and the number of functions should be nn. Now, 2(n*n) => n2log (2) [taking log] and nn => nlog (n) [taking log]. It is known that n2log (2) > nlog (n). Hence, the number of binary relations > the number of functions i.e, Nr > Nf.

5. Consider the binary relation, A = {(a,b) | b = a – 1 and a, b belong to {1, 2, 3}}. The reflexive transitive closure of A is?
a) {(a,b) | a >= b and a, b belong to {1, 2, 3}}
b) {(a,b) | a > b and a, b belong to {1, 2, 3}}
c) {(a,b) | a <= b and a, b belong to {1, 2, 3}}
d) {(a,b) | a = b and a, b belong to {1, 2, 3}}

Answer: a
Clarification: By definition of Transitive closure we have that a is related to all smaller b (as every a is related to b – 1) and from the reflexive property a is related to a.

6. Let R1 be a relation from A = {1, 3, 5, 7} to B = {2, 4, 6, 8} and R2 be another relation from B to C = {1, 2, 3, 4} as defined below:
i. An element a in A is related to an element b in B (under R1) if a * b is divisible by 3.
ii. An element a in B is related to an element b in C (under R2) if a * b is even but not divisible by 3. Which is the composite relation R1R2 from A to C?
a) R1R2 = {(1, 2), (1, 4), (3, 3), (5, 4), (5,6), (7, 3)}
b) Φ
c) R1R2 = {(1, 2), (1,6), (3, 2), (3, 4), (5, 4), (7, 2)}
d) R1R2 = {(2,2), (3, 2), (3, 4), (5, 1), (5, 3), (7, 1)}

Answer: b
Clarification: By definition, i) R1 = {(1,6), (3,2), (3,4), (3,6), (3,8), (5,6), (7,6)} and ii) R2 = {(1,2), (1,4), (1,8), (5,2), (5,4), (5,8), (7,2), (7,4), (7,8)}. So, R1R2 = Φ.

7. The time complexity of computing the transitive closure of a binary relation on a set of n elements should be ________
a) O(n)
b) O(logn)
c) O(n(n+(3/2)))
d) O(n3)

Answer: d
Clarification: Calculation of transitive closure results into matrix multiplication. We can do matrix multiplication in O(n3) time. There are better algorithms that do less than cubic time.

8. Let A and B be two non-empty relations on a set S. Which of the following statements is false?
a) A and B are transitive ⇒ A∩B is transitive
b) A and B are symmetric ⇒ A∪B is symmetric
c) A and B are transitive ⇒ A∪B is not transitive
d) A and B are reflexive ⇒ A∩B is reflexive

Answer: c
Clarification: In terms of set theory, the binary relation R defined on the set X is a transitive relation if, for all a, b, c ∈ X, if aRb and bRc, then aRc. If there are two relations on a set satisfying transitive property then there union must satisfy transitive property.

9. Determine the characteristics of the relation aRb if a2 = b2.
a) Transitive and symmetric
b) Reflexive and asymmetry
c) Trichotomy, antisymmetry, and irreflexive
d) Symmetric, Reflexive, and transitive

Answer: d
Clarification: Since, x2 = y2 is just a special case of equality, so all properties that apply to x = y also apply to this case. Hence, the relation satisfies symmetric, reflexive and transitive closure.

10. Let R be a relation between A and B. R is asymmetric if and only if ________
a) Intersection of D(A) and R is empty, where D(A) represents diagonal of set
b) R-1 is a subset of R, where R-1 represents inverse of R
c) Intersection of R and R-1 is D(A)
d) D(A) is a subset of R, where D(A) represents diagonal of set

Answer: a
Clarification: A relation is asymmetric if and only if it is both antisymmetric and irreflexive. As a consequence, a relation is transitive and asymmetric if and only if it is a strict partial order. If D(A) is a diagonal of A set and intersection of D(A) and R is empty, then R is asymmetric.

250+ TOP MCQs on Trees – Interconversion for Prefix Postfix Infix Notations

Discrete Mathematics Question Paper on “Trees – Interconversion for Prefix Postfix Infix Notations”.

1. Evaluation of expression a/b+c*d-e in postfix notation.
a) ab+cd/*-e
b) ab/cd*+e-
c) abc/+d*-e
d) abcd/+*-e

Answer: b
Clarification: The expression=a/b+c*d-e
={(ab/)+(cd*)}-e
={(ab/)(cd*)+}-e
={(ab/)(cd*)+}e-
So the output is: ab/cd*+e-

2. Evaluation of 4*5+3/2-9 in prefix notation.
a) *45-/32+9
b) *+453/-29
c) -+*45/329
d) *+/45932

Answer: c
Clarification: The expression=4*5+3/2-9
={(4*5)+(3/2)-9}
={(*45)+(/32)-9}
={+(*45)(/32)}-9
=-{+(*45)(/32)9
So the output is; -+*45/329.

3. What is the output of the following if funct1(7)?

Void main()
{
    int n;
    long int func;
    scanf(“%d”,&n);
    func=func1 (n)
    printf(“%ld!=%ld”,n,func);
}
long int func1(int n)
{
    if(n==0)
    {
        Return 1;
    }
    else
    {
        return(n*func1(n-1));
    }
}

a) 128
b) 4320
c) 720
d) 5040

Answer: d
Clarification: This is a factorial function of an integer using recursive approach. By running the function on integer 7 we get 5040.

4. Infix to prefix conversion can be done using __________
a) two queues
b) two stacks
c) one stack and two queues
d) one stack

Answer: b
Clarification: In the infix expression, the operator appears between the operands and in infix notation if the operator appears before the operands in the expression. For the conversion between them two stacks are used efficiently. The idea is to use one stack for operators and other to store operands.

5. Conversion from prefix to postfix expression can be done _______________
a) using bubble sort
b) using radix sort
c) using two queues
d) in a direct manner

Answer: d
Clarification: In a postfix expression, the operators appear after the operands. Conversion from prefix to postfix is done directly which is better than converting the prefix expression in infix and then infix to postfix expression. It gives better efficiency.

6. What is the postfix expression of 9+3*5/(10-4)?
a) 9 3 + * 5 / 10 4 –
b) 9 3 5 + * / 10 4 –
c) 9 3 + 5 * / 10 4 –
d) 9 3 5 * / + 10 – 4

Answer: c
Clarification: The expression, 9+3*5/(10-4)
= 9+3*5/(10 4-)
= 9+35/*(10 4-)
= 935/*+(10 4-)
So the output is:9 3 5 / * + 10 4 -.

7. What is the postfix expression of (A+B)-C*(D/E))+F?
a) A B + C D E / * – F +
b) A B C D E + / * F – +
c) A B C + * D E / F + –
d) A B + C – * D E / F +

Answer: a
Clarification: The expression is (A+B)-C*(D/E))+F
= (A+B)-C*(DE/)+F
= (A+B)-C*(DE/)F+
= (A+B)-C(DE/)*F+
= (A+B)C(DE/)*-F+
= (AB+)C(DE/)*-F+
So the output is: AB+CDE/*-F+.

8. Convert the following expression into prefix notation.

(g-(f^e/d+c)-ba)

a) ^-/gfed+c-ab
b) -ab/+-ec^dgf
c) -ab-+c/d^efg
d) ab/+-^cde-fg

Answer: c
Clarification: Convert it first in postfix notation, we can have
(g-(f^e/d+c)-ba)
= (g-(f^e/dc+)-ba)
= (g-(f^ed/c+)-ba)
= (g-(fe^d/c+)-ba)
= (g-(fe^d/c+)ba-)
= (gfe^d/c+-ba-)
By reversing this expression gives the prefix expression, i.e
-ab-+c/d^efg.

9. What is the postfix expression of the given expression, (2*4-(5+7/3^4)-8)10?
a) 2 4 5 * 7 3 4 ^ / + 8 – – 10
b) 2 4 * ^ 5 7 3 4 / + 8 10 – –
c) 2 4 * 5 7 ^ 3 4 / + – 8 10 –
d) 2 4 * 5 7 3 4 ^ / + – 8 – 10

Answer: d
Clarification: By solving we can have,
(2*4-(5+7/3^4)-8)10
= (2*4-(5+7/34^)-8)10
= (2*4-(5+734^/)-8)10
= (2*4-(5734^/+)-8)10
= (2*45734^/+–8)10
= 2*45734^/+-8-10
= 24*5734^/+-8-10
So the output is: 2 4 * 5 7 3 4 ^ / + – 8 – 10.

10. Prefix expression can be evaluated _________
a) from right to left
b) from left to right
c) from the exact middle
d) from second right element

Answer: b
Clarification: Expressions are usually evaluated from left to right manner. Prefix expressions follow the normal rule i.e from left to right. Postfix expressions can be evaluated from right to left.

250+ TOP MCQs on Permutation Groups and Answers

Discrete Mathematics Multiple Choice Questions on “Permutation Groups”.

1. Consider an integer 23 such that 23 >= 3p for a 2p-cycle in a permutation group, then p is ___________
a) odd prime
b) even prime
c) rational number
d) negative prime

Answer: a
Clarification: Let n an integer such that n>=3p and m is a 2p-cycle in the permutation group, then p is an odd prime.

2. Suppose Km={P∈Sm|, |P| is odd prime}. Determine the set for which m≥3 Km a subgroup of Sm.
a) {3, 5, 7, 11, 13, …}
b) {-14, -8, -3, 0, 3, 8, 14}
c) {2, 4, 6, 8, 10, 12}
d) {12, 25, 56, 78, 134,…}

Answer: a
Clarification: Since Km is a subset of Sm, then the set will be {3, 5, 7, 11, 13, …}.

3. The dihedral group having order 6 can have degree _____________
a) 3
b) 26
c) 326
d) 208

Answer: a
Clarification: A symmetric group on a set of three elements is said to be the group of all permutations of a three-element set. It is a dihedral group of order six having degree three.

4. Let (z, *) is a group with x*y=x+y-2 then inverse of x is ___________
a) -(x+4)
b) (x2+6)
c) (x+y)/5
d) (3y+4x2)

Answer: a
Clarification: Let, Identity element I, x*I = I*x = x ⇒ x = x + I – 2 ⇒ I = 2. Inverse of x is x-1
Now, x*x-1 = I
⇒ x + x-1 – 2 = 2
⇒ x-1 = -(x+4).

5. Let X be a n-square matrix such that Y = X + 8I. Which of the following property will exist?
a) idempotent
b) Y transpose is nilpotent
c) X nilpotent
d) Y inverse

Answer: b
Clarification: Suppose, we have a matrix
(a=begin{bmatrix}
1 & 0\
2 & 1\
end{bmatrix} )
then Y2 will not resulting in Y, hence it is not idempotent, Y2 is not 0 and so it is not nilpotent. But, as Y is a square matrix, by the property inverse will exist in this case.

6. Suppose, M is a lower triangular matrix with all diagonal entries zero. The resultant matrix of M+I will be ___________
a) idempotent
b) singular
c) nilpotent
d) inverse

Answer: b
Clarification: Since, M is a lower triangular matrix with diagonal elements zero, then we add I and it will result in a lower triangular matrix with all diagonal entries 1. Thus, all eigenvalues M+I are non zero (eigenvalues of triangular matrix is the diagonal elements). So, determinant will never be zero. Hence, the matrix can have inverse property.

7. If Y98 (a raised to the power of 5) = 0 and Y is a 97-square matrix. Determine the value of Y97.
a) I+Y
b) -Y+3
c) 0
d) Y2

Answer: c
Clarification: Question does not provide any notion of existing an inverse property or related to rank matrix. Hence, by considering zero matrix as Y and that satisfy all the constraints.

8. If 54th row of a 67th row matrix is linearly independent with each other then find the rank of the matrix.
a) 61
b) 54
c) 187
d) 32

Answer: b
Clarification: If kth row of a matrix with nth row is linearly independent then the rank of that matrix is k. If we take the transpose of a matrix the rank does not change. Hence, the answer is 54 in this case.

9. Let M be an 4×4 matrix with real entries such that Mk=0, for some k≥1. Find the determinant value of (I+M), where, I be the 4 x 4 identity matrix.
a) 72
b) 1
c) 4
d) 36

Answer: b
Clarification: By cayley hamilton theorem, M4 = 0. So, characteristic equation should be λ*4=0 and after solving we get 0 for every eigen value. Eigen values of (I+M) = Individual Eigen value of 1+m. So all the eigen values of (I+M) are 1 and Det(I+A) = 1.

10. Suppose (2, 5, 8, 4) and (3, 6) are the two permutation groups that form cycles. What type of permutation is this?
a) odd
b) even
c) acyclic
d) prime

Answer: b
Clarification: There are four permutations (2, 5), (2, 8), (2, 4) and (3, 6) and so it is an even permutation.

250+ TOP MCQs on Logics and Proofs – De-Morgan’s Laws and Answers

Discrete Mathematics Multiple Choice Questions on “Logics and Proofs – De-Morgan’s Laws”.

1. Which of the following statements is the negation of the statements “4 is odd or -9 is positive”?
a) 4 is even or -9 is not negative
b) 4 is odd or -9 is not negative
c) 4 is even and -9 is negative
d) 4 is odd and -9 is not negative

Answer: c
Clarification: Using De Morgan’s Law ~(A V B) ↔ ~A ∧ ~B.

2. Which of the following represents: ~A (negation of A) if A stands for “I like badminton but hate maths”?
a) I hate badminton and maths
b) I do not like badminton or maths
c) I dislike badminton but love maths
d) I hate badminton or like maths

Answer: d
Clarification: De Morgan’s Law ~ (A ∧ B) ↔ ~A V ~B.

3. The compound statement A v ~(A ∧ B).
a) True
b) False

Answer: a
Clarification: Applying De-Morgan’s law we get A v ~ A Ξ Tautology.

4. Which of the following is De-Morgan’s law?
a) P ∧ (Q v R) Ξ (P ∧ Q) v (P ∧ R)
b) ~(P ∧ R) Ξ ~P v ~R, ~(P v R) Ξ ~P ∧ ~R
c) P v ~P Ξ True, P ∧ ~P Ξ False
d) None of the mentioned

Answer: b
Clarification: Definition of De–Morgan’s Law.

5. What is the dual of (A ∧ B) v (C ∧ D)?
a) (A V B) v (C v D)
b) (A V B) ^ (C v D)
c) (A V B) v (C ∧ D)
d) (A ∧ B) v (C v D)

Answer: b
Clarification: In dual ∧ is replaced by v and vice – versa.

6. ~ A v ~ B is logically equivalent to?
a) ~ A → ~ B
b) ~ A ∧ ~ B
c) A → ~B
d) B V A

Answer: c
Clarification: By identity A → B Ξ ~A V B.

7. Negation of statement (A ∧ B) → (B ∧ C) is _____________
a) (A ∧ B) →(~B ∧ ~C)
b) ~(A ∧ B) v ( B v C)
c) ~(A →B) →(~B ∧ C)
d) None of the mentioned

Answer: a
Clarification: ~(A →B) Ξ A ∧ ~B using this we can easily fetch the answer.

8. Which of the following satisfies commutative law?
a) ∧
b) v
c) ↔
d) All of the mentioned

Answer: d
Clarification: All of them satisfies commutative law.

9. If the truth value of A v B is true, then truth value of ~A ∧ B can be ___________
a) True if A is false
b) False if A is false
c) False if B is true and A is false
d) None of the mentioned

Answer: a
Clarification: If A is false then both the condition are obeyed.

10. If P is always against the testimony of Q, then the compound statement P→(P v ~Q) is a __________
a) Tautology
b) Contradiction
c) Contingency
d) None of the mentioned

Answer: a
Clarification: Since either hypothesis is false or both (hypothesis as well as conclusion) are true.