GATE / CS ARCHIVE

SIMILAR QUESTIONS / THEORY OF COMPUTATION

Compare countable machines with all languages

3 questions solved the same way, newest first. Back to Theory of Computation

How these are solved

Finite strings/descriptions are enumerable; languages are subsets of the infinite word set and have uncountable cardinality. Apply this distinction to the listed classes.

2 marks · MCQ
Report issue

Counting descriptions and languages

Other / Mixed Topics

Question 34, GATE 2019: Which sets are uncountable? S1: recursively enumerable languages over {0,1}; S2: syntactically valid C programs; S3: all languages over {0,1}; S4: all nonregular languages over {0,1}. Options A S1/S2, B S3/S4, C S2/S3, D S1/S4.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

1. A set is countable if its members can be listed using natural-number indices. Finite strings over any finite alphabet can be listed by length and then lexicographic order, so their collection is countable.
2. Each Turing machine has a finite description. There are therefore only countably many such machines and only countably many languages they recognize. Every recursively enumerable language is recognized by a machine, so S1 is countable.
3. Each C program is also a finite string. Restricting the countable set of all strings to those obeying C syntax cannot make it uncountable, so S2 is countable.
4. The set {0,1}* of words is countably infinite, but a language is an arbitrary subset of that set. Its power set is uncountable by Cantor's theorem. Hence S3 is uncountable; confusing words with sets of words is the main trap.
5. Regular languages have finite automaton descriptions, so there are only countably many of them. If S4 were countable too, all languages would be a union of two countable sets, contradicting step 4. Thus S4 is uncountable and the answer is B.

Original paper, page 11 · Answer key

1 mark · MCQ
Report issue

Other / Mixed Topics

Question 16, GATE 2014: For a finite nonempty alphabet Σ, let Σ* be all finite strings and 2^(Σ*) its power set. Which is true? A both countable; B power set countable and Σ* uncountable; C power set uncountable and Σ* countable; D both uncountable.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Step 1: For each length k there are finitely many strings, |Σ|^k. Listing by increasing length and lexicographically within a length enumerates every finite string. Thus Σ* is countably infinite, including when Σ has only one symbol. Step 2: Cantor’s theorem states that the power set of any set has strictly larger cardinality than that set. The power set of a countably infinite set is uncountable. Step 3: Therefore C holds. A language is a subset of Σ*, and there are uncountably many such languages despite only countably many strings.

Original paper, page 56 · Answer key

1 mark · MCQ
Report issue

An uncountable collection of languages

Turing Machines

Question 3.4, GATE 1997: Over{a, b}, which is uncountable: all finite strings, all languages, regular languages, or Turing-recognizable languages?
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Finite strings can be enumerated by length and lexicographic order, so Σ* is countably infinite. All languages form its power set P(Σ*), which is uncountable by Cantor’s theorem. In contrast, finite automata and Turing machines each have finite descriptions over a finite alphabet, so there are only countably many of either and hence only countably many languages they describe. Thus B. The distinction is between elements that are strings and arbitrary sets of those strings.

Original paper, page 3