Skip to main content

Nepal Engineering Council · Chapter 6

Theory of Computation and Computer Graphics

Pick an answer for each question, then open “Show answer” to check it.

116 questions in 6 syllabus topics · 21 tagged from past exams or NEC model sets.

6.1 Introduction to finite automata

21 questions · ACtE0601

1. What technique is used to check if language is regular?

Aasadh 2081 exam
  1. Option A: Turing test
  2. Option B: Pumping lemma
  3. Option C: Halting problem
  4. Option D: Church-Turing thesis
Show hint

Proves language is non-regular by contradiction.

Show answer

Answer: B. Pumping lemma

Pumping lemma is the technique to determine if a language is regular or non-regular.

2. Technique to check regular language?

  1. Option A: Turing test
  2. Option B: Pumping lemma
  3. Option C: Halting problem
  4. Option D: Church-Turing
Show hint

Proves non-regularity.

Show answer

Answer: B. Pumping lemma

Pumping lemma proves language is non-regular by contradiction.

3. What about FSM?

  1. Option A: Input alphabet
  2. Option B: Output alphabet
  3. Option C: State table
  4. Option D: Memory unit
Show hint

FSM component.

Show answer

Answer: D. Memory unit

FSM has input/output alphabet, states, transitions. Memory unit is not standard component.

4. What is the key difference between a deterministic finite automaton (DFA) and a nondeterministic finite automaton (NFA)?

  1. Option A: A DFA has exactly one transition for each symbol from every state, while an NFA may have zero, one, or many transitions (including ε-moves) for the same symbol from a state.
  2. Option B: A DFA can recognize only regular languages, while an NFA can recognize context-free languages.
  3. Option C: An NFA always has more states than an equivalent DFA.
  4. Option D: A DFA uses a stack, while an NFA does not.
Show hint

Think about the transition function δ: for which model is δ a total function from (state, symbol) to a single next state?

Show answer

Answer: A. A DFA has exactly one transition for each symbol from every state, while an NFA may have zero, one, or many transitions (including ε-moves) for the same symbol from a state.

Both DFA and NFA are models of computation for regular languages, but their transition behavior differs. In a DFA, the transition function is: δ : Q × Σ → Q For each state q ∈ Q and each symbol a ∈ Σ, there is exactly one defined next state δ(q, a). This means the automaton's behavior is completely determined by the current state and current input symbol. There is no ambiguity: at any step, only one path is possible. This is why the machine is ‘deterministic’. In an NFA, the transition function is: δ : Q × Σ_ε → P(Q) where Σ_ε = Σ ∪ {ε} and P(Q) is the power set of Q. For a given state and input symbol, δ may return: • zero states (no transition), • one state, or • multiple possible next states. Additionally, NFAs may have ε-transitions that consume no input symbol but move the machine to new states. Because of this, an NFA can be in a *set* of possible current states at any point in a conceptual execution. Despite this difference, DFAs and NFAs are equivalent in expressive power: for every NFA there exists an equivalent DFA recognizing the same language. The usual construction is the subset construction, where each DFA state represents a subset of NFA states. However, the DFA can have up to 2^|Q_NFA| states in the worst case. So the essential difference is not in the class of languages recognized, but in the form of the transition function and the degree of nondeterminism allowed during computation.

5. Why are DFA and NFA considered equivalent models of computation for regular languages?

  1. Option A: Because every regular expression can be converted only to a DFA.
  2. Option B: Because for every NFA there exists a DFA that recognizes the same language, constructed by subset construction.
  3. Option C: Because NFA can simulate PDA, and DFA can simulate PDA.
  4. Option D: Because DFAs can use ε-transitions to mimic all NFAs.
Show hint

Think of a DFA state representing a *set* of NFA states.

Show answer

Answer: B. Because for every NFA there exists a DFA that recognizes the same language, constructed by subset construction.

DFA and NFA are equivalent in *language recognition power* for regular languages. This means any language recognized by some NFA can also be recognized by some DFA, and every DFA trivially is an NFA (with restricted transitions). The central construction is the *subset construction* (also called powerset construction): • Given an NFA N = (Q, Σ, δ, q₀, F), construct a DFA D = (Q', Σ, δ', q₀', F') such that L(D) = L(N). • Each state in Q' is a subset of Q (so Q' ⊆ P(Q)). Intuitively, a DFA state encodes all possible NFA states that the NFA could be in after reading some prefix of the input. • The start state q₀' of the DFA is the ε-closure of {q₀} (all states reachable from q₀ via ε-moves). • For each DFA state S ⊆ Q and symbol a ∈ Σ, define: δ'(S, a) = ε-closure(⋃_{q∈S} δ(q, a)) • A DFA subset S is accepting if S intersects F: S ∩ F ≠ ∅. This construction systematically removes nondeterminism by letting the DFA compactly track all possible NFA states at once. While the resulting DFA can, in the worst case, have up to 2^|Q| states, it always exists and recognizes the same language. Because of this theorem, NFAs are often used as a convenient design tool (they are easier to construct from regular expressions), and then converted into DFAs for implementation in lexical analyzers, pattern matchers, and hardware finite state machines.

6. What is the main idea of DFA minimization and why is it important?

  1. Option A: To reduce the alphabet size of the DFA.
  2. Option B: To merge equivalent states so that the DFA has the minimum number of states recognizing the same language.
  3. Option C: To allow ε-transitions for easier design.
  4. Option D: To change a DFA into an NFA.
Show hint

Think about states that behave identically for all future inputs.

Show answer

Answer: B. To merge equivalent states so that the DFA has the minimum number of states recognizing the same language.

DFA minimization is the process of transforming a given DFA into an equivalent DFA (recognizing the same language) that has the minimum possible number of states. Two states are *equivalent* if, for every possible input string w, either both states accept w (from that state onward) or both reject w. Intuitively, the future behavior of the automaton from those states is indistinguishable. Main idea: • Partition the set of states into equivalence classes under the Myhill–Nerode equivalence relation. • Each equivalence class is collapsed into a single state in the minimized DFA. • Transitions between equivalence classes are defined naturally from transitions of representative states. Common algorithmic view: 1. Initially partition states into accepting and non-accepting sets (they are obviously distinguishable if one is accepting and the other is not). 2. Iteratively refine partitions: for any block of states, split it if some states in the block transition into different blocks under some input symbol. 3. Continue until no more refinement occurs. Each resulting block represents one state of the minimal DFA. Importance: • Reduced memory/storage: fewer states mean smaller transition tables or hardware. • Faster execution: fewer states and transitions to process. • Conceptual clarity: the minimal DFA reveals the intrinsic complexity of the language (number of distinct Myhill–Nerode equivalence classes). • In compiler construction, minimal DFAs make lexical analyzers more efficient. Uniqueness: Apart from renaming of states, the minimal DFA for a given regular language is unique. This property is useful when comparing regular languages or reasoning about their complexity.

7. Which of the following correctly relates regular expressions and finite automata?

  1. Option A: Every DFA can be converted to an equivalent regular expression, but not vice versa.
  2. Option B: Regular expressions and finite automata (DFA/NFA) describe exactly the same class of languages: the regular languages.
  3. Option C: Regular expressions can describe context-free languages while finite automata cannot.
  4. Option D: Finite automata can describe non-recursively enumerable languages.
Show hint

Think about Kleene's theorem.

Show answer

Answer: B. Regular expressions and finite automata (DFA/NFA) describe exactly the same class of languages: the regular languages.

Kleene's Theorem is the central result connecting regular expressions and finite automata. It states that the following three formalisms are equivalent in expressive power: 1. Deterministic finite automata (DFA), 2. Nondeterministic finite automata (NFA), and 3. Regular expressions. All three describe exactly the class of *regular languages*. Direction 1: RE → NFA/DFA. • Given a regular expression, you can systematically construct an NFA using Thompson's construction. For basic symbols, concatenation, alternation (|), and Kleene star (*), there are standard NFA fragments that can be combined. • Then, using subset construction, the NFA can be turned into an equivalent DFA. Direction 2: DFA/NFA → RE. • Given a finite automaton, there are state-elimination algorithms that remove states one by one and accumulate edge labels as regular expressions. The final result is a regular expression denoting the same language. Therefore, regular expressions, DFA, and NFA are different syntactic or structural views of the same underlying thing: regular languages. Regular expressions are more compact and convenient to write and reason about patterns, while automata are more suitable for mechanical implementation (e.g., lexical analyzers or hardware circuits).

8. What does the pumping lemma for regular languages guarantee?

  1. Option A: That every long enough string in a regular language can be decomposed into xyz where some middle part y can be repeated any number of times and the resulting strings all remain in the language.
  2. Option B: That all regular languages are finite.
  3. Option C: That any non-regular language becomes regular after pumping.
  4. Option D: That any NFA can be pumped into a DFA.
Show hint

Think of |y| > 0, |xy| ≤ p, and xy^i z ∈ L for all i ≥ 0.

Show answer

Answer: A. That every long enough string in a regular language can be decomposed into xyz where some middle part y can be repeated any number of times and the resulting strings all remain in the language.

The pumping lemma for regular languages is a *necessary condition* for a language to be regular. It does not characterize regular languages completely, but it is an extremely useful tool for proving that certain languages are *not* regular. Statement (informal): If L is a regular language, then there exists a constant p (the pumping length) such that any string w ∈ L with |w| ≥ p can be split into three parts w = xyz satisfying: 1. |y| > 0 (the pumped part is non-empty), 2. |xy| ≤ p (the initial segment xy lies within the first p symbols), 3. For all i ≥ 0, the string x y^i z ∈ L. Intuition: • Because L is regular, there exists a DFA with a finite number of states, say p states. • Any string of length at least p causes the DFA, as it reads the first p symbols, to visit at least one state twice (Pigeonhole Principle). • The part of the input that causes this loop corresponds to y. Since the automaton can loop that segment any number of times and remain in an accepting path, the pumped strings x y^i z must all be in L. How it is used: • To show a language L is *not* regular, you assume it *is* regular and thus must satisfy the pumping lemma. • You choose a string w in L of length ≥ p, then argue that for *every* way to split w into xyz obeying conditions 1 and 2, there exists some i (often i = 0 or 2) such that x y^i z ∉ L. • This contradicts the pumping lemma, hence L cannot be regular. Example: L = { a^n b^n | n ≥ 0 }. • Intuitively not regular; counting equal numbers of a's and b's requires memory beyond a finite automaton. • Suppose L is regular. Let p be pumping length. Consider w = a^p b^p. • By conditions, y consists only of a's within first p positions. Pumping y (e.g. i = 0) changes number of a's but not b's, giving a^{p - |y|} b^p, which is not in L. • Contradiction ⇒ L is not regular. Thus, the pumping lemma is a powerful *negative tool*: if a language fails the pumping lemma, it is definitely not regular. If it satisfies the lemma, it might still be non-regular (the lemma is not a sufficient condition).

9. What are the basic limitations of finite state machine?

NEC model set
  1. Option A: It cannot remember grammar for a language
  2. Option B: It cannot remember arbitrarily large amount of information
  3. Option C: It cannot remember language generated from a grammar
  4. Option D: It cannot remember state transitions
Show hint

FSM has a fixed, finite number of states. What does this fundamental limitation prevent?

Show answer

Answer: B. It cannot remember arbitrarily large amount of information

The basic limitation of finite state machines is that they cannot remember arbitrarily large amounts of information. FSM has: (1) Fixed, finite number of states - Defined at design time, (2) Limited memory - Only the current state is remembered, (3) No stack or unbounded storage - Cannot push/pop arbitrary amounts of data. This fundamental limitation means FSMs: (1) Cannot parse context-free languages (like balanced parentheses), (2) Cannot count unbounded repetitions, (3) Cannot match arbitrarily nested structures. Examples of what FSMs cannot do: (1) Recognize anbn (equal number of a's followed by b's), (2) Match nested parentheses, (3) Parse programming language expressions with nesting. Formal language theory: (1) Regular languages - Recognized by FSMs, (2) Context-free languages - Require push-down automata (add stack), (3) Recursively enumerable languages - Require Turing machines. To overcome this, we use: (1) Push-down automata (add one stack), (2) Turing machines (add unlimited tape), (3) Practical alternatives - Compiler theory, parsing techniques. This limitation is why real parsing requires more powerful machines than FSMs. Application implications: (1) Network protocols - Can use FSMs, (2) Programming language compilation - Need more powerful machines, (3) Lexical analysis - FSMs sufficient, (4) Syntax analysis - Need push-down automata or more.

10. In FSM (Finite State Machine), the initial state is also called:

NEC model set
  1. Option A: a) Final state
  2. Option B: b) Start state
  3. Option C: c) Idle state
  4. Option D: d) Temporary state
Show hint

The state where the FSM begins its operation. What's this state called?

Show answer

Answer: B. b) Start state

In an FSM (Finite State Machine), the initial state is also called the Start state. This is the state where the FSM begins its operation before processing any inputs. Every FSM has exactly one initial state (unless specified otherwise). Final or accepting states are different from the initial state. The FSM transitions from the start state based on inputs and defined transition rules.

11. Which of the following is NOT a type of finite automaton?

  1. Option A: Deterministic Finite Automaton (DFA)
  2. Option B: Non-deterministic Finite Automaton (NFA)
  3. Option C: Pushdown Automaton (PDA)
  4. Option D: Mealy Machine
Show answer

Answer: C. Pushdown Automaton (PDA)

12. In a DFA, each state has exactly one transition for each input symbol.

  1. Option A: True
  2. Option B: False
  3. Option C: Depends on the alphabet size
  4. Option D: Depends on the number of states
Show answer

Answer: A. True

13. The pumping lemma for regular languages is used to:

  1. Option A: Prove a language is regular
  2. Option B: Prove a language is not regular
  3. Option C: Convert NFA to DFA
  4. Option D: Minimize DFA
Show answer

Answer: B. Prove a language is not regular

14. The regular expression (a|b)* represents:

  1. Option A: Any string of a's followed by b's
  2. Option B: Any string of a's and b's
  3. Option C: Any string with equal number of a's and b's
  4. Option D: Any string with alternating a's and b's
Show answer

Answer: B. Any string of a's and b's

15. Which of the following is NOT a regular language?

  1. Option A: All strings ending with 'ab'
  2. Option B: All strings with equal number of a's and b's
  3. Option C: All strings with even length
  4. Option D: All strings containing the substring 'aba'
Show answer

Answer: B. All strings with equal number of a's and b's

16. State minimization in DFA is done to:

  1. Option A: Increase the language recognition capability
  2. Option B: Reduce the number of states without changing the language
  3. Option C: Convert NFA to DFA
  4. Option D: Make the automaton non-deterministic
Show answer

Answer: B. Reduce the number of states without changing the language

17. Which of the following is true about NFAs and DFAs?

  1. Option A: NFAs are more powerful than DFAs
  2. Option B: DFAs are more powerful than NFAs
  3. Option C: NFAs and DFAs have equivalent computational power
  4. Option D: NFAs can recognize context-free languages but DFAs cannot
Show answer

Answer: C. NFAs and DFAs have equivalent computational power

18. The minimum number of states required for a DFA to recognize the language of all strings ending with '01' is:

  1. Option A: 2
  2. Option B: 3
  3. Option C: 4
  4. Option D: 5
Show answer

Answer: B. 3

19. Which of the following languages can be recognized by a DFA but not by a regular expression?

  1. Option A: All strings ending with 'ab'
  2. Option B: All strings with even number of a's
  3. Option C: All strings with equal number of a's and b's
  4. Option D: None, DFAs and regular expressions are equivalent
Show answer

Answer: D. None, DFAs and regular expressions are equivalent

20. Which of the following is NOT a characteristic of a Mealy machine?

  1. Option A: Output depends on current state and input
  2. Option B: Output depends only on current state
  3. Option C: It is a type of finite state machine
  4. Option D: It can be converted to a Moore machine
Show answer

Answer: B. Output depends only on current state

21. A Moore machine differs from a Mealy machine in that:

  1. Option A: Output depends only on current state
  2. Option B: Output depends on current state and input
  3. Option C: It has fewer states
  4. Option D: It cannot be minimized
Show answer

Answer: A. Output depends only on current state

6.2 Introduction to context-free languages

18 questions · ACtE0602

22. What type of grammar for PDA?

  1. Option A: Type 0
  2. Option B: Type 1
  3. Option C: Type 2
  4. Option D: Type 3
Show hint

Context-free language.

Show answer

Answer: C. Type 2

PDAs recognize Type 2 (context-free) grammars and languages.

23. In a context-free grammar (CFG), what does a parse tree represent?

  1. Option A: The order in which terminals are read from left to right.
  2. Option B: A hierarchical structural derivation of how a start symbol generates a string in the language using production rules.
  3. Option C: A tree that always has the same shape for every string.
  4. Option D: A binary decision tree for membership testing.
Show hint

Think about non-terminals as interior nodes and terminals as leaves.

Show answer

Answer: B. A hierarchical structural derivation of how a start symbol generates a string in the language using production rules.

A parse tree (also called derivation tree) in the context of a context-free grammar (CFG) visually represents how a string in the language is derived from the start symbol using the grammar's productions. Given a CFG G = (V, Σ, R, S): • V: set of non-terminals, • Σ: set of terminals, • R: set of production rules of the form A → α, • S: start symbol. A parse tree has the following properties: • The root of the tree is labeled with the start symbol S. • Each interior node is labeled with a non-terminal A ∈ V. • Each leaf node is labeled with a terminal symbol ∈ Σ or with ε. • For each interior node labeled A, with children labeled α₁, α₂, …, α_k (in order), there is a production rule A → α₁α₂…α_k in R. The *yield* of a parse tree is the string obtained by reading off the leaf nodes from left to right, ignoring ε leaves. This yield is a string in the language generated by the grammar. Parse trees encode the *syntactic structure* of a string according to a grammar. The tree reveals hierarchy, such as which substrings group together as subexpressions, phrases, or statements. This is essential in compilers, where syntax trees are used as intermediate representations for semantic analysis and code generation. Different derivations (leftmost vs rightmost) of the same string can lead to the same parse tree, but an *ambiguous grammar* allows at least one string with *two distinct parse trees*. So parse trees are also central for discussing ambiguity in context-free grammars.

24. What is an ambiguous grammar?

  1. Option A: A grammar that generates no strings.
  2. Option B: A grammar for which at least one string in the language has more than one distinct parse tree.
  3. Option C: A grammar whose productions are not in Chomsky Normal Form.
  4. Option D: A grammar that generates an infinite language.
Show hint

Think about multiple structural interpretations of the same terminal string.

Show answer

Answer: B. A grammar for which at least one string in the language has more than one distinct parse tree.

A context-free grammar G is called *ambiguous* if there exists at least one string w in L(G) that has two or more distinct parse trees (equivalently, two distinct leftmost or rightmost derivations). Ambiguity is about *syntactic structure*, not just membership. The same string w can be derived in two structurally different ways, leading to different parse trees. This means the grammar does not specify a unique structure for that string, which is problematic for many applications (e.g., programming languages, where meaning depends on structure). Example: Classic arithmetic expression grammar: E → E + E | E * E | (E) | id The expression "id + id * id" can be parsed as: 1. (id + id) * id (if + has higher precedence) 2. id + (id * id) (if * has higher precedence) Both are allowed by this grammar, and hence the grammar is ambiguous. To remove ambiguity, we refine the grammar by encoding operator precedence and associativity: E → E + T | T T → T * F | F F → (E) | id This new grammar ensures that * has higher precedence than +, and parse trees become unique for arithmetic expressions under these rules. Some context-free languages are *inherently ambiguous*, meaning that *every* grammar generating that language is ambiguous. For such languages, it is impossible to design an unambiguous grammar. In compiler design, unambiguous grammars (or controlled ambiguity resolved by precedence rules in the parser) are essential, since compilers need a unique parse for each source program.

25. What is the main purpose of converting a CFG into Chomsky Normal Form (CNF)?

  1. Option A: To reduce the language to a regular language.
  2. Option B: To restrict productions to either A → BC or A → a, which simplifies theoretical proofs (like CYK parsing algorithm) and analysis.
  3. Option C: To allow ε-productions in every rule.
  4. Option D: To ensure the grammar is unambiguous.
Show hint

Think about normal forms as canonical shapes that make algorithms easier.

Show answer

Answer: B. To restrict productions to either A → BC or A → a, which simplifies theoretical proofs (like CYK parsing algorithm) and analysis.

Chomsky Normal Form (CNF) is a restricted form of CFG in which every production is of one of the following forms: 1. A → BC (two non-terminals on the right-hand side), 2. A → a (a single terminal), 3. S → ε (only allowed if the language includes the empty string and S does not appear on the right-hand side of any rule). The main purposes for converting to CNF are: • To simplify theoretical analysis of context-free languages. • To support algorithms like the CYK (Cocke–Younger–Kasami) parsing algorithm, which assumes CNF. • To show closure properties and decidability results more easily. Transformation steps (overview): 1. Eliminate null (ε) productions, except possibly S → ε. 2. Eliminate unit productions (A → B). 3. Eliminate useless symbols (non-terminals that cannot derive any terminal string or are not reachable from S). 4. Convert remaining long right-hand sides into binary form using new non-terminals. 5. Ensure right-hand sides with a mixture of terminals and non-terminals are adjusted so that terminals appear alone (introduce new non-terminals for terminals if needed). Important points: • Language preserved: The new grammar generates the same language (possibly adjusting for ε). • CNF does *not* guarantee unambiguity. An ambiguous grammar can be converted to a different ambiguous grammar in CNF. • CNF is not for practical parser implementation (parsers often use other forms), but it is very useful in proofs (e.g., proving that every context-free language has a polynomial-time membership algorithm). Thus, CNF is a canonical restricted form that simplifies reasoning about context-free grammars and supports theoretically clean parsing algorithms.

26. What is a Pushdown Automaton (PDA) and how does it relate to context-free languages?

  1. Option A: A finite automaton with multiple tapes, used to recognize regular languages.
  2. Option B: A finite automaton equipped with a stack, used to recognize exactly the class of context-free languages.
  3. Option C: A Turing machine with no tape.
  4. Option D: A device equivalent to a DFA.
Show hint

Think about the additional memory resource needed to handle languages like a^n b^n.

Show answer

Answer: B. A finite automaton equipped with a stack, used to recognize exactly the class of context-free languages.

A Pushdown Automaton (PDA) extends finite automata with an additional *stack* memory. Formally, a PDA is a 7-tuple: M = (Q, Σ, Γ, δ, q₀, Z₀, F) where: • Q is the finite set of states, • Σ is input alphabet, • Γ is stack alphabet, • δ is transition function (Q × Σ_ε × Γ → P(Q × Γ*)), • q₀ is start state, • Z₀ is initial stack symbol, • F is set of accepting states. The stack allows the PDA to store unbounded information (in a last-in, first-out manner), enabling it to handle nested and balanced structures that finite automata cannot. Relationship to CFLs: • Every context-free language (CFL) can be recognized by some PDA (often built from a CFG via standard constructions). • Conversely, for every PDA there exists a CFG that generates exactly the same language. • Therefore, PDAs and CFGs are equivalent in expressive power: both characterize context-free languages. Intuition: • Regular languages are not powerful enough to handle patterns that require counting or nested dependencies (e.g., a^n b^n, balanced parentheses). A finite automaton has only finitely many states and hence limited memory. • PDA's stack allows it to remember an unbounded number of symbols (e.g., count of 'a's) as long as the computation is well-structured. Example: Language L = { a^n b^n | n ≥ 0 }. • PDA can push a symbol onto the stack for each a read, then pop one symbol for each b read. If stack is empty exactly when input ends, accept. Acceptance conditions for PDA: • Acceptance by final state: reach an accepting state after consuming entire input (stack may be non-empty or empty depending on design). • Acceptance by empty stack: consume input and empty the stack (final state not necessarily required). Thus, PDA is the machine model corresponding to context-free grammars, just as finite automata correspond to regular expressions.

27. What does the pumping lemma for context-free languages state, in contrast to the pumping lemma for regular languages?

  1. Option A: It states that CFLs are closed under complement.
  2. Option B: It gives a decomposition w = uvxyz with two pumpable parts v and y, instead of one (y) as in the regular pumping lemma.
  3. Option C: It shows that all context-free languages are regular.
  4. Option D: It says that any context-free grammar can be pumped into CNF.
Show hint

Recall the conditions: |v y| > 0, |v x y| ≤ p, and u v^i x y^i z ∈ L for all i ≥ 0.

Show answer

Answer: B. It gives a decomposition w = uvxyz with two pumpable parts v and y, instead of one (y) as in the regular pumping lemma.

The pumping lemma for context-free languages (CFLs) is a necessary condition for a language to be context-free, analogous in spirit to the pumping lemma for regular languages, but with a more complex decomposition. Formal (informal) statement: If L is an infinite context-free language, then there exists a constant p (pumping length) such that any string w in L with |w| ≥ p can be written as w = u v x y z satisfying: 1. |v y| > 0 (at least one of v or y is non-empty), 2. |v x y| ≤ p (the 'middle' portion has bounded length), 3. For all i ≥ 0, the string u v^i x y^i z ∈ L. Key differences from regular pumping lemma: • Regular lemma decomposes w into xyz with only one repeated segment y. • CFL lemma decomposes w into uvxyz with two pumpable substrings v and y, which are pumped *in parallel* (both repeated i times). • The decomposition is based on repeated non-terminals in a sufficiently deep parse tree derived from the pumping length. Usage: • Like the regular pumping lemma, it is primarily a *negative* tool: to prove that a language is *not* context-free by showing it fails the lemma. • Typical strategy: assume L is context-free, let p be pumping length, choose a particular w ∈ L with |w| ≥ p, consider all possible decompositions into uvxyz satisfying the conditions, and show there exists some i (often 0 or 2) such that u v^i x y^i z ∉ L. Example: L = { a^n b^n c^n | n ≥ 0 }. • Intuitively non context-free (requires two equalities: number of a's = b's and b's = c's). • Use pumping lemma for CFL to show any uvxyz decomposition cannot preserve both equalities for all i. Important: As with the regular pumping lemma, the CFL pumping lemma is necessary but not sufficient. Some non-context-free languages may still satisfy the lemma, but no context-free language can violate it. Also, it is strictly weaker than other characterizations like Ogden’s lemma, which is often more convenient for non-CFL proofs.

28. Which of the following Machine is specific for Context free grammar?

NEC model set
  1. Option A: Finite state automata
  2. Option B: Push down automata
  3. Option C: Linear bounded automata
  4. Option D: Turing Machine
Show hint

Context-free grammars need the ability to remember nested structures. What machine has a stack?

Show answer

Answer: B. Push down automata

Push-down automata (PDA) is the specific machine for context-free grammars (CFG). PDA characteristics: (1) Adds a stack to FSM - Can store and retrieve unlimited information (within bounds of problem), (2) Recognizes context-free languages, (3) Useful for parsing programming languages. Automata hierarchy and languages: (1) FSM - Recognizes Regular languages, no memory, (2) PDA - Recognizes Context-free languages, has stack, (3) Linear Bounded Automata - Recognizes Context-sensitive languages, limited tape, (4) Turing Machine - Recognizes Recursively enumerable languages, unlimited tape. Why PDA for CFG: (1) Stack allows matching nested structures (parentheses, brackets), (2) Can parse recursive grammars, (3) Can recognize patterns like anbn (equal a's then b's), (4) Directly corresponds to grammar derivation. Practical applications: (1) Compiler parsing - Use PDA for syntax analysis, (2) Expression evaluation - Parentheses matching, (3) Programming language design - CFG describes language syntax. PDA implementation: (1) Scan input, (2) Push/pop from stack based on input and current state, (3) Accept if input consumed and stack in correct state. Formal definition: PDA = (Q, Σ, Γ, δ, q0, Z0, F) where Q = states, Σ = input alphabet, Γ = stack alphabet, δ = transition function, q0 = initial state, Z0 = initial stack symbol, F = final states.

29. In CFG (Context-Free Grammar), what does ε represent?

NEC model set
  1. Option A: a) Terminal
  2. Option B: b) Non-terminal
  3. Option C: c) Empty string
  4. Option D: d) Start symbol
Show hint

This symbol represents nothing or empty input in grammar. What is it?

Show answer

Answer: C. c) Empty string

In CFG (Context-Free Grammar), ε (epsilon) represents the empty string. It denotes zero-length string or no input. ε production allows a non-terminal to derive nothing, enabling optional grammar elements. For example: A → ε means non-terminal A can produce an empty string. This is useful for making parts of grammar optional without creating ambiguity.

30. Which of the following can recognize the language {a^n b^n | n ≥ 1}?

  1. Option A: DFA
  2. Option B: NFA
  3. Option C: PDA
  4. Option D: Regular Expression
Show answer

Answer: C. PDA

31. A context-free grammar is ambiguous if:

  1. Option A: It has multiple production rules
  2. Option B: It can generate strings not in the language
  3. Option C: It has multiple parse trees for some string
  4. Option D: It has recursive production rules
Show answer

Answer: C. It has multiple parse trees for some string

32. Which parsing technique builds the parse tree from bottom to top?

  1. Option A: Top-down parsing
  2. Option B: Bottom-up parsing
  3. Option C: Recursive descent parsing
  4. Option D: Predictive parsing
Show answer

Answer: B. Bottom-up parsing

33. Chomsky Normal Form (CNF) restricts production rules to:

  1. Option A: A → BC or A → a
  2. Option B: A → aB or A → a
  3. Option C: A → a or A → ε
  4. Option D: A → B or A → a
Show answer

Answer: A. A → BC or A → a

34. The pumping lemma for context-free languages is used to:

  1. Option A: Prove a language is context-free
  2. Option B: Prove a language is not context-free
  3. Option C: Convert CFG to PDA
  4. Option D: Minimize CFG
Show answer

Answer: B. Prove a language is not context-free

35. Which of the following is NOT a property of context-free languages?

  1. Option A: Closure under union
  2. Option B: Closure under intersection
  3. Option C: Closure under concatenation
  4. Option D: Closure under Kleene star
Show answer

Answer: B. Closure under intersection

36. Which of the following is true about context-free grammars and regular grammars?

  1. Option A: All regular grammars are context-free
  2. Option B: All context-free grammars are regular
  3. Option C: Regular and context-free grammars are equivalent
  4. Option D: Regular and context-free grammars are disjoint
Show answer

Answer: A. All regular grammars are context-free

37. A grammar with productions S → aSb | ε generates the language:

  1. Option A: a^n b^n for n ≥ 0
  2. Option B: a^n b^m for n, m ≥ 0
  3. Option C: a^n b^n for n > 0
  4. Option D: a^n b^m for n > m ≥ 0
Show answer

Answer: A. a^n b^n for n ≥ 0

38. A pushdown automaton (PDA) differs from a finite automaton by having:

  1. Option A: Multiple states
  2. Option B: Multiple transitions
  3. Option C: A stack
  4. Option D: Multiple input tapes
Show answer

Answer: C. A stack

39. Backus-Naur Form (BNF) is used for:

  1. Option A: Describing regular languages
  2. Option B: Describing context-free grammars
  3. Option C: Minimizing DFAs
  4. Option D: Converting NFA to DFA
Show answer

Answer: B. Describing context-free grammars

6.3 Turing machines

19 questions · ACtE0603

40. Universal Turing Machine characteristic?

  1. Option A: Programmable
  2. Option B: Fixed
  3. Option C: Analog
  4. Option D: Quantum
Show hint

Can simulate any TM.

Show answer

Answer: A. Programmable

UTM is programmable to simulate any other Turing machine.

41. Turing machine tuples?

  1. Option A: 5
  2. Option B: 6
  3. Option C: 7
  4. Option D: 8
Show hint

Formal definition.

Show answer

Answer: C. 7

Turing machine has 7-tuple definition.

42. Which of the following best describes a Turing machine (TM) as a model of computation?

  1. Option A: A finite automaton with a stack.
  2. Option B: An automaton with finite control, a read-only input tape, and no memory.
  3. Option C: An automaton with finite control and an infinite tape used as both input and unbounded memory, capable of simulating any effective algorithm.
  4. Option D: A special kind of pushdown automaton.
Show hint

Think of a head moving left and right on an infinite tape, reading and writing symbols.

Show answer

Answer: C. An automaton with finite control and an infinite tape used as both input and unbounded memory, capable of simulating any effective algorithm.

A Turing machine (TM) is a mathematical abstraction proposed by Alan Turing to capture the intuitive notion of an effective procedure or algorithm. It consists of: • A finite set of states (finite control), including start and possibly accepting/rejecting states. • An infinite tape divided into discrete cells, each cell holding one symbol from a tape alphabet Γ (which contains the input alphabet Σ and a blank symbol ␣). • A tape head that can read and write symbols on the tape and move one cell left or right at each step. A TM configuration is determined by its current state, current tape content, and current head position. A transition function typically has the form: δ : Q × Γ → Q × Γ × {L, R} This means: depending on the current state and tape symbol, the machine writes a new symbol, moves the head left or right, and enters a new state. Why it is powerful: • The infinite tape provides unbounded memory, unlike finite automata or PDA (which has stack but restricted access pattern). • Turing machines can simulate any algorithm that can be executed by a real computer (ignoring resource limitations like time and memory). This leads to the *Church–Turing thesis*: the class of functions that are computable by a TM coincides with the class of functions intuitively computable by any effective method. Variants: • Multi-tape TMs, multi-track tapes, non-deterministic TMs, etc., which are all equivalent in power to the standard TM. They may differ in time complexity but not in the class of decidable languages. TM as language recognizer: • Accepts a string if it eventually enters an accepting state while processing that string, possibly halting. • If it never halts on some input, the language is only *semi-decidable* (recursively enumerable). Thus, the Turing machine is a core model for the theory of computation, providing a benchmark for what can and cannot be computed algorithmically.

43. What is a Universal Turing Machine (UTM)?

  1. Option A: A TM that can recognize only regular languages.
  2. Option B: A TM that simulates any other TM when given that TM’s description and input as its own input.
  3. Option C: A TM that has infinitely many states.
  4. Option D: A TM that always halts on every input.
Show hint

Think of it like an interpreter that takes another machine plus its input encoded on the tape.

Show answer

Answer: B. A TM that simulates any other TM when given that TM’s description and input as its own input.

A Universal Turing Machine (UTM) is a single Turing machine U that can simulate the behavior of *any* other Turing machine M on any input w, provided that an appropriate encoding of (M, w) is given as input on U's tape. Formally: • Let ⟨M⟩ represent an encoding (as a string) of the description of some TM M (its states, transition function, and so on). • Define a universal machine U such that for all M and w: U(⟨M⟩, w) simulates M(w) • If M halts and accepts w, then U also halts and accepts ⟨M⟩, w. If M halts and rejects, U does the same. If M does not halt, U does not halt. Conceptual significance: • It shows that a single fixed machine can interpret descriptions of programs and execute them, which is essentially what modern stored-program computers do. • Demonstrates that data and programs can be encoded uniformly as strings; a UTM can treat both as input. • This underpins the notion of *software* being data for a general-purpose hardware machine. Encoding: • Turing machines, states, symbols, and transitions are all encoded as strings over some alphabet (e.g., binary) using a systematic scheme. • The universal machine parses this encoding and then simulates transitions of the encoded machine step by step. Church–Turing Thesis connection: • The existence of a UTM supports the idea that all effectively calculable functions can be computed by one fixed machine that takes a program (encoding of an algorithm) and input data. In complexity theory, variants of universal machines are considered when discussing simulation overhead, compilation, and interpretation costs. But from a language-recognition perspective, a UTM is simply a TM that can emulate any other TM when given its description.

44. In computational complexity for Turing machines, what do time complexity and space complexity measure?

  1. Option A: Time complexity counts number of states, space complexity counts number of symbols in the alphabet.
  2. Option B: Time complexity is the number of steps the TM takes for an input of length n; space complexity is the number of tape cells it scans or writes on for that input.
  3. Option C: Time complexity is memory used; space complexity is CPU frequency.
  4. Option D: Both are always equal for all algorithms.
Show hint

Think about how the TM's head moves and how many cells it uses.

Show answer

Answer: B. Time complexity is the number of steps the TM takes for an input of length n; space complexity is the number of tape cells it scans or writes on for that input.

In complexity theory, for a Turing machine M and an input x of length n = |x|: Time complexity: • The time complexity T_M(n) is defined as the maximum number of steps (state transitions) that M performs on any input of length n, over all inputs of that length. • Formally, T_M(n) = max_{|x|=n} t_M(x), where t_M(x) is the number of steps M takes on input x before halting. • Big-O notation is used: if T_M(n) ≤ c·n^k for large n, we say the algorithm runs in polynomial time O(n^k). Space complexity: • The space complexity S_M(n) is the maximum number of distinct tape cells that M scans or writes on any input of length n (excluding the input portion if you use separate work tapes in multi-tape models). • Formally, S_M(n) = max_{|x|=n} s_M(x), where s_M(x) is the number of cells used during computation. Why they matter: • Time and space give two primary resource measures for the feasibility of algorithms. • Classes like P (problems solvable in polynomial time) and PSPACE (problems solvable in polynomial space) are defined using these measures. • Intractability is often associated with super-polynomial or exponential time complexity, e.g., 2^n, n!. Relationship: • Any TM that uses S(n) space must take at least S(n) time, since each cell used must be visited at least once. • However, a machine can take huge time but very little space (e.g., repeatedly scanning the same small part of the tape). Practical analogies: • Time complexity ~ running time on a real computer. • Space complexity ~ memory consumption. In the context of the course, understanding these notions lets you talk about tractable vs intractable problems, complexity classes, and limitations of computation.

45. Turing machine (TM) is more powerful than FSM (Finite State Machine) because

NEC model set
  1. Option A: tape movement is confined to one direction
  2. Option B: it has no finite state
  3. Option C: it has the capability to remember arbitrarily long sequences of input symbols
  4. Option D: it has finite state
Show hint

Turing machines have unlimited memory through an infinite tape. What advantage does this provide?

Show answer

Answer: C. it has the capability to remember arbitrarily long sequences of input symbols

Turing machines are more powerful than FSMs because they have the capability to remember arbitrarily long sequences of input symbols through an unlimited tape. Key differences: (1) FSM - Fixed number of states, limited memory, (2) Turing Machine - States plus unlimited tape, can store and retrieve any amount of information. TM advantages: (1) Infinite tape acts as unlimited memory - Can move back and forth on tape, (2) Can solve undecidable problems that FSMs cannot, (3) Can simulate any algorithm (Church-Turing thesis), (4) Can implement arbitrary computational processes. TM capabilities: (1) Recognize recursively enumerable languages, (2) Compute any computable function, (3) Model any effective procedure. The tape allows: (1) Multiple passes through data, (2) Storage of intermediate results, (3) Complex pattern matching and computation. Incorrect options analysis: (1) "tape movement confined to one direction" - TM can move left or right, (2) "has no finite state" - TM has states, just with unlimited memory, (3) "has finite state" - Both have states. The power comes from unlimited memory (tape), not from the state structure. Practical implications: (1) TMs are theoretical model for computation, (2) Real computers approximate TMs (bounded tape = memory), (3) Some problems are computationally undecidable (halting problem). The TM model is fundamental to computer science theory.

46. The Halting Problem for Turing Machines is:

NEC model set
  1. Option A: a) Decidable
  2. Option B: b) Undecidable
  3. Option C: c) Always halts
  4. Option D: d) Only for deterministic Turing Machines
Show hint

Can we determine if any program will halt? This fundamental problem in CS is what?

Show answer

Answer: B. b) Undecidable

The Halting Problem for Turing Machines is Undecidable. This famous problem asks: given any program and input, can we determine if the program will halt (finish) or run forever? Alan Turing proved this is undecidable - no general algorithm exists that can solve this for all programs. This is one of the foundational results in computability theory, showing limits of computation.

47. According to the Church-Turing thesis, what can be computed by a Turing machine?

Recalled from Jan 2026 exam
  1. Option A: Only deterministic problems
  2. Option B: Anything that is algorithmically computable
  3. Option C: Only problems with polynomial time complexity
  4. Option D: Only finite state problems
Show hint

The Church-Turing thesis defines computational limits. What can be computed?

Show answer

Answer: B. Anything that is algorithmically computable

According to the Church-Turing thesis, a Turing machine can compute anything that is algorithmically computable. This thesis (though not formally proven, widely accepted) states that any computation that can be done by any algorithm can be simulated by a Turing machine. It's the foundation for understanding computational theory and the limits of computation. The thesis doesn't restrict to deterministic, polynomial-time, or finite-state problems. It establishes that Turing machines represent the ultimate model of computation—any more powerful model hasn't been discovered.

48. The Church-Turing thesis states that:

  1. Option A: All problems can be solved by a Turing machine
  2. Option B: Any algorithm can be simulated by a Turing machine
  3. Option C: Turing machines are more powerful than computers
  4. Option D: Computers are more powerful than Turing machines
Show answer

Answer: B. Any algorithm can be simulated by a Turing machine

49. A Universal Turing Machine can:

  1. Option A: Solve the halting problem
  2. Option B: Simulate any other Turing machine
  3. Option C: Recognize only regular languages
  4. Option D: Recognize only context-free languages
Show answer

Answer: B. Simulate any other Turing machine

50. A Turing machine can:

  1. Option A: Read only
  2. Option B: Write only
  3. Option C: Both read and write
  4. Option D: Neither read nor write
Show answer

Answer: C. Both read and write

51. A Turing machine consists of:

  1. Option A: Finite control, input tape, and stack
  2. Option B: Finite control, infinite tape, and read/write head
  3. Option C: Infinite control, finite tape, and read/write head
  4. Option D: Finite control, finite tape, and multiple heads
Show answer

Answer: B. Finite control, infinite tape, and read/write head

52. Time complexity of a Turing machine is measured by:

  1. Option A: Number of states
  2. Option B: Number of transitions
  3. Option C: Number of steps to halt
  4. Option D: Length of the input tape
Show answer

Answer: C. Number of steps to halt

53. P is the class of problems that can be solved in:

  1. Option A: Polynomial time
  2. Option B: Exponential time
  3. Option C: Logarithmic time
  4. Option D: Constant time
Show answer

Answer: A. Polynomial time

54. NP is the class of problems that can be:

  1. Option A: Solved in polynomial time
  2. Option B: Verified in polynomial time
  3. Option C: Solved in exponential time
  4. Option D: Not solved by any algorithm
Show answer

Answer: B. Verified in polynomial time

55. An NP-complete problem is:

  1. Option A: Easy to solve but hard to verify
  2. Option B: Hard to solve but easy to verify
  3. Option C: Both easy to solve and verify
  4. Option D: Both hard to solve and verify
Show answer

Answer: B. Hard to solve but easy to verify

56. Which of the following is NOT decidable for a Turing machine?

  1. Option A: Whether it accepts a specific input
  2. Option B: Whether it halts on a specific input
  3. Option C: Whether it accepts all inputs
  4. Option D: Whether it has a specific number of states
Show answer

Answer: B. Whether it halts on a specific input

57. Which of the following is NOT a property of a Turing-recognizable language?

  1. Option A: It can be recognized by a Turing machine
  2. Option B: It is recursively enumerable
  3. Option C: It is decidable
  4. Option D: It may not be decidable
Show answer

Answer: C. It is decidable

58. The halting problem is:

  1. Option A: Decidable
  2. Option B: Undecidable
  3. Option C: NP-complete
  4. Option D: In P but not in NP
Show answer

Answer: B. Undecidable

6.4 Introduction to computer graphics

22 questions · ACtE0604

59. What is the fastest line drawing algorithm?

Aasadh 2081 exam
  1. Option A: DDA algorithm
  2. Option B: Bresenham's algorithm
  3. Option C: Midpoint algorithm
  4. Option D: Xiaolin Wu's algorithm
Show hint

Which uses only integer arithmetic?

Show answer

Answer: B. Bresenham's algorithm

Bresenham's algorithm is the fastest because it uses only integer addition and subtraction.

60. Which is NOT a physical input device?

Aasadh 2081 exam
  1. Option A: Keyboard
  2. Option B: Mouse
  3. Option C: Touch panel
  4. Option D: Microphone
Show hint

Touch panels are both input and output devices.

Show answer

Answer: C. Touch panel

Touch panel is not purely a physical input device; it serves both input and display output functions.

61. Which component is responsible for processing graphical data and images?

  1. Option A: Central Processing Unit (CPU)
  2. Option B: Random Access Memory (RAM)
  3. Option C: Hard Disk Drive (HDD)
  4. Option D: Graphics Processing Unit (GPU)
Show answer

Answer: D. Graphics Processing Unit (GPU)

62. What does GUI stand for?

  1. Option A: General User Interface
  2. Option B: Graphical User Interface
  3. Option C: Global User Interaction
  4. Option D: Guided User Input
Show hint

Visual interface.

Show answer

Answer: B. Graphical User Interface

GUI = Graphical User Interface for user interaction.

63. Fastest line drawing algorithm?

  1. Option A: DDA
  2. Option B: Bresenham's
  3. Option C: Midpoint
  4. Option D: Wu's
Show hint

Integer-only arithmetic.

Show answer

Answer: B. Bresenham's

Bresenham's is fastest using only integer operations.

64. What symbol in dimensionality?

  1. Option A: Rational
  2. Option B: Real
  3. Option C: Relative
  4. Option D: Random
Show hint

Mathematical set.

Show answer

Answer: B. Real

R represents real numbers in mathematics.

65. Interactive graphics components?

  1. Option A: Monitor
  2. Option B: Controller
  3. Option C: Frame buffer
  4. Option D: All
Show hint

All needed for graphics.

Show answer

Answer: D. All

Monitor, display controller, and frame buffer all needed for interactive graphics.

66. In computer graphics, what is the key conceptual difference between raster-scan and vector (random-scan) displays?

  1. Option A: Raster-scan draws images as a matrix of pixels, while vector display draws images by directly tracing line segments and curves.
  2. Option B: Raster-scan can only display text, vector display only images.
  3. Option C: Raster-scan has infinite resolution, vector display has fixed resolution.
  4. Option D: Vector displays use CRTs, raster-scan does not.
Show hint

Modern monitors (LCD, LED) are raster devices. Early graphic CRTs were often vector devices.

Show answer

Answer: A. Raster-scan draws images as a matrix of pixels, while vector display draws images by directly tracing line segments and curves.

The fundamental distinction lies in how the image is generated and refreshed on the screen: Raster-scan displays: • The screen is divided into a grid of discrete picture elements (pixels). • The display controller scans the screen line by line, from top-left to bottom-right (like reading text), refreshing every pixel at a fixed rate (refresh rate, e.g., 60 Hz, 120 Hz). • The frame buffer (video memory) stores the intensity/color of each pixel. The raster hardware converts this digital information into analog (or digital) signals for the display panel. • Modern monitors (CRT, LCD, LED, OLED) are all raster devices. Computer graphics APIs (OpenGL, DirectX) ultimately target a raster frame buffer. Vector (random-scan) displays: • Instead of scanning every pixel, the electron beam (in CRTs) directly draws geometric primitives (lines, curves) one by one. • The display commands specify endpoints of lines and curves; the hardware deflects the beam along those paths. • There is no fixed pixel grid; resolution can be very high for lines (until limited by the CRT and deflection speed). • These displays were used in early CAD/CAM, oscilloscopes, and specialized graphic terminals. Consequences: • Raster-scan: easier to handle general images (photographs, textures), supports filled regions, anti-aliasing via pixel operations; but needs large frame buffer and bandwidth. • Vector: excellent for crisp line drawings and simple wireframes; limited for filled shapes and shaded images; suffers from flicker when many primitives are drawn (refresh overhead). Architecture of raster-scan system includes: • Frame buffer, • Video controller, • Display device. Vector devices often have a display list of line-drawing commands. For your course, remember: *raster* = pixel grid + frame buffer; *vector* = direct beam tracing of primitives.

67. Vector displays directly control the:

NEC model set
  1. Option A: a) Brightness of each pixel
  2. Option B: b) Position of the electron beam
  3. Option C: c) Colour of the pixels only
  4. Option D: d) Refresh rate only
Show hint

Vector displays draw lines by controlling what? Not pixels but electron beams.

Show answer

Answer: B. b) Position of the electron beam

Vector displays directly control the position of the electron beam. Instead of raster (pixel-based) displays that refresh all pixels, vector displays draw lines by moving the electron beam to specific coordinates. Vectors specify endpoints, and the display draws lines directly between them. This allows efficient drawing of line-based graphics. Vector displays were common in oscilloscopes and early computer graphics. Raster displays eventually replaced them for general-purpose computing.

68. What coating material is used on the screen of a CRT (Cathode Ray Tube) display?

Recalled from Jan 2026 exam
  1. Option A: Aluminum
  2. Option B: Phosphor
  3. Option C: Silicon
  4. Option D: Copper
Show hint

CRT screens need a material that glows when hit by electrons. What is it?

Show answer

Answer: B. Phosphor

Phosphor is the coating material used on the screen of a CRT (Cathode Ray Tube) display. The phosphor coating glows (fluoresces) when struck by electrons from the electron beam. Different phosphors have different colors and persistence characteristics. When the electron beam scans across the screen, the phosphor emits light at those points, creating the image. After the beam passes, the phosphor continues to glow briefly (persistence) before fading. This persistence needs to be fast enough to prevent flicker. Phosphor-based displays were the standard for televisions and computer monitors before LCD/LED technology.

69. The basic unit of a raster display is:

  1. Option A: Line
  2. Option B: Pixel
  3. Option C: Vector
  4. Option D: Polygon
Show answer

Answer: B. Pixel

70. Which of the following is a raster display technology?

  1. Option A: Vector display
  2. Option B: CRT display
  3. Option C: Random scan display
  4. Option D: Calligraphic display
Show answer

Answer: B. CRT display

71. Graphics standards are important for:

  1. Option A: Hardware compatibility
  2. Option B: Software portability
  3. Option C: Both A and B
  4. Option D: Neither A nor B
Show answer

Answer: C. Both A and B

72. Vector displays are characterized by:

  1. Option A: Drawing images pixel by pixel
  2. Option B: Drawing images line by line
  3. Option C: Refreshing the entire screen
  4. Option D: Low resolution
Show answer

Answer: B. Drawing images line by line

73. Which of the following is NOT an input device for computer graphics?

  1. Option A: Mouse
  2. Option B: Joystick
  3. Option C: Printer
  4. Option D: Trackball
Show answer

Answer: C. Printer

74. OpenGL is an example of:

  1. Option A: Graphics hardware
  2. Option B: Graphics API
  3. Option C: Display technology
  4. Option D: Input device
Show answer

Answer: B. Graphics API

75. The resolution of a raster display is measured in:

  1. Option A: Dots per inch (DPI)
  2. Option B: Pixels
  3. Option C: Refresh rate
  4. Option D: Color depth
Show answer

Answer: B. Pixels

76. Which color model is based on light addition?

  1. Option A: RGB
  2. Option B: CMYK
  3. Option C: HSV
  4. Option D: YUV
Show answer

Answer: A. RGB

77. The frame buffer in a graphics system stores:

  1. Option A: Display processor instructions
  2. Option B: Pixel color values
  3. Option C: Transformation matrices
  4. Option D: Input device data
Show answer

Answer: B. Pixel color values

78. Which of the following is NOT a primitive in computer graphics?

  1. Option A: Point
  2. Option B: Line
  3. Option C: Polygon
  4. Option D: Algorithm
Show answer

Answer: D. Algorithm

79. Anti-aliasing techniques are used to:

  1. Option A: Increase rendering speed
  2. Option B: Reduce jagged edges in raster images
  3. Option C: Compress image data
  4. Option D: Enhance image brightness
Show answer

Answer: B. Reduce jagged edges in raster images

80. Bezier curves are used in computer graphics for:

  1. Option A: Representing straight lines
  2. Option B: Representing smooth curves
  3. Option C: Hidden surface removal
  4. Option D: Color interpolation
Show answer

Answer: B. Representing smooth curves

6.5 Two-dimensional transformation

23 questions · ACtE0605

81. What shape does a unit square become after shearing?

Aasadh 2081 exam
  1. Option A: Rectangle
  2. Option B: Parallelogram
  3. Option C: Rhombus
  4. Option D: Trapezoid
Show hint

Shearing slides one direction relative to another.

Show answer

Answer: B. Parallelogram

Shearing transformation converts a unit square into a parallelogram by shifting one direction relative to another.

82. Which transformation changes size in different directions?

Aasadh 2081 exam
  1. Option A: Translation
  2. Option B: Rotation
  3. Option C: Scaling
  4. Option D: Reflection
Show hint

Resize object dimensions.

Show answer

Answer: C. Scaling

Scaling transformation resizes objects, potentially in different amounts for different directions (non-uniform scaling).

83. What is viewport definition?

  1. Option A: Virtual machine
  2. Option B: Monitor type
  3. Option C: Browser visible area
  4. Option D: Graphics card
Show hint

What user sees.

Show answer

Answer: C. Browser visible area

Viewport is the visible area of webpage in browser window.

84. What transformation resizes object?

  1. Option A: Translation
  2. Option B: Rotation
  3. Option C: Scaling
  4. Option D: Shearing
Show hint

Changes dimensions.

Show answer

Answer: C. Scaling

Scaling transformation changes object size.

85. Shearing transforms square to?

  1. Option A: Rectangle
  2. Option B: Parallelogram
  3. Option C: Rhombus
  4. Option D: Trapezoid
Show hint

Slide transformation.

Show answer

Answer: B. Parallelogram

Shearing transforms square to parallelogram.

86. 2D rotation plane?

  1. Option A: 3D
  2. Option B: 2D
  3. Option C: XY
  4. Option D: XZ
Show hint

Two dimensions.

Show answer

Answer: B. 2D

2D rotation occurs in 2D plane.

87. Transformation distorts shape?

  1. Option A: Rotation
  2. Option B: Scaling
  3. Option C: Shearing
  4. Option D: Translation
Show hint

Slides internally.

Show answer

Answer: C. Shearing

Shearing distorts shape making layers slide over each other.

88. In 2D geometric transformations, how is a point (x, y) translated by (tx, ty) using homogeneous coordinates?

  1. Option A: By multiplying [x y 1]^T with a scaling matrix.
  2. Option B: By multiplying [x y 1]^T with the translation matrix T = [[1 0 0],[0 1 0],[tx ty 1]].
  3. Option C: By adding (tx, ty) directly without any matrix form.
  4. Option D: Translation cannot be represented as a matrix operation.
Show hint

Recall the 3×3 homogeneous matrix for 2D translation.

Show answer

Answer: B. By multiplying [x y 1]^T with the translation matrix T = [[1 0 0],[0 1 0],[tx ty 1]].

In 2D graphics, homogeneous coordinates are used to represent geometric transformations uniformly as matrix multiplications, which allows composition via matrix multiplication. A 2D point (x, y) is represented in homogeneous form as a 3-component column vector: P = [ x y 1 ]^T The 2D translation by (t_x, t_y) can be written as a 3×3 matrix: T = [ 1 0 0 0 1 0 t_x t_y 1 ] Then the transformed point P' is computed as: P' = P ·? or T · P Be careful with conventions. With column vectors, we typically use: P' = T × P So: [ x' ] [ 1 0 0 ] [ x ] [ x + t_x ] [ y' ] = [ 0 1 0 ] [ y ] = [ y + t_y ] [ 1 ] [ t_x t_y 1 ] [ 1 ] [ 1 ] Thus, homogeneous coordinates allow translation to be handled as a linear operation in 3D space (affine in 2D), whereas in standard 2D coordinates translation is an addition, not representable by a 2×2 matrix alone. Advantages of homogeneous formulation: • Unified framework: translation, rotation, scaling, shear, reflection all expressible as 3×3 matrices. • Composite transformation: applying multiple transforms (e.g., scale then rotate then translate) becomes a single matrix multiplication T_total = T_translate · R · S. • Hardware-friendly: GPUs and graphics pipelines operate with matrix multiplications. Remember the key transformation matrices in homogeneous 2D: • Translation: as above. • Scaling: S = [[Sx 0 0],[0 Sy 0],[0 0 1]]. • Rotation by θ: R = [[cosθ -sinθ 0],[sinθ cosθ 0],[0 0 1]]. • Shear, reflection similarly with proper matrix forms. This homogeneous approach generalizes directly to 3D (4×4 matrices) in the next topic (ACtE0606).

89. A straight line segment is translated by applying the transformation equation

NEC model set
  1. Option A: P'P''
  2. Option B: Dx and Dy
  3. Option C: P''P'
  4. Option D: Cy
Show hint

Translation moves objects without rotation or scaling. What parameters specify the displacement?

Show answer

Answer: B. Dx and Dy

A straight line segment is translated by applying translation parameters Dx (horizontal displacement) and Dy (vertical displacement). Translation transformation: (1) New point = Old point + (Dx, Dy), (2) Algebraically: P' = P + T = (x+Dx, y+Dy), (3) Matrix form: [x', y'] = [x, y] + [Dx, Dy]. Properties of translation: (1) Preserves line length and angles, (2) Preserves parallelism, (3) Does not change shape or orientation, (4) Moves all points by same amount. For a line segment with endpoints (x₁, y₁) and (x₂, y₂): (1) New endpoints: (x₁+Dx, y₁+Dy) and (x₂+Dx, y₂+Dy), (2) Length unchanged, (3) Direction unchanged. Translation parameters: (1) Dx - Horizontal shift (positive = right, negative = left), (2) Dy - Vertical shift (positive = up, negative = down). Applications: (1) Computer graphics - Moving objects on screen, (2) CAD systems - Repositioning drawings, (3) Animation - Moving objects over time, (4) Coordinate transformation. Combined transformations: (1) Translate then rotate - Different result than rotate then translate, (2) Multiple translations - Add displacement vectors. The notation P'P'' refers to homogeneous coordinates, and Cy is incorrect. Dx and Dy are the correct parameters for translation.

90. What does composite transformations means?

NEC model set
  1. Option A: Transformations that can be done in sequence
  2. Option B: Transformations that cannot be done in sequence
  3. Option C: Transformations that can be done simultaneously
  4. Option D: Transformations that cannot be done simultaneously
Show hint

Composite means combining multiple operations. Can multiple transformations be applied one after another?

Show answer

Answer: A. Transformations that can be done in sequence

Composite transformations refer to transformations that can be applied in sequence to produce combined effects. Concept: (1) Apply one transformation to produce intermediate result, (2) Apply another transformation to the intermediate result, (3) Final result is composite of all transformations. Example sequence: (1) Translate point P to origin (T₁), (2) Rotate around origin (R), (3) Translate back (T₂), (4) Final: P' = T₂(R(T₁(P))). Matrix representation: (1) Composite = M₃ × M₂ × M₁ × P, (2) Single composite matrix = product of individual matrices, (3) Can precompute composite matrix for efficiency. Important property: (1) Matrix multiplication is NOT commutative, (2) Order of transformations matters, (3) Translate-then-rotate ≠ Rotate-then-translate. Applications: (1) Complex object manipulations - Rotation about arbitrary point, (2) Animation sequences - Multiple transformations over time, (3) Hierarchical transformations - Parent-child object relationships, (4) Graphics pipelines - Standard rendering process. Standard composite for rotation about arbitrary point: (1) Translate to origin, (2) Rotate, (3) Translate back. Practical benefits: (1) Efficiency - Single matrix multiplication instead of multiple, (2) Simplicity - Expresses complex operations as sequence of simple ones, (3) Code clarity - Describes intentions step by step. This is fundamental to computer graphics and transformation theory.

91. Which of the following properties is NOT preserved under shear?

NEC model set
  1. Option A: a) Parallelism
  2. Option B: b) Area
  3. Option C: c) Angles
  4. Option D: d) Collinearity
Show hint

Shear transformation preserves some properties but not others. What gets changed?

Show answer

Answer: C. c) Angles

Angles are NOT preserved under shear transformation. Shear preserves: (1) Parallelism - parallel lines remain parallel, (2) Area - areas of shapes are preserved, (3) Collinearity - collinear points remain collinear. However, shear does NOT preserve angles - right angles may become acute/obtuse after shearing. This is why shear is useful in graphics for creating italic/slanted text effects.

92. If a circle's circumference is to be translated to a new point, what should be translated?

Past question
  1. Option A: Centre
  2. Option B: Centre with Radius
  3. Option C: Outline Points
  4. Option D: Radius
Show hint

Translation moves objects uniformly. A circle is defined by its center and radius.

Show answer

Answer: A. Centre

To translate a circle to a new point, the Centre should be translated. Translation Concept: (1) Geometric transformation that moves objects, (2) All points move same distance and direction, (3) Preserves shape and size, (4) Defined by translation vector (Δx, Δy). Circle Definition: (1) A circle is defined by center (h, k) and radius r, (2) All points equidistant from center, (3) Equation: (x-h)² + (y-k)² = r². Why Only Centre Needs Translation: (1) Circle defined by two parameters: center and radius, (2) Radius unchanged in translation, (3) Only center position changes, (4) Radius remains the same distance from new center. Translation of Circle: (1) Old circle: center C1(h1, k1), radius r, (2) New circle: center C2(h2, k2), radius r, (3) All points move by vector (h2-h1, k2-k1), (4) Radius unchanged. Mathematical Representation: (1) New center = old center + translation vector, (2) C' = C + T = (h+Δx, k+Δy), (3) Radius r' = r (unchanged). Boundary Points Translation: (1) Outline points also translate by same vector, (2) But not necessary to specify - Center determines circle, (3) Once center translated, circle shape automatically moves. Why Not Other Options: (1) Centre with Radius - Radius stays same, not translated, (2) Outline Points - All move same, redundant to specify all, (3) Radius alone - Wouldn't move circle, changes size. Properties Preserved: (1) Shape - Circle remains circle, (2) Size - Radius unchanged, (3) Orientation - No rotation, (4) Distance - Between any two points same. Application: (1) Computer graphics - Moving shapes, (2) CAD systems - Relocating designs, (3) Animation - Moving objects, (4) Geometric proofs - Transformation properties. Multiple Translations: (1) Can apply multiple translations sequentially, (2) Net effect is sum of vectors, (3) Order doesn't matter (commutative), (4) Inverse translation reverses. This demonstrates transformation geometry principles.

93. Which type of transformation changes the shape of an object?

Recalled from Jan 2026 exam
  1. Option A: Translation
  2. Option B: Rotation
  3. Option C: Scaling
  4. Option D: Shear
Show hint

Most transformations preserve shape. Which one distorts it?

Show answer

Answer: D. Shear

Shear is the type of transformation that changes the shape of an object. In a shear transformation, one or more coordinates of points are displaced proportionally to other coordinates. Translation moves objects without changing shape or size. Rotation turns objects without changing shape or size. Scaling changes size but preserves proportions (shape). Only shear actually distorts and changes the shape of an object. Shear is used in graphics to create italic/slanted text, skew effects, and perspective corrections. The amount of shear is determined by a shear parameter.

94. The 2D translation transformation:

  1. Option A: Changes the size of an object
  2. Option B: Changes the position of an object
  3. Option C: Changes the orientation of an object
  4. Option D: Changes the shape of an object
Show answer

Answer: B. Changes the position of an object

95. The 2D rotation transformation rotates an object around:

  1. Option A: X-axis
  2. Option B: Y-axis
  3. Option C: Z-axis
  4. Option D: Origin
Show answer

Answer: D. Origin

96. The 2D scaling transformation:

  1. Option A: Changes the position of an object
  2. Option B: Changes the size of an object
  3. Option C: Changes the orientation of an object
  4. Option D: Changes the color of an object
Show answer

Answer: B. Changes the size of an object

97. Which transformation changes the shape of an object?

  1. Option A: Translation
  2. Option B: Rotation
  3. Option C: Scaling
  4. Option D: Shear
Show answer

Answer: D. Shear

98. A composite transformation is:

  1. Option A: A single transformation
  2. Option B: Multiple transformations applied in sequence
  3. Option C: A transformation that cannot be represented by a matrix
  4. Option D: A transformation that changes color
Show answer

Answer: B. Multiple transformations applied in sequence

99. The 2D viewing pipeline converts:

  1. Option A: World coordinates to device coordinates
  2. Option B: Device coordinates to world coordinates
  3. Option C: World coordinates to 3D coordinates
  4. Option D: 3D coordinates to 2D coordinates
Show answer

Answer: A. World coordinates to device coordinates

100. The Cohen-Sutherland algorithm is used for:

  1. Option A: Line clipping
  2. Option B: Polygon clipping
  3. Option C: Circle clipping
  4. Option D: Text clipping
Show answer

Answer: A. Line clipping

101. Clipping in computer graphics is:

  1. Option A: Removing parts of objects outside the viewing window
  2. Option B: Joining multiple objects
  3. Option C: Changing object colors
  4. Option D: Rotating objects
Show answer

Answer: A. Removing parts of objects outside the viewing window

102. The Liang-Barsky algorithm for line clipping is based on:

  1. Option A: Region codes
  2. Option B: Parametric line equations
  3. Option C: Midpoint subdivision
  4. Option D: Scan conversion
Show answer

Answer: B. Parametric line equations

103. In computer graphics, a transformation matrix for 2D transformations is of size:

  1. Option A: 2×2
  2. Option B: 3×3
  3. Option C: 4×4
  4. Option D: Depends on the transformation
Show answer

Answer: B. 3×3

6.6 Three-dimensional transformation

13 questions · ACtE0606

104. 3D transformation property?

  1. Option A: Lines preserved
  2. Option B: Parallel preserved
  3. Option C: Distance preserved
  4. Option D: All
Show hint

All properties preserved.

Show answer

Answer: D. All

3D transformations preserve lines, parallelism, and proportional distances.

105. How many possibilities are there in 3-D reflection planes?

Recalled from Jan 2026 exam
  1. Option A: 2
  2. Option B: 3
  3. Option C: 4
  4. Option D: 6
Show hint

In 3D space with X, Y, Z axes, how many principal reflection planes are there?

Show answer

Answer: B. 3

There are 3 possibilities for 3D reflection planes. The three principal reflection planes are: (1) XY-plane - reflects across the plane perpendicular to the Z-axis, (2) YZ-plane - reflects across the plane perpendicular to the X-axis, (3) XZ-plane - reflects across the plane perpendicular to the Y-axis. These are the fundamental reflections in 3D graphics. Any other reflection plane can be derived from these. Reflections across these planes are basic transformations in computer graphics and 3D modeling.

106. Which type of projection is used in isometric drawings?

Recalled from Jan 2026 exam
  1. Option A: Orthographic projection
  2. Option B: Parallel projection
  3. Option C: Perspective projection
  4. Option D: Stereographic projection
Show hint

Isometric drawings maintain parallel lines and equal angles. Which projection type?

Show answer

Answer: B. Parallel projection

Parallel projection is the type used in isometric drawings. Isometric projection is a form of parallel projection where the three axes are drawn at 120° to each other, and all measurements along the axes are to the same scale. Unlike perspective projection where parallel lines converge to vanishing points, parallel projection maintains all parallel lines as parallel. Isometric drawings are commonly used in technical and engineering drawings because they preserve proportions and are easy to measure. They don't appear as realistic as perspective but are useful for technical documentation.

107. 3D translation moves an object along:

  1. Option A: X and Y axes only
  2. Option B: X, Y, and Z axes
  3. Option C: Z axis only
  4. Option D: A circular path
Show answer

Answer: B. X, Y, and Z axes

108. 3D rotation can be performed around:

  1. Option A: X-axis only
  2. Option B: Y-axis only
  3. Option C: Z-axis only
  4. Option D: X, Y, or Z axes
Show answer

Answer: D. X, Y, or Z axes

109. In 3D scaling, if all scaling factors are equal, the transformation is:

  1. Option A: Non-uniform scaling
  2. Option B: Uniform scaling
  3. Option C: Reflection
  4. Option D: Shear
Show answer

Answer: B. Uniform scaling

110. The 3D viewing pipeline converts:

  1. Option A: 3D world coordinates to 2D device coordinates
  2. Option B: 2D device coordinates to 3D world coordinates
  3. Option C: 3D world coordinates to 3D device coordinates
  4. Option D: 2D world coordinates to 3D device coordinates
Show answer

Answer: A. 3D world coordinates to 2D device coordinates

111. In orthographic projection:

  1. Option A: Parallel lines converge at a vanishing point
  2. Option B: Parallel lines remain parallel
  3. Option C: Objects appear larger as they get closer
  4. Option D: Objects appear smaller as they get closer
Show answer

Answer: B. Parallel lines remain parallel

112. In perspective projection:

  1. Option A: Parallel lines remain parallel
  2. Option B: Parallel lines converge at a vanishing point
  3. Option C: All objects appear the same size regardless of distance
  4. Option D: There is no distortion of objects
Show answer

Answer: B. Parallel lines converge at a vanishing point

113. Which of the following is NOT a type of projection?

  1. Option A: Orthographic
  2. Option B: Perspective
  3. Option C: Parallel
  4. Option D: Translational
Show answer

Answer: D. Translational

114. The homogeneous coordinate system is used in computer graphics to:

  1. Option A: Represent colors
  2. Option B: Represent 3D points with 4 coordinates
  3. Option C: Simplify transformation calculations
  4. Option D: Both B and C
Show answer

Answer: D. Both B and C

115. The z-buffer algorithm is used for:

  1. Option A: Line clipping
  2. Option B: Hidden surface removal
  3. Option C: Color interpolation
  4. Option D: Texture mapping
Show answer

Answer: B. Hidden surface removal

116. Ray tracing is a technique for:

  1. Option A: 2D rendering
  2. Option B: Realistic 3D rendering
  3. Option C: Animation
  4. Option D: Image compression
Show answer

Answer: B. Realistic 3D rendering

Questions from bibhushansaakha/MCQ (MIT License, © 2024 Bibhushan Saakha) and SamirWagle/NECPrep. Exact duplicates are shown once. Where the source’s answer is missing, repeated, or disagrees between copies, the question carries a note. Questions are sorted into the official NEC syllabus topics; a few that sit between two topics may be filed under either.