Showing posts with label QUESTION BANK FOR V-SEM PAPERS. Show all posts
Showing posts with label QUESTION BANK FOR V-SEM PAPERS. Show all posts

Monday, August 15, 2011

SYSTEM-SOFTWARE-TUTORIALS-1


1. Write a sequence of instructions for SIC to ALPHA equal to the product of BETA and GAMMA. Assume that ALPHA, BETA and GAMMA are defined as in Fig.1.3(a).

Assembly Code:

LDA BETA
MUL GAMMA
STA ALPHA
:
:
ALPHA RESW 1
BETA RESW 1
GAMMA RESW 1

2. Write a sequence of instructions for SIC/XE to set ALPHA equal to 4 * BETA – 9. Assume that ALPHA and BETA are defined as in Fig. 1.3(b). Use immediate addressing for the constants.

Assembly Code:

LDA BETA
LDS #4
MULR S,A
SUB #9
STA ALPHA
:
:
ALPHA RESW 1

3. Write SIC instructions to swap the values of ALPHA and BETA.

Assembly Code:

LDA ALPHA
STA GAMMA
LDA BETA
STA ALPHA
LDA GAMMA
STA BETA
:
:
ALPHA RESW 1
BETA RESW 1
GAMMA RESW 1

4. Write a sequence of instructions for SIC to set ALPHA equal to the integer portion of BETA ÷ GAMMA. Assume that ALPHA and BETA are defined as in Fig.1.3(a).
Assembly Code:

LDA BETA
DIV GAMMA
STA ALPHA
:
:
ALPHA RESW 1
BETA RESW 1
GAMMA RESW 1

5. Write a sequence of instructions for SIC/XE to divide BETA by GAMMA, setting ALPHA to the integer portion of the quotient and DELTA to the remainder. Use register-to-register instructions to make the calculation as efficient as possible.

Assembly Code:

LDA BETA
LDS GAMMA
DIVR S, A
STA ALPHA
MULR S, A
LDS BETA
SUBR A, S
STS DELTA
:
:
ALPHA RESW 1
BETA RESW 1
GAMMA RESW 1
DELTA RESW 1

6. Write a sequence of instructions for SIC/XE to divide BETA by GAMMA, setting ALPHA to the value of the quotient, rounded to the nearest integer. Use register-to-register instructions to make the calculation as efficient as possible.

Assembly Code:

LDF BETA
DIVF GAMMA
FIX
STA ALPHA

:
:
ALPHA RESW 1
BETA RESW 1
GAMMA RESW 1

7. Write a sequence of instructions for SIC/XE to clear a 20-byte string to all blanks.

Assembly Code:

LDX ZERO
LOOP LDCH BLANK
STCH STR1,X
TIX TWENTY
JLT LOOP
:
:
STR1 RESW 20
BLANK BYTE C ‘ ‘
ZERO WORD 0
TWENTY WORD 20

8. Write a sequence of instructions for SIC/XE to clear a 20-byte string to all blanks. Use immediate addressing and register-to-register instructions to make the process as efficient as possible.

Assembly Code:

LDT #20
LDX #0
LOOP LDCH #0
STCH STR1,X
TIXR T
JLT LOOP
:
:
STR1 RESW 20

9. Suppose that ALPHA is an array of 100 words, as defined in Fig. 1.5(a). Write a sequence of instructions for SIC to set all 100 elements of the array to 0.

Assembly Code:

LDA ZERO
STA INDEX
LOOP LDX INDEX
LDA ZERO
STA ALPHA, X
LDA INDEX
ADD THREE
STA INDEX
COMP K300
TIX TWENTY
JLT LOOP
:
:
INDEX RESW 1
ALPHA RESW 100
:
ZERO WORD 0
K300 WORD 100
THREE WORD 3

10. Suppose that ALPHA is an array of 100 words, as defined in Fig. 1.5(a). Write a sequence of instructions for SIC/XE to set all 100 elements of the array to 0. Use immediate addressing and register-to-register instructions to make the process as efficient as possible.

Assembly Code:

LDS #3
LDT #300
LDX #0
LOOP LDA #0
STA ALPHA, X
ADDR S, X
COMPR X, T
JLT LOOP
:
:
ALPHA RESW 100

11. Suppose that ALPHA is an array of 100 words. Write a sequence of instruction for SIC/XE to arrange the 100 words in ascending order and store result in an array BETA of 100 elements.

Assembly Code:

NOT YET SOLVED

12. Suppose that ALPHA and BETA are the two arrays of 100 words. Another array of GAMMA elements are obtained by multiplying the corresponding ALPHA element by 4 and adding the corresponding BETA elements.

Assembly Code:

LDS #3
LDT #300
LDX #0
ADDLOOP LDA ALPHA, X
MUL #4
ADD BETA, X
STA GAMMA, X
ADDR S, X
COMPR X, T
JLT ADDLOOP
:
:
ALPHA RESW 100
BETA RESW 100
GAMMA RESW 100

13. Suppose that ALPHA is an array of 100 words. Write a sequence of instructions for SIC/XE to find the maximum element in the array and store results in MAX.

Assembly Code:

LDS #3
LDT #300
LDX #0
CLOOP LDA ALPHA, X
COMP MAX
JLT NOCH
STA MAX
NOCH ADDR S, X
COMPR X, T
JLT CLOOP
:
:
ALPHA RESW 100
MAX WORD -32768

14. Suppose that RECORD contains a 100-byte record, as in Fig. 1.7(a). Write a subroutine for SIC that will write this record on to device 05.

Assembly Code:

JSUB WRREC
:
:
WRREC LDX ZERO
WLOOP TD OUTPUT
JEQ WLOOP
LDCH RECORD, X
WD OUTPUT
TIX LENGTH
JLT WLOOP
RSUB
:
:
ZERO WORD 0
LENGTH WORD 1
OUTPUT BYTE X ‘05’
RECORD RESB 100

15. Suppose that RECORD contains a 100-byte record, as in Fig. 1.7(a). Write a subroutine for SIC that will write this record on to device 05.

Assembly Code:

JSUB WRREC
:
:
WRREC LDX #0
LDT #100
WLOOP TD OUTPUT
JEQ WLOOP
LDCH RECORD, X
WD OUTPUT
TIXR T
JLT WLOOP
RSUB
:
:
OUTPUT BYTE X ‘05’
RECORD RESB 100

16. Write a subroutine for SIC that will read a record into a buffer, as in Fig.1.7(a). The record may be any length from 1 to 100 bytes. The end of record is marked with a “null” character (ASCII code 00). The subroutine should place the length of the record read into a variable named LENGTH.

Assembly Code:

JSUB RDREC
:
:
RDREC LDX ZERO
RLOOP TD INDEV
JEQ RLOOP
RD INDEV
COMP NULL
JEQ EXIT
STCH BUFFER, X
TIX K100
JLT RLOOP
EXIT STX LENGTH
RSUB
:
:
ZERO WORD 0
NULL WORD 0
K100 WORD 1
INDEV BYTE X ‘F1’
LENGTH RESW 1
BUFFER RESB 100

17. Write a subroutine for SIC/XE that will read a record into a buffer, as in Fig.1.7(a). The record may be any length from 1 to 100 bytes. The end of record is marked with a “null” character (ASCII code 00). The subroutine should place the length of the record read into a variable named LENGTH. Use immediate addressing and register-to-register instructions to make the process as efficient as possible.
Assembly Code:

JSUB RDREC
:
:
RDREC LDX #0
LDT #100
LDS #0
RLOOP TD INDEV
JEQ RLOOP
RD INDEV
COMPR A, S
JEQ EXIT
STCH BUFFER, X
TIXR T
JLT RLOOP
EXIR STX LENGTH
RSUB
:
:
INDEV BYTE X ‘F1’
LENGTH RESW 1
BUFFER RESB 100

Friday, August 12, 2011

Anna University--Cs2302 - computer networks Question paper

         B.E/B.Tech. DEGREE EXAMINATION, NOVEMBER 2010
                            Fifth Semester 
                Computer Science and Engineering

                                      CS2302 - COMPUTER NETWORKS
                                   (Common to Information Technology)
                                                      (Regulation 2008)

                                           PART A - (10 X 2 = 20 Marks)
1. What are the two types of line configuration?
2. What do you mean by error control?
3. What are the functions of bridges?
4. What is the advantage of FDDI over a basic token ring?
5. What is meant by circuit switching?
6. What is multicasting?
7. What is the function of a router?
8. What are the advantages of using UDP over TCP?
9. What is SMTP?
10. What is PGP?
                                               

                                            PART B- (5 X 16 = 80 Marks)
11. (a) Explain in detail the error detection and error corrections. (16 Marks)
                                                                         (Or)
      (b) Discuss in detail about the layers of OSI model. (16 Marks)

12. (a) Name the four basic network topologies and explain them giving all the relevant features. (16 Marks)
                                                                             (Or)
      (b) Explain the functioning of wireless LAN in detail. (16 Marks)

13. (a) Write notes on the following: (i) Internet protocol. (ii) Routers. (16 Marks)
                                                                            (Or)
     (b) Discuss in detail the various aspects of IPV6. (16 Marks)

14. (a) With neat architecture, explain TCP in detail. (16 Marks)
                                                                           (Or)
      (b) Explain adaptive flow control in detail and its uses. (16 Marks)

15. (a) Explain the SMTP and HTTP. Give their uses, state strengths and weaknesses. (16 Marks)
                                                                            (Or)
       (b) Explain the role of a DNS on a computer network. (16 Marks)

Anna University-Cs 2301—software engineering--november/december 2010 Question paper


                  B.E./B.Tech. DEGREE EXAMINATION, NOV/DEC2010
 Fifth Semester----------Computer Science and Engineering

                                             CS 2301 — SOFTWARE ENGINEERING
                                                                                    (Regulation 2008)
                                                        PART A — (10 × 2 = 20 Marks)
1. Define Business Process Reengineering.
2. Write down the generic process framework that is applicable to any software project.
3. What is Software Prototyping?
4. Define functional and non- Functional requirements.
5. What are the primary interaction styles and state their advantages?
6. List the architectural models that can be developed.
7. What are the characteristics of good tester?
8. Give the difference between verification and validation.
9. What are the processes of risk management?
10. Define error, fault and failure.
                                                 PART B — (5 × 16 = 80 Marks)
11. (a) Explain the following: (i) waterfall model (ii) Spiral model (iii) RAD 
model (iv) Prototyping model. Or
       (b) Discuss in detail the project structure and programming team structure of a software organization. (Marks 16)

12. (a) Discuss any four process models with suitable application. (Marks 4 + 4 + 4 + 4)
                                                                              Or
       (b) Explain the execution of seven distinct functions accomplished in requirement engineering process. (Marks 16)

13. (a) Explain the core activities involved in User Interface design process with necessary block diagrams. (Marks 8 + 8)
                                                                                   Or
      (b) Explain the various modular decomposition and control styles commonly used in any organizational model. 
 (Marks 16)

14. (a) (i) What is white-box testing? (Marks 2)
            (ii) Explain how basis path testing helps to derive test cases to test every statement of a program. (Marks 14)
                                                                                      Or
     (b) (i) Define : Regression testing. (Marks 2)
          (ii)Distinguish: top-down and bottom-up integration. (Marks 10)
          (iii) How is testing different from debugging? Justify. (Marks 4)

15. (a) (i) Elaborate on the series of tasks of a software configuration management process. (Marks 8)
            (ii) Describe function point analysis with a neat example. (Marks 8)
                                                                                        Or
      (b) (i) Explain the methods of decomposition for software cost estimation.(Marks 8)
           (ii) Mention the challenges of risk management. (Marks 8)

ANNA UNIVERSITY QUESTION PAPER-JUNE-JAVA PROGRAMMING

                                                                       Information Technology
                         IT 2301 — JAVA PROGRAMMING
                                 (Regulation 2008)



                                                                  PART A — (10 × 2 = 20 Marks)
1. What is the difference between static and non-static variables?
2. What is the purpose of finalization?
3. What is the difference between the String and String Buffer classes?
4. Can an abstract class be final? Why?
5. What is an anonymous inner class?
6. What is the difference between the File and Random Access File classes?
7. What are the advantages of the event-delegation model?
8. What happens if an exception is not caught?
9. What is the use of Reflection API?
10. What are three ways in which a thread can enter the waiting state?
                                                                 PART B — (5 × 16 = 80 Marks)
11. (a) Explain briefly the following object oriented concepts.
               (i) Abstraction and Encapsulation. (4)
               (ii) Methods and messages. (4)
               (iii) Inheritance. (4)
               (iv) Polymorphism. (4)
                                                               Or
       (b) (i) How objects are constructed? Explain constructor overloading with an example. (Marks 10)
            (ii) Write short notes on access specifiers in java. (Marks 6)

12. (a) What is a Package? What are the benefits of using packages? Write down the steps in creating a 

           package and  using it in a java program with an example. (Marks 16) 
                                                                  Or
      (b) What is Dynamic binding? Show with an example how dynamic binding works. (Marks 16)

13. (a) What is object cloning? Why it is needed? Explain how objects are cloned. (Marks 16)
                                                                    Or
      (b) How is a Frame created? Write a java program that creates a product enquirer form using frames.     

            (Marks 16)

14. (a) With a neat diagram explain the Model view controller design pattern and list out the advantages 

           and disadvantages of using it in designing an application. (Marks 16)
                                                                      Or
      (b) What is an Exception? Explain how to throw, catch and handle Exceptions. (Marks 16)

15. (a) What is Generic programming and why is it needed? List the limitations and restrictions of generic 

           programming. (Marks 16)
                                                                        Or
       (b) Explain how to create threads. Write a java program that prints numbers from 1 to 10 line by line 

            after every 5 seconds. (Marks 16) 

ANNA UNIVERSITY QUESTION PAPER-JUNE-2007-SOFTWARE ENGINEERING

               ANNA UNIVERSITY QUESTION PAPER-JUNE-2007-SOFTWARE ENGINEERING
 REGULATION 2005
                                           PART A – (10x2 = 20 marks)
1. What is the main criterion for deciding whether or not to use the waterfall model in software development project?
2. Give the model of extreme programming process.
3. State the reason why software requirements elicitation is difficult.
4. How does state diagram represent the behavior of a computer based system?
5. Differentiate dynamic model and functional models.
6. What is control coupling?
7. What is alpha test and beta test?
8. State the problem that are encountered when top-down integration is chosen.
9. What is base line?
10. What is version control?


                                                           PART B — (5 x 16 = 80 marks)

11. (a) (i) Describe the spiral model of software development. (10)
           (ii) State the advantage and disadvantages of the evolutionary model of software development. (6)
                                                         Or
      (b) Discuss the following agile process models
            (i) Adaptive software development and its life cycle. (6)
            (ii) Dynamic systems development (5)
           (iii) Serum. (5)

12. (a) Describe the seven distinct functions of requirements engineering task.(16)
                                                            Or
     (b) Explain the different models used for analysis. Explain the sub model with an example. (16)

13. (a) Discuss the various steps involved in transform mapping and transaction mapping. (16)
                                                            Or
     (b) Explain the various design principles that enable an interface
             (i) to reduce the users memory load (ii) make the interface consistent.(16)
14. (a) Discuss the various tests to be conducted for system testing. (16)
                                                            Or
     (b) Describe how unit testing and integration testing is conducted for object oriented software. (16)

15. (a) Write short notes on :
            (i) Cost impact of software defect (4)
           (ii) defect amplification and removal (4)
          (iii) software reliability (4)
          (iv) change control. (4)
                                                               Or
     (b) Write short notes on :
          (i) software configuration management (6)
         (ii) software quality assurance (5)
         (iii) quality standards. (5)

Wednesday, August 10, 2011

THEORY OF COMPUTATION(CS2303)-QUESTION BANK-2MARKS


THEORY OF COMPUTATION(CS2303)
Third Year CSE( Sem:V)
2 marks Questions and Answers

UNIT I

  1. Why are switching circuits called as finite state systems?
A switching circuit consists of a finite number of gates, each of which can be in any one of the two conditions 0 or 1.Although the voltages assume infinite set of values,the electronic circuitry is designed so that the voltages orresponding to 0 or 1 are stableand all others adjust to these value. Thus control unit of a computer is a finite statesystem.

  1. What is a : (a) String (b) Regular language
A string x is accepted by a Finite Automaton M=(Q, Σ, δ.q0,F) if δ (q0,x)=p, for some p in F.FA accepts a string x if the sequence of transitions corresponding to the symbols of x leads from the start state to accepting state.
The language accepted by M is L(M) is the set {x | _(q0,x) is in F}. A language is regular if it is accepted by some finite automaton.

  1. Define: (i) Finite Automaton(FA) (ii)Transition diagram
FA consists of a finite set of states and a set of transitions from state to state that occur on input symbols chosen from an alphabet _. Finite Automaton is denoted by a 5- tuple(Q,Σ, δ,q0,F), where Q is the finite set of states , _ is a finite input alphabet, q0 in Q is the initial state, F is the set of final states and _ is the transition mapping function Q * _ to Q.
Transition diagram is a directed graph in which the vertices of the graph correspond to the states of FA. If there is a transition from state q to state p on input a, then there is an arc labeled ‘ a ‘ from q to p in the transition diagram.

  1. . What are the applications of automata theory?
_ In compiler construction.
_ In switching theory and design of digital circuits.
_ To verify the correctness of a program.
_ Design and analysis of complex software and hardware systems.
_ To design finite state machines such as Moore and mealy machines.

  1. What is Moore machine and Mealy machine?
A special case of FA is Moore machine in which the output depends on the state of the machine. An automaton in whch the output depends on the transition and current input is called Mealy machine.




  1. What are the components of Finite automaton model?
The components of FA model are Input tape, Read control and finite control.
(a)The input tape is divided into number of cells. Each cell can hold one i/p symbol
. (b)The read head reads one symbol at a time and moves ahead.
( c)Finite control acts like a CPU. Depending on the current state and input symbol read from the input tape it changes state.

  1. Differentiate NFA and DFA
NFA or Non Deterministic Finite Automaton is the one in which there exists many paths for a specific input from current state to next state. NFA can be used in theory of computation because they are more flexible and easier to use than DFA .
Deterministic Finite Automaton is a FA in which there is only one path for a specific input from current state to next state. There is a unique transition on each input symbol.(Write examples with diagrams).

  1. What is _-closure of a state q0?
_-closure(q0 ) denotes a set of all vertices p such that there is a path from q0 to p labeled _. Example :closure(q0)={q0,q1}

  1. .Give the examples/applications designed as finite state system.
Text editors and lexical analyzers are designed as finite state systems. A lexical analyzer scans the symbols of a program to locate strings corresponding to identifiers, constants etc, and it has to remember limited amount of information .

  1. Define automaton.
Automaton is a abstact computing device. It is a mathematical model of a system,with discrete inputs,outputs,states and set of tranitions from state to state that occurs on input symbols from alphabet Σ.

  1. what is the principle of mathematical induction.
Let P(n) be a ststement about a non negative integer n. Then the principle of mathematical induction is that P(n) follows from
      1. P(1) and
      2. P(n-1) implies P(n) for all n>1.
Condition(i) is called the basis step and condition (ii) is called the inductive step. P(n-1) is called the induction hypothesis.

  1. List any four ways of theorem proving
      1. Deductive
      2. If and only if
      3. Induction
      4. Proof by contradiction.
  2. Define TOC
TOC describes the basic ideas and models underlying computing. TOC suggests various abstract models of computation, represented mathematically.

  1. What are the applications of TOC?
Compiler Design
Robotics
Artificial Intelligence
Knowledge Engineering.

  1. Define Transition Diagram.
Transition Diagram associated with DFA is a directed graph whose vertices corresponds to states of DFA, The edges are the transitions from one state to another.
  1. What are the properties of Transition Function(δ)
      1. δ(q.ε )=q
      2. For all strings w and input symbol a
Δ(q,aw)= δ(δ(q.a),w)
Δ(q,wa)= δ(δ(q,w).a)
      1. The transition function δ can be extended that operates on states and strings.

  1. Lists the operations on Strings.
      1. Length of a string
      2. Empty string
      3. Concatenation of string
      4. Reverse of a string
      5. Power of an alphabet
      6. Kleene closure
      7. Substring
      8. Palindrome


  1. Lists the operations on Languages.
      1. Product
      2. Reversal
      3. Power
      4. Kleene star
      5. Kleene plus
      6. Union
      7. Intersection

  1. Define Graphs.
A graph denoted by G=(V,E) consists of a finite set of vertices (or) nodes V and a set E, a pair of vertices called edges.

  1. Define Substring.
A string v appears within another string w(w=uv) is called “substring of w.” IF w=uv,then substrings u & v are said to be prefix and suffix of w respectively.


UNIT II
  1. What is a regular expression?
A regular expression is a string that describes the whole set of strings according to certain syntax rules. These expressions are used by many text editors and utilities to search bodies of text for certain patterns etc. Definition is: Let _ be an alphabet. The regular expression over _ and the sets they denote are:
i. _ is a r.e and denotes empty set.
ii. _ is a r.e and denotes the set {_}
iii. For each ‘a’ in _ , a+ is a r.e and denotes the set {a}.
iv. If ‘r’ and ‘s’ are r.e denoting the languages R and S respectively then (r+s),
(rs) and (r*) are r.e that denote the sets RUS, RS and R* respectively.

  1. Differentiate L* and L+
_
L* denotes Kleene closure and is given by L* =U Li i=0
example : 0* ={_ ,0,00,000,…………………………………}
Language includes empty words also.
_
L+ denotes Positive closure and is given by L+= U Li i=1 q0 q1


  1. What is Arden’s Theorem?
Arden’s theorem helps in checking the equivalence of two regular expressions. Let P and Q be the two regular expressions over the input alphabet _. The regular expression R is given as : R=Q+RP Which has a unique solution as R=QP*.

  1. Write a r.e to denote a language L which accepts all the strings which begin or end with either 00 or 11.
The r.e consists of two parts:
L1=(00+11) (any no of 0’s and 1’s) =(00+11)(0+1)*
L2=(any no of 0’s and 1’s)(00+11) =(0+1)*(00+11)
Hence r.e R=L1+L2 =[(00+11)(0+1)*] + [(0+1)* (00+11)]

  1. Construct a r.e for the language over the set _={a,b} in which total number of a’s are divisible by 3
( b* a b* a b* a b*)*


  1. what is: (i) (0+1)* (ii)(01)* (iii)(0+1) (iv)(0+1)+
(0+1)*= { _ , 0 , 1 , 01 , 10 ,001 ,101 ,101001,…………………}
Any combinations of 0’s and 1’s.
(01)*={_ , 01 ,0101 ,010101 ,…………………………………..}
All combinations with the pattern 01.
(0+1)= 0 or 1,No other possibilities.
(0+1)+= {0,1,01,10,1000,0101,………………………………….}

  1. Reg exp denoting a language over _ ={1} having (i) even length of string (ii) odd length of a string
(i) Even length of string R=(11)*
(ii) Odd length of the string R=1(11)*

  1. Reg exp for: (i) All strings over {0,1} with the substring ‘0101’ (ii) All strings beginning with ’11 ‘ and ending with ‘ab’ (iii) Set of all strings over {a,b}with 3 consecutive b’s. (iv) Set of all strings that end with ‘1’and has no substring ‘00’
(i)(0+1)* 0101(0+1)*
(ii)11(1+a+b)* ab
(iii)(a+b)* bbb (a+b)*
(iv)(1+01)* (10+11)* 1
  1. Construct a r.e for the language which accepts all strings with atleast two c’s over the set Σ={c,b}
(b+c)* c (b+c)* c (b+c)*

  1. What are the applications of Regular expressions and Finite automata Lexical analyzers and Text editors are two applications.
Lexical analyzers:
The tokens of the programming language can be expressed using regular expressions.
The lexical analyzer scans the input program and separates the tokens.For eg identifier can be expressed as a regular expression
as: (letter)(letter+digit)*
If anything in the source language matches with this reg exp then it is recognized as an identifier.The letter is{A,B,C,………..Z,a,b,c….z} and digit is {0,1,…9}.Thus reg exp identifies token in a language.
Text editors:
These are programs used for processing the text. For example UNIX text editors uses the reg exp for substituting the strings such as: S/bbb*/b/
Gives the substitute a single blank for the first string of two or more blanks in a given line. In UNIX text editors any reg exp is converted to an NFA with Єtransitions, this NFA can be then simulated directly.


  1. .Reg exp for the language that accepts all strings in which ‘a’ appears tripled overthe set Σ ={a}
reg exp=(aaa)*

  1. .What are the applications of pumping lemma?
Pumping lemma is used to check if a language is regular or not.
    1. Assume that the language(L) is regular.
    2. Select a constant ‘n’.
    3. Select a string(z) in L, such that |z|>n.
    4. Split the word z into u,v and w such that |uv|<=n and |v|>=1.
    5. You achieve a contradiction to pumping lemma that there exists an ‘i’ Such that uvi
w is not in L.Then L is not a regular language.

  1. What is the closure property of regular sets?
The regular sets are closed under union, concatenation and Kleene closure.
r1Ur2= r1 +r2
r1.r2= r1r2
( r )*=r*
The class of regular sets are closed under complementation, substitution, homomorphism and inverse homomorphism.

  1. .Reg exp for the language such that every string will have atleast one ‘a’ followed by atleast one ‘b’.
R=a+b+

  1. Write the exp for the language starting with and has no consecutive b’s .
reg exp=(a+ab)*

  1. Lists on the closure properties of Regular sets.
    1. Union
    2. Concatenation
    3. Closure
    4. Complementation
    5. Intersection
    6. Transpose
    7. Substitutions
    8. Homomorphism

  1. Let R be any set of regular languages. IsUR regular? Prove it.
Yes. Let P,Q be any two regular languages .As per theorem
L( R )=L(P UQ)
=L(P+Q)
Since ‘+’ is a operator for regular expresstions L( R ) is also regular.

  1. Show that (r*)*=r* for a regular expression r,
(r*)*=={ε,r,rr,………….}= r*

  1. What are the three methods of conversion of DFA to RE?
    1. Regular Expression equation method
    2. Arden’s Theorem.
    3. State elimination technique,

  1. What are the algorithms of minimization DFA?
    1. Myhill-Nerode Theorem
    2. Construction of πfinal from π.


UNIT III


  1. What are the applications of Context free languages
Context free languages are used in :
(i) Defining programming languages.
(ii) Formalizing the notion of parsing.
(iii) Translation of programming languages.
(iV) String processing applications.

  1. What are the uses of Context free grammars?
    • Construction of compilers.
    • Simplified the definition of programming languages.
    • Describes the arithmetic expressions with arbitrary nesting of balanced parenthesis { (, ) }.
    • Describes block structure in programming languages.
    • Model neural nets.

  1. Define a context free grammar
A context free grammar (CFG) is denoted as G=(V,T,P,S) where V and T are finite set of variables and terminals respectively. V and T are disjoint. P is a finite set of productions each is of the form A->_ where A is a variable and _ is a string of symbols from (V U T)*.

  1. What is the language generated by CFG or G?
The language generated by G ( L(G) ) is {w | w is in T* and S=>w. That is a G string is in L(G) if:
(1) The string consists solely of terminals.
(2) The string can be derived from S.

  1. .What is : (a) CFL (b) Sentential form
L is a context free language (CFL) if it is L(G) for some CFG G.
A string of terminals and variables α is called a sentential form if: S => α ,where S is the start symbol of the grammar.

  1. What is the language generated by the grammar G=(V,T,P,S) where
P={S->aSb, S->ab}?
S=> aSb=>aaSbb=>…………………………..=>anbn
Thus the language L(G)={ anbn | n>=1}.The language has strings with equal number of a’s and b’s.

  1. What is :(a) derivation (b)derivation/parse tree (c) subtree
(a) Let G=(V,T,P,S) be the context free grammar. If A-> β is a production of P and α and γ are any strings in (VUT)* then α A γ => αβγ

(b) A tree is a parse \ derivation tree for G if:
(i) Every vertex has a label which is a symbol of VU TU{_}.
(ii) The label of the root is S.
(iii) If a vertex is interior and has a label A, then A must be in V.
(iv) If n has a label A and vertices n1,n2,….. nk are the sons of the vertex n in order from left with labels X1,X2,………..Xk respectively then A X1X2…..Xk must be in P.
(v) If vertex n has label _ ,then n is a leaf and is the only son of its father.

(c ) A subtree of a derivation tree is a particular vertex of the tree together with all its descendants ,the edges connecting them and their labels.The label of the root may not be the start symbol of the grammar.

  1. If S->aSb | aAb , A->bAa , A->ba .Find out the CFL
soln. S->aAb=>abab
S->aSb=>a aAb b =>a a ba b b(sub S->aAb)
S->aSb =>a aSb b =>a a aAb b b=>a a a ba b bb
Thus L={anbmambn, where n,m>=1}

  1. What is a ambiguous grammar?
A grammar is said to be ambiguous if it has more than one derivation trees for a sentence or in other words if it has more than one leftmost derivation or more than one rightmost derivation.

  1. Find CFG with no useless symbols equivalent to : S→AB | CA ,
B→BC | AB, A→a , C→aB | b.
S-> AB
S->CA
B->BC
B->AB
A->a
C->aB
C->b are the given productions. A symbol X is useful if S => αXβ => w
The variable B cannot generate terminals as B->BC and B->AB. Hence B is useless symbol and remove B from all productions. Hence useful productions are: S->CA , A->a , C->b

  1. Construct CFG without Є production from : S →a | Ab | aBa , A →b | Є , B →b | A.
S->a
S->Ab
S->aBa
A->b
A->Є
B->b
B->A are the given set of production.
A->Є is the only empty production. Remove the empty production
S-> Ab , Put A->Є and hence S-> b.
If B-> A and A->Є then B ->Є
Hence S->aBa becomes S->aa .
Thus S-> a | Ab | b | aBa | aa
A->b
B->b
Finally the productions are: S-> a | Ab | b | aBa | aa A->b
B->b


  1. What are the three ways to simplify a context free grammar?
  1. removing the useless symbols from the set of productions.
  2. By eliminating the empty productions.
  3. By eliminating the unit productions.

  1. What are the properties of the CFL generated by a CFG?
Each variable and each terminal of G appears in the derivation of some word in L .here are no productions of the form A->B where A and B are variables.

  1. Find the grammar for the language L={a 2n bc ,where n>1 }
let G=( {S,A,B}, {a,b,c} ,P , {S} ) where P:
S->Abc
A->aaA | Є

  1. .Find the language generated by :S->0S1 | 0A | 0 |1B | 1 A->0A | 0 , B->1B | 1
The minimum string is S-> 0 | 1
S->0S1=>001
S->0S1=>011
S->0S1=>00S11=>000S111=>0000A111=>00000111 Thus L={ 0 n 1 m | m not equal to n, and n,m >=1}

  1. Construct the grammar for the language L={ an b an | n>=1}.
The grammar has the production P as:
S->aAa
A->aAa | b
The grammar is thus : G=( {S,A} ,{a,b} ,P,S)

  1. . Construct a grammar for the language L which has all the strings which are all palindrome over Σ={a, b}.
G=({S}, {a,b} , P, S )
P:{ S -> aSa ,
S-> b S b,
S-> a,
S->b,
S->Є } which is in palindrome.

  1. Differentiate sentences Vs sentential forms
A sentence is a string of terminal symbols.
A sentential form is a string containing a mix of variables and terminal symbols or all variables.This is an intermediate form in doing a derivation.

  1. .Define Pushdown Automata.
A pushdown Automata M is a system (Q, Σ, Ґ ,δ ,q0, Z0,F) here Q is a finite set of states.
Σ is an alphabet called the input alphabet.
Ґ is an alphabet called stack alphabet.
q0 in Q is called initial state.
Zo in Ґ is start symbol in stack.
F is the set of final states.
Δ is a mapping from Q X ( Σ U {Є} ) X Ґ to finite subsets of
Q X Ґ*.

  1. 3.Specify the two types of moves in PDA.
The move dependent on the input symbol(a) scanned is:
δ(q,a,Z) = { ( p1, γ1 ), ( p2,γ2 ),……..( pmm ) }
where q qnd p are states , a is in Σ ,Z is a stack symbol and
γi is in Ґ*. PDA is in state q , with input symbol a and Z the top symbol on state enter state p iReplace symbol Z by string γi

The move independent on input symbol is (Є-move):
δ(q,Є,Z)= { ( p1,γ1 ), ( p2,γ2 ),…………( pmm ) }. Is that PDA is in state q , independent of input symbol being scanned and with Z the top symbol on the stack enter a state p i and replace Z by γi.

  1. What are the different types of language acceptances by a PDA and define them.
For a PDA M=(Q, Σ ,Ґ ,δ ,q0 ,Z0 ,F ) we define :
(i) Language accepted by final state L(M) as:
* { w | (q0 , w , Z0 ) |-- ( p, Є , γ ) for some p in F and γ in Ґ * }.
(ii) Language accepted by empty / null stack N(M) is:
{ w | (q0,w ,Z0) |----( p, Є, Є ) for some p in Q}.

  1. Is it true that the language accepted by a PDA by empty stack and final states are different languages.
No, because the languages accepted by PDA ‘s by final state are exactly the languages accepted by PDA’s by empty stack.


  1. Define Deterministic PDA.
A PDA M =( Q, Σ ,Ґ ,δ ,q0 ,Z0 ,F ) is deterministic if:
  • For each q in Q and Z in Ґ , whenever δ(q,Є,Z) is nonempty then δ(q,a,Z) is empty for all a in Σ.
  • For no q in Q , Z in Ґ , and a in Σ U { Є} does δ(q,a,Z) contains more than one element. (Eg): The PDA accepting {wcw R | w in ( 0+1 ) * }.

  1. Define Instantaneous description(ID) in PDA.
ID describe the configuration of a PDA at a given instant.ID is a triple such as (q, w ,γ ) , where q is a state , w is a string of input symbols and
γ is a string of stack symbols.
If M =( Q, Σ ,Ґ ,δ ,q0 ,Z0 ,F ) is a PDA we say that
(q,aw,Zα) |-----( p, , βα) if δ(q,a,Z) contains (p, β ).
M ‘a’ may be Є or an input symbol. Example: (q1, BG) is in δ(q1, 0 , ) ells that (q1, 011, GGR )|---- ( q1, 11,BGGR).

  1. .What is the significance of PDA?
Finite Automata is used to model regular expression and cannot be used to represent non regular languages. Thus to model a context free language, a Pushdown Automata is used.

  1. When is a string accepted by a PDA?
The input string is accepted by the PDA if:
    • The final state is reached .
    • The stack is empty.

  1. . Give examples of languages handled by PDA.
(1) L={ a nbn | n>=0 },here n is unbounded , hence counting cannot be done by finite memory. So we require a PDA ,a machine that can count without limit.
(2) L= { wwR | w Є {a,b}* } , to handle this language we need unlimited counting capability .


  1. Is NPDA (Nondeterministic PDA) and DPDA (Deterministic PDA)equivalent?
The languages accepted by NPDA and DPDA are not equivalent. For example: wwR is accepted by NPDA and not by any DPDA.

  1. State the equivalence of acceptance by final state and empty stack.
  • If L = L(M2) for some PDA M2 , then L = N(M1) for some PDA M1.
  • If L = N(M1) for some PDA M1 ,then L = L(M2 ) for some PDA M2
where L(M) = language accepted by PDA by reaching a final state. N(M) = language accepted by PDA by empty stack.


UNIT IV


      1. What is a formal language?
Language is a set of valid strings from some alphabet. The set may be empty,finite or infinite. L(M) is the language defined by machine M and L( G) is the language defined by Context free grammar. The two notations for specifying formal languages are: Grammar or regular expression Generative approach) Automaton(Recognition approach)

      1. .What is Backus-Naur Form(BNF)?
Computer scientists describes the programming languages by a notation called Backus- Naur Form. This is a context free grammar notation with minor changes in format and some shorthand.

      1. Let G= ( {S,C} ,{a,b},P,S) where P consists of S->aCa , C->aCa |b. FindL(G).
S-> aCa => aba
S->aCa=> a aCa a=>aabaa
S->aCa=> a aCa a=> a a aCa a a =>aaabaaa
Thus L(G)= { anban ,where n>=1 }

      1. Find L(G) where G= ( {S} ,{0,1}, {S->0S1 ,S->_ },S ) S->_ , _ is in L(G)
S-> 0S1 =>0_1=>01
S->0S1=>0 0S11=>0011
Thus L(G)= { 0n1n | n>=0}

      1. What is a parser?
A parser for grammar G is a program that takes as input a string w and produces as output either a parse tree for w ,if w is a sentence of G or an error message indicating that w is not a sentence of G.

      1. What are the closure properties of CFL?
CFL are closed under union, concatenation and Kleene closure.
CFL are closed under substitution , homomorphism. CFL are not closed under intersection , complementation. Closure properties of CFL’s are used to prove that certain languages are not context free.

      1. State the pumping lemma for CFLs.
Let L be any CFL. Then there is a constant n, depending only on L, such that if z is in L and |z| >=n, then z=uvwxy such that :
(i) |vx| >=1
(ii) |vwx| <=n and
(iii) for all i>=0 uviwxiy is in L.

      1. What is the main application of pumping lemma in CFLs?
The pumping lemma can be used to prove a variety of languages are not context free . Some examples are:
L1 ={ aibici | i>=1} is not a CFL.
L2= { aibjcidj | i>=1 and J>=1 } is not a CFL.

      1. What is Ogden’s lemma?
Let L be a CFL. Then there is a constant n such that if z is any word in L, and we mark any n or more positions of z “ distinguished” then we can write z=uvwxy suchthat:
(1) v and x together have atleast one distinguished position.
(2) vwx has at most n distinguished positions and
(3) for all i>=0 uviwxiy is in L.

      1. Give an example of Deterministic CFL.
The language L={anbn : n>=0} is a deterministic CFL

      1. What are the properties of CFL?
Let G=(V,T,P,S) be a CFG
        • The fanout of G , _(G) is largest number of symbols on the RHS of any rule in R.
        • The height of the parse tree is the length of the longest path from the root to some leaf.



      1. What is a turing machine?
Turing machine is a simple mathematical model of a computer. TM has unlimited and unrestricted memory and is a much more accurate model of a general purpose computer. The turing machine is a FA with a R/W Head. It has an infinite tape divided into cells ,each cell holding one symbol.

      1. What are the special features of TM?
In one move ,TM depending upon the symbol scanned by the tape head and state of the finite control:
  • Changes state.
  • Prints a symbol on the tape cell scanned, replacing what was written there.
  • Moves the R/w head left or right one cell.

      1. Define Turing machine.
A Turing machine is denoted as M=(Q,Σ,Ґ ,δ ,q0, B,F)
Q s a finite set of states.
Σ is set of i/p symbols ,not including B.
Ґ is the finite set of tape symbols.
q0 in Q is called start state.
B in Ґ is blank symbol.
F is the set of final states.
Δ is a mapping from Q X Ґ to Q X Ґ X {L,R}.

      1. Define Instantaneous description of TM.
The ID of a TM M is denoted as α1q α2 . Here q is the current state of M s in Q; α1 α2 is the string in Ґ * that is the contents of the tape up to the rightmost nonblank symbol or the symbol to the left of the head, whichever is the rightmost.

      1. What are the applications of TM?
TM can be used as:
  • Recognizers of languages.
  • Computers of functions on non negative integers.
  • Generating devices.

      1. What is the basic difference between 2-way FA and TM?
Turing machine can change symbols on its tape , whereas the FA cannot change symbols on tape. Also TM has a tape head that moves both left and right side ,whereas the FA doesn’t have such a tape head.

      1. What is (a)total recursive function and (b)partial recursive function
If f(i1,i2,………ik) is defined for all i1,…..ik then we say f is a total recursive function. They are similar to recursive languages as they are computed by TM that always halt.
A function f(i1,…ik) computed by a Turing machine is called a partial recursive function. They are similar to r.e languages as they are computed by TM that may or may not halt on a given input.


      1. Define a move in TM.
Let X1 X2…X i-1 q Xi…Xn be an ID.
The left move is: if _ (q, Xi )= (p, Y,L) ,if i>1 then X1 X2…X i-1 q Xi…Xn |---- X1X2… X i-2 p X i-1 Y X i+1…Xn. M The right move is if _ (q, Xi )= (p, Y,R) ,if i>1 then X1 X2…X i-1 q Xi…Xn |---- X1X2… X i-1Y p X i+1…Xn. M

      1. What is the language accepted by TM?
The language accepted by M is L(M) , is the set of words in _ * that cause M to enter a final state when placed ,justified at the left on the tape of M, with M at qo and the tape head of M at the leftmost cell. The language accepted by M is: { w | w in _ * and q0w |--- _1 p _2 for some p in F and _1 ,_2 in _ * }.

      1. Give examples of total recursive functions.
All common arithmetic functions on integers such as multiplication , n!, [log2n] and 22n are total recursive functions.

UNIT V

      1. What are(a) recursively enumerable languages (b) recursive sets?
The languages that is accepted by TM is said to be recursively enumerable (r. e ) languages. Enumerable means that the strings in the language can be enumerated by the TM. The class of r. e languages include CFL’s.
The recursive sets include languages accepted by at least one TM that halts on all inputs.

      1. What are the various representation of TM?
We can describe TM using:
        • Instantaneous description.
        • Transition table.
        • Transition diagram.

          3.What are the possibilities of a TM when processing an input string?
  • TM can accept the string by entering accepting state.
  • It can reject the string by entering non-accepting state.
  • It can enter an infinite loop so that it never halts.

    4.What are the techniques for Turing machine construction?
  • Storage in finite control.
  • Multiple tracks.
  • Checking off symbols.
  • Shifting over
  • Subroutines.



      1. What is the storage in FC?
The finite control(FC) stores a limited amount of information. The state of the Finite control represents the state and the second element represent a symbol scanned.

      1. When is checking off symbols used in TM?
Checking off symbols is useful method when a TM recognizes a language with repeated strings and also to compare the length of substrings.
(eg) : { ww | w _ _ * } or {aibi | i>=1}. This is implemented by using an extra track on the tape with symbols Blank or √.


      1. When is shifting over Used ?
A Turing machine can make space on its tape by shifting all nonblank symbols a finite number of cells to the right. The tape head moves to the right , repeatedly storing the symbols in the FC and replacing the symbols read from the cells to the left. The TM can then return to the vacated cells and prints symbols.

      1. What is a multihead TM?
A k-head TM has some k heads. The heads are numbered 1 through k, and move of the TM depends on the state and on the symbol scanned by each head. In one move, the heads may each move independently left or right or remain stationary.

      1. What is a 2-way infinite tape TM?
In 2-way infinite tape TM, the tape is infinite in both directions. The leftmost square is not distinguished. Any computation that can be done by 2-way infinite tape can also be done by standard TM.

      1. How can a TM used as a transducer?
A TM can be used as a transducer. The most obvious way to do this is to treat the entire nonblank portion of the initial tape as input , and to treat the entire blank portion of the tape when the machine halts as output. Or a TM defines a function y=f(x) for strings x ,y _ _* if: q0X | --- qfY, where qf is the final state.

      1. What is a multi-tape Turing machine?
. A multi-tape Turing machine consists of a finite control with k-tape heads and ktapes ; each tape is infinite in both directions. On a single move depending on the state of finite control and symbol scanned by each of tape heads ,the machine can change state print a new symbol on each cells scanned by tape head, move each of its tape head independently one cell to the left or right or remain stationary.

      1. .What is a multidimensional TM?
The device has a finite control , but the tape consists of a k-dimensional array of cells infinite in all 2k directions, for some fixed k. Depending on the state and symbol scanned , the device changes state , prints a new symbol and moves its tapehead in one of the 2k directions, either positively or negatively ,along one of the k-axes.

13. When a recursively enumerable language is said to be recursive ? Is it true that the language accepted by a non-deterministic Turing machine is different from recursively enumerable language?
A language L is recursively enumerable if there is a TM that accepts L and
recursive if there is a TM that recognizes L. Thus r.e language is Turing acceptable and recursive language is Turing decidable languages. No , the language accepted by non-deterministic Turing machine is same as recursively enumerable language.

      1. What is Church’s Hypothesis?
The notion of computable function can be identified with the class of partial recursive functions is known as Church-hypothesis or Church-Turing thesis. The Turing machine is equivalent in computing power to the digital computer.

      1. When we say a problem is decidable? Give an example of undecidable
problem?
A problem whose language is recursive is said to be decidable.
Otherwise the problem is said to be undecidable. Decidable problems have an
algorithm that takes as input an instance of the problem and determines whether
the answer to that instance is “yes” or “no”.
(eg) of undecidable problems are
(1)Halting problem of the TM.

15. Give examples of decidable problems.
1. Given a DFSM M and string w, does M accept w?
2. Given a DFSM M is L(M) = _ ?
3. Given two DFSMs M1 and M2 is L(M1)= L(M2) ?
4. Given a regular expression _ and a string w ,does _ generate w?
5. Given a NFSM M and string w ,does M accept w?
16. Give examples of recursive languages?

i. The language L defined as L= { “M” ,”w” : M is a DFSM that
accepts w} is recursive.
ii. L defined as { “M1” U “M2” : DFSMs M1 and M2 and L(M1)
=L(M2) } is recursive.
17. What are UTMs or Universal Turing machines?
Universal TMs are TMs that can be programmed to solve any problem, that can be solved by any Turing machine. A specific Universal Turing machine U is:
Input to U: The encoding “M “ of a Tm M and encoding “w” of a string w.
Behavior : U halts on input “M” “w” if and only if M halts on input w.

18. What is the crucial assumptions for encoding a TM?
There are no transitions from any of the halt states of any given TM .
Apart from the halt state , a given TM is total.

19. What properties of recursive enumerable seta are not decidable?
    • Emptiness
    • Finiteness
    • Regularity
    • Context-freedom.

20. Define L .When is a trivial property?
L is defined as the set { <M> | L(M) is in . } is a trivial property if is empty or it consists of all r.e languages.

21.What is a universal language Lu?
The universal language consists of a set of binary strings in the form of
pairs (M,w) where M is TM encoded in binary and w is the binary input string.
Lu = { < M,w> | M accepts w }.

22.What is a Diagonalization language Ld?
The diagonalization language consists of all strings w such that the TM M
whose code is w doesnot accept when w is given as input.

23. What properties of r.e sets are recursively enumerable?
    • L ≠Φ
    • L contains at least 10 members.
    • w is in L for some fixed w.
    • L ∩ Lu ≠ Φ

24. What properties of r.e sets are not r.e?
  • L = Φ
  • L = Σ *.
  • L is recursive
  • L is not recursive.
  • L is singleton.
  • L is a regular set.
  • L - Lu ≠ Φ

25. What are the conditions for L to be r.e?
L is recursively enumerable iff satisfies the following properties:
i. If L is in and L is a subset of L_ ,then L_ is in (containment property)
ii. If L is an infinite language in ,then there is a finite subset of L in .
iii. The set of finite languages in is enumaerable.

26. What is canonical ordering?
Let Σ * be an input set. The canonical order for Σ *as follows . List words in
order of size, with words of the same size in numerical order. That is let _ ={
x0,x1,…x t-1 } and xi is the digit i in base t.
(e.g) If _ ={ a,b } the canonical order is Σ * , a ,b , aa, ab ,……..

27. How can a TM acts as a generating device?
In a multi-tape TM ,one tape acts as an output tape, on which a symbol, once written can never be changed and whose tape head never moves left. On that output tape , M writes strings over some alphabet _ , separated by a marker symbol # , G(M) ( where G(M) is the set w in Σ * * such that w is finally printed between a pair of #’s on the output device ).

28. What are the different types of grammars/languages?
    • Unrestricted or Phase structure grammar.(Type 0 grammar).(for TMs)
    • Context sensitive grammar or context dependent grammar (Type1)(for Linear Bounded Automata )
    • Context free grammar (Type 2) (for PDA)
    • Regular grammar (Type 3) ( for Finite Automata).
This hierarchy is called as Chomsky Hierarchy.

29. Show that AMBIGUITY problem is un-decidable.
Consider the ambiguity problem for CFGs. Use the “yes-no” version of AMB. An algorithm for FIND is used to solve AMB. FIND requires producing a word with two or more parses if one exists and answers “no” otherwise. By the reduction of AMB to FIND we conclude there is no algorithm for FIND and hence no algorithm for AMB.

30.State the halting problem of TMs.
The halting problem for TMs is: Given any TM M and an input string w, does M halt on w? This problem is undecidable as there is no algorithm to solve this problem.

31.Define PCP or Post Correspondence Problem.
An instance of PCP consists of two lists , A = w1,w2,….wk and B = x1,…..xk of strings over some alphabet _ .This instance of PCP has a solution if there is any sequence of integers i1,i2,..im with m >=1 such that wi1, wi2,…wim = xi1,xi2 ,…xim The sequence i1 ,i2 ,…im is a solution to this instance of PCP.

32.Define MPCP or Modified PCP.
The MPCP is : Given lists A and B of K strings from _ * ,say A = w1 ,w2, …wk and B= x1, x2,…..xk does there exists a sequence of integers i1,i2,…ir such that w1wi1wi2…..wir = x1xi1xi2…xir?

33 . What is the difference between PCP and MPCP?
The difference between MPCP and PCP is that in the MPCP ,a solution
is required to start with the first string on each list.

34. What are the concepts used in UTMs?
  • _ Stored program computers.
  • Interpretive Implementation of Programming languages.
  • Computability.
                                ALL THE BEST!!!!