Updated: Mar 2026
First Chapter - 100% FREE

GATE CS Chapter-wise PYQs

Practice GATE CS previous year questions organized by chapter. 428+ PYQs from 8 years with detailed solutions. First chapter FREE!

428+
Total PYQs
8
Years
62
Chapters
FREE
First Chapter
Start Free Test →

Year-wise PYQ Distribution

2025.2
54
2025.1
55
2024.2
29
2024.1
77
2023.1
54
2022.1
49
2021.2
55
2021.1
55

All Chapters

Combinatorics

FREE

Engineering Mathematics • 12 PYQs

Start Free

Graph Theory

Engineering Mathematics • 11 PYQs

Unlock

Propositional and First-Order Logic

Engineering Mathematics • 6 PYQs

Unlock

Algebraic Structures

Engineering Mathematics • 6 PYQs

Unlock

Set Theory, Relations, and Functions

Engineering Mathematics • 5 PYQs

Unlock

LU Decomposition

Engineering Mathematics • 2 PYQs

Unlock

Matrices and Determinants

Engineering Mathematics • 6 PYQs

Unlock

System of Linear Equations

Engineering Mathematics • 3 PYQs

Unlock

Eigenvalues and Eigenvectors

Engineering Mathematics • 5 PYQs

Unlock

Limits, Continuity, and Differentiability

Engineering Mathematics • 3 PYQs

Unlock

Integration

Engineering Mathematics • 3 PYQs

Unlock

Applications of Differentiation

Engineering Mathematics • 2 PYQs

Unlock

Probability Distributions

Engineering Mathematics • 5 PYQs

Unlock

Probability Theory

Engineering Mathematics • 10 PYQs

Unlock

Boolean Algebra and Minimization

Digital Logic • 11 PYQs

Unlock

Sequential Circuits

Digital Logic • 6 PYQs

Unlock

Combinational Circuits

Digital Logic • 5 PYQs

Unlock

Computer Arithmetic

Digital Logic • 3 PYQs

Unlock

Number Representations

Digital Logic • 12 PYQs

Unlock

CPU Components

Computer Organization and Architecture • 1 PYQs

Unlock

Combinatorics - PYQs

Free sample questions from Engineering Mathematics

100% FREE
1 Single Choice
2025.1
Consider the following recurrence relation:
T(n)=2T(n1)+n2nT(n) = 2T(n - 1) + n2^n
for n>0n > 0, with T(0)=1T(0) = 1. Which ONE of the following options is CORRECT?
A
T(n)=Θ(n22n)T(n) = \Theta(n^2 2^n)
B
T(n)=Θ(n2n)T(n) = \Theta(n 2^n)
C
T(n)=Θ((logn)22n)T(n) = \Theta((\log n)^2 2^n)
D
T(n)=Θ(4n)T(n) = \Theta(4^n)
View Solution
**Solution:** 1. The given recurrence relation is:
T(n)=2T(n1)+n2nT(n) = 2T(n - 1) + n2^n
with the base case T(0)=1T(0) = 1. 2. We solve this recurrence by unrolling it.
T(n)=2T(n1)+n2nT(n) = 2T(n-1) + n2^n
Substitute T(n1)T(n-1):
T(n)=2(2T(n2)+(n1)2n1)+n2nT(n) = 2(2T(n-2) + (n-1)2^{n-1}) + n2^n
T(n)=22T(n2)+(n1)2n+n2nT(n) = 2^2 T(n-2) + (n-1)2^n + n2^n
Substitute T(n2)T(n-2):
T(n)=22(2T(n3)+(n2)2n2)+(n1)2n+n2nT(n) = 2^2(2T(n-3) + (n-2)2^{n-2}) + (n-1)2^n + n2^n
T(n)=23T(n3)+(n2)2n+(n1)2n+n2nT(n) = 2^3 T(n-3) + (n-2)2^n + (n-1)2^n + n2^n
3. Generalizing this pattern for kk steps, we observe:
T(n)=2kT(nk)+i=0k1(ni)2nT(n) = 2^k T(n-k) + \sum_{i=0}^{k-1} (n-i)2^n
4. To reach the base case T(0)T(0), we set nk=0n-k = 0, which implies k=nk=n. Substitute k=nk=n into the generalized equation:
T(n)=2nT(nn)+i=0n1(ni)2nT(n) = 2^n T(n-n) + \sum_{i=0}^{n-1} (n-i)2^n
T(n)=2nT(0)+2ni=0n1(ni)T(n) = 2^n T(0) + 2^n \sum_{i=0}^{n-1} (n-i)
5. Given T(0)=1T(0) = 1, substitute this value:
T(n)=2n1+2ni=0n1(ni)T(n) = 2^n \cdot 1 + 2^n \sum_{i=0}^{n-1} (n-i)
T(n)=2n+2ni=0n1(ni)T(n) = 2^n + 2^n \sum_{i=0}^{n-1} (n-i)
6. Evaluate the sum i=0n1(ni)\sum_{i=0}^{n-1} (n-i). Let j=nij = n-i. When i=0i=0, j=nj=n. When i=n1i=n-1, j=n(n1)=1j=n-(n-1) = 1. So the sum becomes j=1nj\sum_{j=1}^{n} j. The sum of the first nn natural numbers is n(n+1)2\frac{n(n+1)}{2}.
j=1nj=n(n+1)2\sum_{j=1}^{n} j = \frac{n(n+1)}{2}
7. Substitute the sum back into the expression for T(n)T(n):
T(n)=2n+2n(n(n+1)2)T(n) = 2^n + 2^n \left(\frac{n(n+1)}{2}\right)
T(n)=2n(1+n(n+1)2)T(n) = 2^n \left(1 + \frac{n(n+1)}{2}\right)
T(n)=2n(2+n2+n2)T(n) = 2^n \left(\frac{2 + n^2 + n}{2}\right)
T(n)=12(n2+n+2)2nT(n) = \frac{1}{2} (n^2 + n + 2) 2^n
8. Now, we determine the asymptotic complexity Θ(T(n))\Theta(T(n)). The highest power of nn in the polynomial (n2+n+2)(n^2 + n + 2) is n2n^2. Therefore, T(n)T(n) is asymptotically equivalent to n22nn^2 2^n.
T(n)=Θ(n22n)T(n) = \Theta(n^2 2^n)
9. Comparing this with the given options, the correct option is T(n)=Θ(n22n)T(n) = \Theta(n^2 2^n). Answer: \boxed{T(n) = \Theta(n^2 2^n)}
2 Numerical
2025.1
Let SS be the set of all ternary strings defined over the alphabet {a,b,c}\{a, b, c\}. Consider all strings in SS that contain at least one occurrence of two consecutive symbols, that is, “aa”, “bb” or “cc”. The number of such strings of length 5 that are possible is __________. (Answer in integer)
Correct Answer: 195
View Solution
**Solution:** **Step 1: Calculate the total number of ternary strings of length 5.** The alphabet is {a,b,c}\{a, b, c\}, which has 3 symbols. The length of the string is 5. For each position in the string, there are 3 choices.
Total number of strings=35\text{Total number of strings} = 3^5
35=2433^5 = 243
**Step 2: Calculate the number of ternary strings of length 5 that contain NO consecutive identical symbols.** Let the string be s1s2s3s4s5s_1 s_2 s_3 s_4 s_5. For the first position (s1s_1), there are 3 choices (a, b, or c). For the second position (s2s_2), it cannot be the same as s1s_1, so there are 2 choices. For the third position (s3s_3), it cannot be the same as s2s_2, so there are 2 choices. For the fourth position (s4s_4), it cannot be the same as s3s_3, so there are 2 choices. For the fifth position (s5s_5), it cannot be the same as s4s_4, so there are 2 choices.
Number of strings with no consecutive identical symbols=3×2×2×2×2\text{Number of strings with no consecutive identical symbols} = 3 \times 2 \times 2 \times 2 \times 2
=3×24= 3 \times 2^4
=3×16= 3 \times 16
=48= 48
**Step 3: Calculate the number of strings that contain at least one occurrence of two consecutive symbols.** This can be found by subtracting the number of strings with no consecutive identical symbols from the total number of strings.
Number of desired strings=Total number of stringsNumber of strings with no consecutive identical symbols\text{Number of desired strings} = \text{Total number of strings} - \text{Number of strings with no consecutive identical symbols}
=24348= 243 - 48
=195= 195
Answer: \boxed{195}
3 Single Choice
2024.1
Consider the following recurrence relation:
T(n)={nT(n)+nfor n1,1for n=1.T(n) = \begin{cases} \sqrt{n}T(\sqrt{n}) + n & \text{for } n \geq 1, \\ 1 & \text{for } n = 1. \end{cases}
Which one of the following options is CORRECT?
A
T(n)=Θ(nloglogn)T(n) = \Theta(n \log \log n)
B
T(n)=Θ(nlogn)T(n) = \Theta(n \log n)
C
T(n)=Θ(n2logn)T(n) = \Theta(n^2 \log n)
D
T(n)=Θ(n2loglogn)T(n) = \Theta(n^2 \log \log n)
View Solution
The given recurrence relation is:
T(n)={nT(n)+nfor n1,1for n=1.T(n) = \begin{cases} \sqrt{n}T(\sqrt{n}) + n & \text{for } n \geq 1, \\ 1 & \text{for } n = 1. \end{cases}
We need to find the asymptotic complexity of T(n)T(n). **Step 1: Change of variable** Let n=2kn = 2^k. This implies k=log2nk = \log_2 n. Then n=2k=2k/2\sqrt{n} = \sqrt{2^k} = 2^{k/2}. Substitute these into the recurrence relation for n1n \geq 1:
T(2k)=2k/2T(2k/2)+2kT(2^k) = 2^{k/2} T(2^{k/2}) + 2^k
**Step 2: Define a new function S(k)S(k)** Let S(k)=T(2k)S(k) = T(2^k). The recurrence relation can now be written in terms of S(k)S(k):
S(k)=2k/2S(k/2)+2kS(k) = 2^{k/2} S(k/2) + 2^k
**Step 3: Divide by 2k2^k** To simplify the recurrence, divide both sides by 2k2^k:
S(k)2k=2k/2S(k/2)2k+2k2k\frac{S(k)}{2^k} = \frac{2^{k/2} S(k/2)}{2^k} + \frac{2^k}{2^k}
S(k)2k=S(k/2)2k/2+1\frac{S(k)}{2^k} = \frac{S(k/2)}{2^{k/2}} + 1
**Step 4: Define another new function R(k)R(k)** Let R(k)=S(k)2kR(k) = \frac{S(k)}{2^k}. The recurrence relation simplifies to:
R(k)=R(k/2)+1R(k) = R(k/2) + 1
**Step 5: Solve the recurrence for R(k)R(k)** This is a standard recurrence relation. We can solve it by repeated substitution: \begin{align*} R(k) &= R(k/2) + 1 \\ &= (R(k/4) + 1) + 1 = R(k/4) + 2 \\ &= (R(k/8) + 1) + 2 = R(k/8) + 3 \\ & \quad \vdots \\ &= R(k/2^m) + m \end{align*} To find the asymptotic behavior, we continue this process until k/2mk/2^m reaches a constant base value (e.g., 11). If k/2m=1k/2^m = 1, then m=log2km = \log_2 k. Thus, R(k)=R(1)+log2kR(k) = R(1) + \log_2 k. Asymptotically, R(k)=Θ(logk)R(k) = \Theta(\log k). **Step 6: Substitute back to find T(n)T(n)** We have R(k)=S(k)2kR(k) = \frac{S(k)}{2^k}. So, S(k)=2kR(k)S(k) = 2^k R(k). Substituting R(k)=Θ(logk)R(k) = \Theta(\log k):
S(k)=2kΘ(logk)S(k) = 2^k \Theta(\log k)
Now, substitute back S(k)=T(2k)S(k) = T(2^k) and n=2kn = 2^k (which implies k=log2nk = \log_2 n):
T(n)=nΘ(log(log2n))T(n) = n \Theta(\log (\log_2 n))
Since log2(log2n)=ln(log2n)ln2\log_2 (\log_2 n) = \frac{\ln(\log_2 n)}{\ln 2}, and constant factors do not affect asymptotic notation, we have log2(log2n)=Θ(ln(log2n))\log_2 (\log_2 n) = \Theta(\ln(\log_2 n)). Also, ln(log2n)=ln(lnnln2)=ln(lnn)ln(ln2)\ln(\log_2 n) = \ln\left(\frac{\ln n}{\ln 2}\right) = \ln(\ln n) - \ln(\ln 2). Therefore, log2(log2n)=Θ(ln(lnn))=Θ(loglogn)\log_2 (\log_2 n) = \Theta(\ln(\ln n)) = \Theta(\log \log n). Substituting this back into the expression for T(n)T(n):
T(n)=Θ(nloglogn)T(n) = \Theta(n \log \log n)
**Step 7: Check the base case** The base case T(1)=1T(1)=1 corresponds to k=0k=0 in our substitution (n=2kn=2^k). The asymptotic analysis holds for sufficiently large nn, typically n2n \geq 2 for loglogn\log \log n to be defined. The base case does not alter the asymptotic complexity. **Step 8: Compare with options** The derived complexity is T(n)=Θ(nloglogn)T(n) = \Theta(n \log \log n). Comparing this with the given options: 1. T(n)=Θ(nloglogn)T(n) = \Theta(n \log \log n) 2. T(n)=Θ(nlogn)T(n) = \Theta(n \log n) 3. T(n)=Θ(n2logn)T(n) = \Theta(n^2 \log n) 4. T(n)=Θ(n2loglogn)T(n) = \Theta(n^2 \log \log n) The first option matches our result. The final answer is T(n)=Θ(nloglogn)\boxed{T(n) = \Theta(n \log \log n)}.
4 Single Choice
2024.1
Let T(n)T(n) be the recurrence relation defined as follows:
T(0)=1, T(1)=2, T(n)=5T(n1)6T(n2)for n2T(0) = 1, \ T(1) = 2, \ T(n) = 5T(n-1) - 6T(n-2) \quad \text{for } n \ge 2
Which one of the following statements is TRUE?
A
T(n)=Θ(2n)T(n) = \Theta(2^n)
B
T(n)=Θ(n2n)T(n) = \Theta(n2^n)
C
T(n)=Θ(3n)T(n) = \Theta(3^n)
D
T(n)=Θ(n3n)T(n) = \Theta(n3^n)
View Solution
1. **Formulate the characteristic equation:** The given recurrence relation is T(n)=5T(n1)6T(n2)T(n) = 5T(n-1) - 6T(n-2). Rearranging it to a homogeneous form:
T(n)5T(n1)+6T(n2)=0T(n) - 5T(n-1) + 6T(n-2) = 0
The characteristic equation is obtained by substituting T(n)=rnT(n) = r^n:
r25r+6=0r^2 - 5r + 6 = 0
2. **Solve the characteristic equation for roots:** We factor the quadratic equation:
(r2)(r3)=0(r-2)(r-3) = 0
The roots are r1=2r_1 = 2 and r2=3r_2 = 3. 3. **Write the general solution:** Since the roots are distinct, the general solution for T(n)T(n) is of the form:
T(n)=Ar1n+Br2nT(n) = A r_1^n + B r_2^n
T(n)=A(2n)+B(3n)T(n) = A(2^n) + B(3^n)
where AA and BB are constants. 4. **Use base cases to find constants AA and BB:** We are given the base cases T(0)=1T(0) = 1 and T(1)=2T(1) = 2. For n=0n=0:
T(0)=A(20)+B(30)=A(1)+B(1)=A+BT(0) = A(2^0) + B(3^0) = A(1) + B(1) = A + B
Since T(0)=1T(0) = 1, we have:
A+B=1(Equation 1)A + B = 1 \quad \text{(Equation 1)}
For n=1n=1:
T(1)=A(21)+B(31)=2A+3BT(1) = A(2^1) + B(3^1) = 2A + 3B
Since T(1)=2T(1) = 2, we have:
2A+3B=2(Equation 2)2A + 3B = 2 \quad \text{(Equation 2)}
From Equation 1, we can express AA as A=1BA = 1 - B. Substitute this into Equation 2:
2(1B)+3B=22(1 - B) + 3B = 2
22B+3B=22 - 2B + 3B = 2
2+B=22 + B = 2
B=0B = 0
Now substitute B=0B = 0 back into A=1BA = 1 - B:
A=10A = 1 - 0
A=1A = 1
5. **Write the particular solution:** Substitute the values of A=1A=1 and B=0B=0 into the general solution:
T(n)=1(2n)+0(3n)T(n) = 1 \cdot (2^n) + 0 \cdot (3^n)
T(n)=2nT(n) = 2^n
6. **Determine the asymptotic behavior:** The particular solution is T(n)=2nT(n) = 2^n. Therefore, the asymptotic behavior of T(n)T(n) is Θ(2n)\Theta(2^n). Answer: \boxed{T(n) = \Theta(2^n)}
5 Single Choice
2024.1
When six unbiased dice are rolled simultaneously, the probability of getting all distinct numbers (i.e., 1, 2, 3, 4, 5, and 6) is
A
1324\frac{1}{324}
B
5324\frac{5}{324}
C
7324\frac{7}{324}
D
11324\frac{11}{324}
View Solution
To find the probability of getting all distinct numbers when six unbiased dice are rolled simultaneously, we need to determine the total number of possible outcomes and the number of favorable outcomes. **Step 1: Calculate the total number of possible outcomes.** Each die has 6 faces (1, 2, 3, 4, 5, 6). Since six dice are rolled, and each roll is independent, the total number of possible outcomes is 6×6×6×6×6×66 \times 6 \times 6 \times 6 \times 6 \times 6.
Totaloutcomes=66\operatorname{Total outcomes} = 6^6
Totaloutcomes=46656\operatorname{Total outcomes} = 46656
**Step 2: Calculate the number of favorable outcomes.** We want to get all distinct numbers (i.e., 1, 2, 3, 4, 5, and 6). This means: The first die can show any of the 6 numbers. The second die can show any of the remaining 5 numbers (to be distinct from the first). The third die can show any of the remaining 4 numbers. The fourth die can show any of the remaining 3 numbers. The fifth die can show any of the remaining 2 numbers. The sixth die can show the last remaining number. This is equivalent to the number of permutations of 6 distinct items taken 6 at a time, which is P(6,6)P(6, 6) or 6!6!.
Favorableoutcomes=6!\operatorname{Favorable outcomes} = 6!
Favorableoutcomes=6×5×4×3×2×1\operatorname{Favorable outcomes} = 6 \times 5 \times 4 \times 3 \times 2 \times 1
Favorableoutcomes=720\operatorname{Favorable outcomes} = 720
**Step 3: Calculate the probability.** The probability of an event is given by the ratio of favorable outcomes to the total number of possible outcomes.
P(alldistinctnumbers)=FavorableoutcomesTotaloutcomesP(\operatorname{all distinct numbers}) = \frac{\operatorname{Favorable outcomes}}{\operatorname{Total outcomes}}
P(alldistinctnumbers)=6!66P(\operatorname{all distinct numbers}) = \frac{6!}{6^6}
Substitute the calculated values:
P(alldistinctnumbers)=72046656P(\operatorname{all distinct numbers}) = \frac{720}{46656}
Now, simplify the fraction:
P(alldistinctnumbers)=6×5×4×3×2×16×6×6×6×6×6P(\operatorname{all distinct numbers}) = \frac{6 \times 5 \times 4 \times 3 \times 2 \times 1}{6 \times 6 \times 6 \times 6 \times 6 \times 6}
Cancel out one 6 from the numerator and denominator:
P(alldistinctnumbers)=5×4×3×2×16×6×6×6×6P(\operatorname{all distinct numbers}) = \frac{5 \times 4 \times 3 \times 2 \times 1}{6 \times 6 \times 6 \times 6 \times 6}
P(alldistinctnumbers)=1207776P(\operatorname{all distinct numbers}) = \frac{120}{7776}
Divide both numerator and denominator by 6:
P(alldistinctnumbers)=201296P(\operatorname{all distinct numbers}) = \frac{20}{1296}
Divide both numerator and denominator by 4:
P(alldistinctnumbers)=5324P(\operatorname{all distinct numbers}) = \frac{5}{324}
The final probability is 5324\frac{5}{324}. Answer: \boxed{\frac{5}{324}}
6 Single Choice
2023.1
Let U={1,2,,n}U = \{1, 2, \dots, n\}, where nn is a large positive integer greater than 10001000. Let kk be a positive integer less than nn. Let A,BA, B be subsets of UU with A=B=k|A| = |B| = k and AB=A \cap B = \emptyset. We say that a permutation of UU separates AA from BB if one of the following is true. - All members of AA appear in the permutation before any of the members of BB. - All members of BB appear in the permutation before any of the members of AA. How many permutations of UU separate AA from BB?
A
n!n!
B
(n2k)(n2k)!\binom{n}{2k} (n - 2k)!
C
(n2k)(n2k)!(k!)2\binom{n}{2k} (n - 2k)! (k!)^2
D
2(n2k)(n2k)!(k!)22\binom{n}{2k} (n - 2k)! (k!)^2
View Solution
Let U={1,2,,n}U = \{1, 2, \dots, n\}, where nn is a large positive integer greater than 10001000. Let kk be a positive integer less than nn. Let A,BA, B be subsets of UU with A=B=k|A| = |B| = k and AB=A \cap B = \emptyset. A permutation of UU separates AA from BB if one of the following is true: 1. All members of AA appear in the permutation before any of the members of BB. 2. All members of BB appear in the permutation before any of the members of AA. Since AB=A \cap B = \emptyset, these two conditions are mutually exclusive. We can calculate the number of permutations for each case and then sum them up. **Step 1: Calculate the number of permutations where all members of AA appear before any members of BB.** Let S=ABS = A \cup B. Since AA and BB are disjoint and each has kk elements, the size of SS is S=A+B=k+k=2k|S| = |A| + |B| = k + k = 2k. The remaining elements are USU \setminus S, which has n2kn - 2k elements. To construct a permutation where all elements of AA appear before all elements of BB, we can follow these steps: 1. **Choose 2k2k positions** out of the nn available positions in the permutation for the elements of the set S=ABS = A \cup B. The number of ways to do this is (n2k)\binom{n}{2k}. 2. **Arrange the elements of SS** in these 2k2k chosen positions such that all elements of AA come before all elements of BB. This means that the first kk of these 2k2k chosen positions must be filled by elements of AA, and the next kk positions must be filled by elements of BB. * The kk elements of AA can be arranged in the first kk designated positions in k!k! ways. * The kk elements of BB can be arranged in the next kk designated positions in k!k! ways. So, the number of ways to arrange elements of SS in the chosen 2k2k positions, satisfying the condition, is k!×k!=(k!)2k! \times k! = (k!)^2. 3. **Arrange the remaining n2kn - 2k elements** (from USU \setminus S) in the remaining n2kn - 2k positions. The number of ways to do this is (n2k)!(n - 2k)!. Combining these steps, the total number of permutations for this case (A before B) is:
(n2k)×(k!)2×(n2k)!\binom{n}{2k} \times (k!)^2 \times (n - 2k)!
We know that (n2k)=n!(2k)!(n2k)!\binom{n}{2k} = \frac{n!}{(2k)!(n - 2k)!}. Substituting this into the expression:
n!(2k)!(n2k)!×(k!)2×(n2k)!\frac{n!}{(2k)!(n - 2k)!} \times (k!)^2 \times (n - 2k)!
n!(2k)!(k!)2\frac{n!}{(2k)!} (k!)^2
**Step 2: Calculate the number of permutations where all members of BB appear before any members of AA.** This case is symmetric to Step 1. The logic and calculations are identical, simply swapping the roles of AA and BB. 1. **Choose 2k2k positions** out of the nn available positions for the elements of S=ABS = A \cup B. The number of ways to do this is (n2k)\binom{n}{2k}. 2. **Arrange the elements of SS** in these 2k2k chosen positions such that all elements of BB come before all elements of AA. * The kk elements of BB can be arranged in the first kk designated positions in k!k! ways. * The kk elements of AA can be arranged in the next kk designated positions in k!k! ways. So, the number of ways to arrange elements of SS in the chosen 2k2k positions, satisfying the condition, is k!×k!=(k!)2k! \times k! = (k!)^2. 3. **Arrange the remaining n2kn - 2k elements** (from USU \setminus S) in the remaining n2kn - 2k positions. The number of ways to do this is (n2k)!(n - 2k)!. Combining these steps, the total number of permutations for this case (B before A) is:
(n2k)×(k!)2×(n2k)!\binom{n}{2k} \times (k!)^2 \times (n - 2k)!
Which simplifies to:
n!(2k)!(k!)2\frac{n!}{(2k)!} (k!)^2
**Step 3: Total number of permutations that separate AA from BB.** Since the two cases (A before B, and B before A) are mutually exclusive, the total number of permutations that separate AA from BB is the sum of the permutations from Case 1 and Case 2.
Total permutations=((n2k)(k!)2(n2k)!)+((n2k)(k!)2(n2k)!)\text{Total permutations} = \left( \binom{n}{2k} (k!)^2 (n - 2k)! \right) + \left( \binom{n}{2k} (k!)^2 (n - 2k)! \right)
Total permutations=2(n2k)(k!)2(n2k)!\text{Total permutations} = 2 \binom{n}{2k} (k!)^2 (n - 2k)!
The final answer is 2(n2k)(n2k)!(k!)2\boxed{2\binom{n}{2k} (n - 2k)! (k!)^2}.
7 Single Choice
2023.1
The Lucas sequence LnL_n is defined by the recurrence relation:
Ln=Ln1+Ln2, for n3,L_n = L_{n-1} + L_{n-2},\text{ for } n \geq 3,
with L1=1L_1 = 1 and L2=3L_2 = 3. Which one of the options given is TRUE?
A
Ln=(1+52)n+(152)nL_n = \left(\frac{1+\sqrt{5}}{2}\right)^n + \left(\frac{1-\sqrt{5}}{2}\right)^n
B
Ln=(1+52)n(153)nL_n = \left(\frac{1+\sqrt{5}}{2}\right)^n - \left(\frac{1-\sqrt{5}}{3}\right)^n
C
Ln=(1+52)n+(153)nL_n = \left(\frac{1+\sqrt{5}}{2}\right)^n + \left(\frac{1-\sqrt{5}}{3}\right)^n
D
Ln=(1+52)n(152)nL_n = \left(\frac{1+\sqrt{5}}{2}\right)^n - \left(\frac{1-\sqrt{5}}{2}\right)^n
View Solution
**Step 1: Formulate the characteristic equation** The given recurrence relation for the Lucas sequence is Ln=Ln1+Ln2L_n = L_{n-1} + L_{n-2} for n3n \geq 3. The characteristic equation for this recurrence relation is:
r2r1=0r^2 - r - 1 = 0
**Step 2: Solve the characteristic equation** Using the quadratic formula:
r=b±b24ac2ar = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
r=(1)±(1)24(1)(1)2(1)r = \frac{-(-1) \pm \sqrt{(-1)^2 - 4(1)(-1)}}{2(1)}
r=1±1+42r = \frac{1 \pm \sqrt{1 + 4}}{2}
r=1±52r = \frac{1 \pm \sqrt{5}}{2}
Let the two roots be
ϕ=r1=1+52\phi = r_1 = \frac{1+\sqrt{5}}{2}
and
ψ=r2=152\psi = r_2 = \frac{1-\sqrt{5}}{2}
**Step 3: Write the general form of the solution** The general solution for the Lucas sequence is of the form:
Ln=Ar1n+Br2nL_n = A r_1^n + B r_2^n
Ln=A(1+52)n+B(152)nL_n = A \left(\frac{1+\sqrt{5}}{2}\right)^n + B \left(\frac{1-\sqrt{5}}{2}\right)^n
**Step 4: Use initial conditions to find constants A and B** We are given L1=1L_1 = 1 and L2=3L_2 = 3. For n=1n=1:
L1=Ar1+Br2=1L_1 = A r_1 + B r_2 = 1
A(1+52)+B(152)=1(1)A \left(\frac{1+\sqrt{5}}{2}\right) + B \left(\frac{1-\sqrt{5}}{2}\right) = 1 \quad (1)
For n=2n=2:
L2=Ar12+Br22=3L_2 = A r_1^2 + B r_2^2 = 3
Since r1r_1 and r2r_2 are roots of r2r1=0r^2 - r - 1 = 0, we know r12=r1+1r_1^2 = r_1 + 1 and r22=r2+1r_2^2 = r_2 + 1. Substitute these into the equation for L2L_2:
A(r1+1)+B(r2+1)=3A(r_1 + 1) + B(r_2 + 1) = 3
Ar1+A+Br2+B=3A r_1 + A + B r_2 + B = 3
(Ar1+Br2)+(A+B)=3\left(A r_1 + B r_2\right) + (A + B) = 3
From equation (1), we know Ar1+Br2=1A r_1 + B r_2 = 1. Substitute this value:
1+(A+B)=31 + (A + B) = 3
A+B=2(2)A + B = 2 \quad (2)
Now we have a system of two linear equations for A and B: 1.
Ar1+Br2=1A r_1 + B r_2 = 1
2.
A+B=2A + B = 2
From (2), B=2AB = 2 - A. Substitute this into (1):
Ar1+(2A)r2=1A r_1 + (2 - A) r_2 = 1
Ar1+2r2Ar2=1A r_1 + 2 r_2 - A r_2 = 1
A(r1r2)=12r2A (r_1 - r_2) = 1 - 2 r_2
Calculate r1r2r_1 - r_2:
r1r2=(1+52)(152)=1+51+52=252=5r_1 - r_2 = \left(\frac{1+\sqrt{5}}{2}\right) - \left(\frac{1-\sqrt{5}}{2}\right) = \frac{1+\sqrt{5} - 1 + \sqrt{5}}{2} = \frac{2\sqrt{5}}{2} = \sqrt{5}
Substitute this back:
A(5)=12(152)A (\sqrt{5}) = 1 - 2 \left(\frac{1-\sqrt{5}}{2}\right)
A5=1(15)A \sqrt{5} = 1 - (1 - \sqrt{5})
A5=11+5A \sqrt{5} = 1 - 1 + \sqrt{5}
A5=5A \sqrt{5} = \sqrt{5}
A=1A = 1
Now, substitute A=1A=1 into A+B=2A+B=2:
1+B=21 + B = 2
B=1B = 1
**Step 5: Write the final closed-form expression** Substitute the values of A=1A=1 and B=1B=1 back into the general solution:
Ln=1(1+52)n+1(152)nL_n = 1 \cdot \left(\frac{1+\sqrt{5}}{2}\right)^n + 1 \cdot \left(\frac{1-\sqrt{5}}{2}\right)^n
Ln=(1+52)n+(152)nL_n = \left(\frac{1+\sqrt{5}}{2}\right)^n + \left(\frac{1-\sqrt{5}}{2}\right)^n
**Step 6: Compare with the given options** The derived formula is:
Ln=(1+52)n+(152)nL_n = \left(\frac{1+\sqrt{5}}{2}\right)^n + \left(\frac{1-\sqrt{5}}{2}\right)^n
Let's check the options (with corrected MathJax for `\left` and `\right`): 1.
Ln=(1+52)n+(152)nL_n = \left(\frac{1+\sqrt{5}}{2}\right)^n + \left(\frac{1-\sqrt{5}}{2}\right)^n
2.
Ln=(1+52)n(153)nL_n = \left(\frac{1+\sqrt{5}}{2}\right)^n - \left(\frac{1-\sqrt{5}}{3}\right)^n
3.
Ln=(1+52)n+(153)nL_n = \left(\frac{1+\sqrt{5}}{2}\right)^n + \left(\frac{1-\sqrt{5}}{3}\right)^n
4.
Ln=(1+52)n(152)nL_n = \left(\frac{1+\sqrt{5}}{2}\right)^n - \left(\frac{1-\sqrt{5}}{2}\right)^n
Our result matches option 1. The final answer is Ln=(1+52)n+(152)n\boxed{L_n = \left(\frac{1+\sqrt{5}}{2}\right)^n + \left(\frac{1-\sqrt{5}}{2}\right)^n}.
8 Single Choice
2022.1
Consider the following recurrence:
f(1)=1;f(1) = 1;
f(2n)=2f(n)1, for n1;f(2n) = 2 f(n)-1, \text{ for } n \ge 1;
f(2n+1)=2f(n)+1, for n1.f(2n+1) = 2 f(n)+1, \text{ for } n \ge 1.
Then, which of the following statements is/are TRUE?
A
f(2n1)=2n1f(2^n-1)=2^n-1
B
f(2n)=1f(2^n)=1
C
f(52n)=2n+1+1f(5 \cdot 2^n)=2^{n+1}+1
D
f(2n+1)=2n+1f(2^n+1)=2^n+1
View Solution
The given recurrence relations are:
f(1)=1;f(1) = 1;
f(2n)=2f(n)1, for n1;f(2n) = 2 f(n)-1, \text{ for } n \ge 1;
f(2n+1)=2f(n)+1, for n1.f(2n+1) = 2 f(n)+1, \text{ for } n \ge 1.
Let's derive a general form for f(n)f(n) based on its binary representation. Let nn be represented in binary as n=(bkbk1b1b0)2=i=0kbi2in = (b_k b_{k-1} \dots b_1 b_0)_2 = \sum_{i=0}^k b_i 2^i. From the recurrence, we can observe the pattern based on the last bit b0b_0: If b0=0b_0 = 0, then nn is even, n=2n/2n = 2 \lfloor n/2 \rfloor. The recurrence is f(n)=2f(n/2)1f(n) = 2 f(\lfloor n/2 \rfloor) - 1. If b0=1b_0 = 1, then nn is odd, n=2n/2+1n = 2 \lfloor n/2 \rfloor + 1. The recurrence is f(n)=2f(n/2)+1f(n) = 2 f(\lfloor n/2 \rfloor) + 1. Let's define a new sequence cic_i based on the binary digits bib_i: If bi=0b_i = 0, let ci=1c_i = -1. If bi=1b_i = 1, let ci=1c_i = 1. Then, the recurrence can be uniformly written as f(n)=2f(n/2)+c0f(n) = 2 f(\lfloor n/2 \rfloor) + c_0. Applying this recursively:
f(n)=c0+2f(n/2)=c0+2(c1+2f(n/4))=c0+2c1+4f(n/4)\begin{aligned}f(n) & = c_0 + 2 f(\lfloor n/2 \rfloor) \\ & = c_0 + 2 (c_1 + 2 f(\lfloor n/4 \rfloor)) \\ & = c_0 + 2c_1 + 4 f(\lfloor n/4 \rfloor)\end{aligned}
Continuing this expansion until f(1)f(1):
f(n)=c0+2c1+4c2++2kck=i=0kci2i.f(n) = c_0 + 2c_1 + 4c_2 + \dots + 2^k c_k = \sum_{i=0}^k c_i 2^i.
This is the general form for f(n)f(n). Let's verify this general form with a few examples: - For n=1=(1)2n=1 = (1)_2: b0=1    c0=1b_0=1 \implies c_0=1. f(1)=c020=11=1f(1) = c_0 2^0 = 1 \cdot 1 = 1. (Correct) - For n=2=(10)2n=2 = (10)_2: b1=1,b0=0    c1=1,c0=1b_1=1, b_0=0 \implies c_1=1, c_0=-1. f(2)=c020+c121=(1)1+(1)2=1+2=1f(2) = c_0 2^0 + c_1 2^1 = (-1) \cdot 1 + (1) \cdot 2 = -1+2=1. (Correct) - For n=3=(11)2n=3 = (11)_2: b1=1,b0=1    c1=1,c0=1b_1=1, b_0=1 \implies c_1=1, c_0=1. f(3)=c020+c121=(1)1+(1)2=1+2=3f(3) = c_0 2^0 + c_1 2^1 = (1) \cdot 1 + (1) \cdot 2 = 1+2=3. (Correct) Now, let's evaluate each option: **Option 1: f(2n1)=2n1f(2^n-1)=2^n-1** The binary representation of 2n12^n-1 is 111n times\underbrace{11\dots1}_{n \text{ times}}. This means bi=1b_i=1 for all i=0,1,,n1i=0, 1, \dots, n-1. Therefore, ci=1c_i=1 for all i=0,1,,n1i=0, 1, \dots, n-1.
f(2n1)=i=0n1ci2i=i=0n1(1)2i=2n1.f(2^n-1) = \sum_{i=0}^{n-1} c_i 2^i = \sum_{i=0}^{n-1} (1) 2^i = 2^n-1.
This statement is **TRUE**. **Option 2: f(2n)=1f(2^n)=1** The binary representation of 2n2^n is 1000n times1\underbrace{00\dots0}_{n \text{ times}}. This means bn=1b_n=1, and bi=0b_i=0 for i=0,1,,n1i=0, 1, \dots, n-1. Therefore, cn=1c_n=1, and ci=1c_i=-1 for i=0,1,,n1i=0, 1, \dots, n-1.
f(2n)=cn2n+i=0n1ci2i=(1)2n+i=0n1(1)2i=2n(2n1)=1.\begin{aligned}f(2^n) & = c_n 2^n + \sum_{i=0}^{n-1} c_i 2^i \\ & = (1) 2^n + \sum_{i=0}^{n-1} (-1) 2^i \\ & = 2^n - (2^n-1) \\ & = 1.\end{aligned}
This statement is **TRUE**. **Option 3: f(52n)=2n+1+1f(5 \cdot 2^n)=2^{n+1}+1** The binary representation of 55 is (101)2(101)_2. The binary representation of 52n5 \cdot 2^n is (101000n times)2(101\underbrace{00\dots0}_{n \text{ times}})_2. This means bn+2=1,bn+1=0,bn=1b_{n+2}=1, b_{n+1}=0, b_n=1, and bi=0b_i=0 for i=0,1,,n1i=0, 1, \dots, n-1. Therefore, cn+2=1,cn+1=1,cn=1c_{n+2}=1, c_{n+1}=-1, c_n=1, and ci=1c_i=-1 for i=0,1,,n1i=0, 1, \dots, n-1.
f(52n)=cn+22n+2+cn+12n+1+cn2n+i=0n1ci2i=(1)2n+2+(1)2n+1+(1)2n+i=0n1(1)2i=42n22n+12n(2n1)=(42+1)2n2n+1=32n2n+1=22n+1=2n+1+1.\begin{aligned}f(5 \cdot 2^n) & = c_{n+2} 2^{n+2} + c_{n+1} 2^{n+1} + c_n 2^n + \sum_{i=0}^{n-1} c_i 2^i \\ & = (1) 2^{n+2} + (-1) 2^{n+1} + (1) 2^n + \sum_{i=0}^{n-1} (-1) 2^i \\ & = 4 \cdot 2^n - 2 \cdot 2^n + 1 \cdot 2^n - (2^n-1) \\ & = (4-2+1) 2^n - 2^n + 1 \\ & = 3 \cdot 2^n - 2^n + 1 \\ & = 2 \cdot 2^n + 1 \\ & = 2^{n+1} + 1.\end{aligned}
This statement is **TRUE**. **Option 4: f(2n+1)=2n+1f(2^n+1)=2^n+1** The binary representation of 2n+12^n+1 is 1000n1 times11\underbrace{00\dots0}_{n-1 \text{ times}}1. This means bn=1,b0=1b_n=1, b_0=1, and bi=0b_i=0 for i=1,2,,n1i=1, 2, \dots, n-1. Therefore, cn=1,c0=1c_n=1, c_0=1, and ci=1c_i=-1 for i=1,2,,n1i=1, 2, \dots, n-1.
f(2n+1)=cn2n+i=1n1ci2i+c020=(1)2n+i=1n1(1)2i+(1)1=2n(2n1+2n2++21)+1\begin{aligned}f(2^n+1) & = c_n 2^n + \sum_{i=1}^{n-1} c_i 2^i + c_0 2^0 \\ & = (1) 2^n + \sum_{i=1}^{n-1} (-1) 2^i + (1) 1 \\ & = 2^n - (2^{n-1} + 2^{n-2} + \dots + 2^1) + 1\end{aligned}
The sum i=1n12i=(2n1)20=2n11=2n2\sum_{i=1}^{n-1} 2^i = (2^n-1) - 2^0 = 2^n-1-1 = 2^n-2.
f(2n+1)=2n(2n2)+1=2n2n+2+1=3.\begin{aligned}f(2^n+1) & = 2^n - (2^n-2) + 1 \\ & = 2^n - 2^n + 2 + 1 \\ & = 3.\end{aligned}
For this statement to be true, 2n+12^n+1 must be equal to 33. This implies 2n=22^n=2, so n=1n=1. Since the statement is not true for all n1n \ge 1 (e.g., for n=2n=2, f(22+1)=f(5)=3f(2^2+1)=f(5)=3, but 22+1=52^2+1=5), this statement is **FALSE**. The statements that are TRUE are Option 1, Option 2, and Option 3. Answer: f(2n1)=2n1,f(2n)=1,f(52n)=2n+1+1\boxed{f(2^n-1)=2^n-1, f(2^n)=1, f(5 \cdot 2^n)=2^{n+1}+1}

Why Practice PYQs?

📈

Understand Pattern

Know what to expect in the actual exam

🎯

Topic Weightage

Focus on high-yield topics

Build Confidence

Practice with real exam questions

Frequently Asked Questions

How are GATE PYQs organized?

PYQs are organized chapter-wise across 62 topics, making it easy to practice specific areas. Each question shows its year and slot.

How many years of PYQs are available?

We have 8 years of GATE CS PYQs from 2021.1 to 2025.2, totaling 428+ questions.

Is the first chapter free?

Yes! The first chapter's PYQs are completely FREE with full solutions. Practice and evaluate before upgrading.

Do PYQs have detailed solutions?

Every PYQ comes with step-by-step solutions and explanations to help you understand the concepts thoroughly.

More GATECS Resources

Why Choose MastersUp?

🎯

AI-Powered Plans

Personalized study schedules based on your exam date and learning pace

📚

15,000+ Questions

Verified questions with detailed solutions from past papers

📊

Smart Analytics

Track your progress with subject-wise performance insights

🔖

Bookmark & Revise

Save important questions for quick revision before exams

Start Your Free Preparation →

No credit card required • Free forever for basic features