LawMint Sign in

Himachal Pradesh SET (HP SET) Theory of Computation and Compilers Previous Year Questions

Try the preview and open any solution for a worked explanation.

Himachal Pradesh SET (HP SET) practice pack

The practice pack for Himachal Pradesh SET (HP SET) is coming soon to LawMint.

Question 1

The number of states in a minimum state DFA which accepts strings on {0, 1} such that Kth symbol from left is a “1” is :

Select one answer

Question 2

Which of the following is (are) context free language(s) ?
L1 = {xwxr | x, w ∈ {a, b}*, |x| = |w| and xr represents reverse of string x}
L2 = {xdw | w is a substring of x, x ∈ {a, b, c}*, d ∈ {a, b, c}}

Select one answer

Question 3

Consider the following languages :
L1 = {<D> | D is a DFA and L(D) is the set of binary strings with 101 as suffix}
L2 = {<M> | M is a TM which accepts rev(X) if it accepts X}.
Which of the following statements is correct ?

Select one answer

Question 4

Consider the following conditions for every pair of distinct alternatives A → α\alpha | β\beta in a grammar G:
(i) No terminal symbol belongs to both FIRST(α\alpha) and FIRST(β\beta).
(ii) λ\lambda does not belong to both FIRST(α\alpha) and FIRST(β\beta).
(iii) FIRST(α\alpha) ∩ FOLLOW(A) = ∅ if λ∈\lambda \in FIRST(β\beta), with the corresponding condition when α\alpha and β\beta are interchanged.
Which conditions are required for G to be LL(1)?

Select one answer

Question 5

Consider the following language :
L = {ww | w ∈ {a, b}+}
Which of the following statements is true ?

Select one answer

Question 6

What is the language represented by the following grammar ?
S → YZ | ZY | Y | Z
Y → aYa | aYb | bYa | bYb | a
Z → aZa | aZb | bZa | bZb | b

Select one answer

Question 7

Arrange the following machines according to their power from smallest to largest :
(i) Finite state automaton
(ii) Push-down automaton
(iii) Turing machine
(iv) Linear bounded automaton

Select one answer

Question 8

Given below are two statements :
(I) The grammars S → aSb | bSa | SS | a and S → aSb | bSa | a are not equivalent.
(II) The grammars S → SS | SSS | aSb | bSa | λ\lambda and S → SS | aSb | bSa | λ\lambda are equivalent.
Which statements are correct?

Select one answer

Question 9

The context free grammar generating {an b2n | n ≥ 1} is :

Select one answer

Question 10

As of November 2026, consider two questions in computational complexity.
1. Is NP equal to coNP?
2. Is P equal to the intersection of NP and coNP?

What is the status of each equality?

Select one answer

Continue practising

The practice pack for Himachal Pradesh SET (HP SET) is coming soon to LawMint.

Himachal Pradesh SET (HP SET) practice pack

The practice pack for Himachal Pradesh SET (HP SET) is coming soon to LawMint.