Showing posts with label Tutorials. Show all posts
Showing posts with label Tutorials. Show all posts
electronic mesurements and instrumentation important quetions of all units

electronic mesurements and instrumentation important quetions of all units

UNIT-1
1. List out the dynamic characteristics of any measurement system.
2. What are the types of error measurement system?
3. What are the static characteristics important?
4. What is standard? What are the different types of standard?
5. What is the function of manipulation element in a measurement system?
6. What are the primary standards? Where are they used?
7. What is primary sensing element?
8. What is calibration?
9. Define the terms precision and sensitivity?
10. Define static error.
11. Distinguish re-productibility and repeatability.
12. Show the block diagram indicating functional elements of measurement system.
13. Distinguish between zero drift and span drift.
14. Define a dynamic response of an instrument.
15. What are the different calibration methodologies?
16. Define limiting errors and instrumental errors.
17. Mention any four static characteristics of measuring instruments.
18. Distinguish between direct and indirect methods of measurements.
19. What is the significance of calibration?
20. What is meant by accuracy and precision of an instrument?
21. List the different types of possible errors in measurements.
22. What is the difference between analog and digital instrument?
23. What are absolute instruments?
24. What is a secondary instrument?
25. How are secondary instruments classified?
16 Marks
1. Draw the block diagram showing the basic functional elements of an instrument and explain the functions of each.
2. Define limiting errors. Derive the expression for relative limiting errors.
3. Explain in detail calibration techniques and draw the calibration curve in general.
4. Give the methods of using any three standard inputs being used for analyzing the dynamic response of system with neat sketches.
5. Explain on the static and dynamic characteristics of a measurement system.
6. Describe in detail the different types of dynamic errors in a measurement system.
7. By using a micro meter screw the following readings were taken of a certain physical length

UNIT -II
2 Marks
1. What is creeping and how it is prevented?
2. What is the working principle of wattmeter employed in measuring instruments?
3. How are the analog instruments classified on the basis of method used for comparing the unknown quantity?
4. Give the advantages of moving iron meters.
5. What are different methods of measurement of frequency in the power frequency range?
6. Explain why it is necessary to make the potential coil circuit purely resistive in wattmeters.
7. What are the advantages of digital instruments over analog instruments?
8. How are resistors are checked using digital multimeters?
9. What is auto ranging?
10. Define resolution of DVM.
11. What are volt-ampere hour and watt-hour?
12. What is the purpose of instrument transformers?
13. What are the various principles of analog type electrical instruments?
14. Give the importance of iron loss measurements.
15. What is the reason for using MI on both A.C and D.C?
16. What is the precaution to be followed while using current transformer?
17. What is transfer instrument?
18. Why the PMMC instrument is not used for a.c measurements?
19. What is the principle of ramp type digital voltmeter?
20. Which torque is absent in energy meter? Why?
21. Explain the purpose of Schmitt trigger in digital frequency meter.
22. What are the essential parts of a ramp type digital voltmeter?
23. Define nominal rate of instrument transformer.
24. Explain the following term as applied to digital displays 3 ½ digit and 4-½ digit display.
25. Explain the principle of digital phase meter.

16 Marks
1. Derive the torque equation of electrodynamometer type instrument.
2. Explain with neat circuit diagram the working of successive approximation type DVM.
3. Draw the circuit diagram of digital phase meter and explain its working.
4. Give the construction and principle of operation of single phase induction type energy meter.
5. Describe the construction and functioning of mechanical type frequency meter.
6. Explain the functioning of Ferro-dynamic type electrical resonance frequency meter.
7. Describe the construction and working of PMMC instrument. Derive the equation for deflection if the instruments are spring controlled.
8. Derive the torque equation for an electro dynamometer type of wattmeter.
9. Write briefly with neat figures on (i) Principle of operation of a current transformer (ii) B-H curve analysis of a magnetic circuit.
10. Explain the working of moving iron instruments.
11. Explain the function of 3 phase energy meter and wattmeter.
12. How the range of d.c. Ammeter and d.c voltmeter can be extended? Derive the expressions to calculate shunt resistance and multiplier resistance.
13. Draw and explain the circuit diagram of digital frequency meter.
14. Explain the working of a digital multimeter with a schematic block diagram.
15. Explain the construction, working principle of a three-phase wattmeter. What is the importance of deflecting torque in these analog instruments?

UNIT-3
 
2 Marks
1. State the advantages of using the bridge circuits for the measurement.
2. What is the sensitivity of Wheat stone bridge?
3. What are the sources of errors in Wheat stone bridge?
4. Give the application and limitations of Wheat stone bridge.
5. Which measurement can be carried out by Maxwell bridge?
6. List the advantages of using standard capacitor in Maxwell bridge.
7. Give the advantage and limitations of Maxwell bridge.
8. What is Hay’s bridge?
9. Compare Hay’s bridge with Maxwell bridge.
10. What is Wien’s bridge?
11. Give the classification of external interference signals.
12. What is capacitance interference?
13. What is electrostatic shielding?
14. What is inductive interference?
15. State the method of reducing inductive interference.
16. What is electromagnetic interference?
17. State the sources of EM waves, which can cause interference.
18. State the method of reducing ground loop interference.
19. What is the standardization of potentiometer?
20. Write the application of d.c. Potentiometers.
21. Write the application of a.c. potentiometers.

16 Marks
1. Derive the bridge balance condition for the Maxwell bridge and Schering bridge
2. Explain in detail about the laboratory type DC potentio meter.
3. Describe about the multiple earth and earth loops.
4. Explain the different techniques of grounding.
5. Describe the circuit of Kelvin double bridge used for measurement of low resistance.
6. Explain how the inductance is measured in terms of known capacitance using Maxwell’s bridge.
7. Explain the working of Schering bridge.
8. Which bridge is used to measure frequency and explain the measurement procedure?
9. With neat diagram explain in detail about Hay bridge.
10. Explain about the Anderson bridge.

UNIT-4
 
2 Marks
1. What are the advantages and disadvantages of FM method of magnetic tape recording?
2. What are the different types of amplifiers used for CRO’s?
3. Give the principle of LCD type display device.
4. Draw a neat diagram on X-Y recorder.
5. Write two advantages of LED on electronic displays.
6. What are the advantages of magnetic tape recorder?
7. What is isolation probe?
8. State the features of ink-jet printers.
9. What are the various methods of recording data?
10. In what way line printers are advantages over dot matrix printer?
11. What are the different types of magnetic recording?
12. What are the different materials used on LED?
13. What are data loggers?
14. What are the functions of data loggers?
15. What are the basic components of data loggers?
16. List the advantages of LCD.
17. What is the sweeper in oscilloscope?
18. List the controllers normally found on XY recorder.
19. What is a recorder? How are the classified?
20. Define the deflection sensitivity of CRT.
21. List the main parts of cathode ray tube.
22. Discuss the advantages and disadvantages of PDM recording.
23. What is the basic operating principle of digital tape recording?
24. What are the basic components of a tape recorder?
25. What are the advantages of LCD over LED?
16 Marks
1. Explain the FM method of magnetic tape recording and explain its advantages and disadvantages.
2. Describe the principle of working and circuit diagram of a digital oscilloscope.
3. With neat figure explain the working principle of a digital CRO. What are its advantages of analog CRO.
4. Explain in detail how the data stored in magnetic disk and tape.
5. Describe the construction and working of LCD’s , mention the difference between light scattering and field effect types of LCD’s also explain the advantages of LCDs.
6. Discuss in detail about various types of recorders.
7. Discuss in detail about dot matrix displays.
8. Explain the various methods of magnetic recording.
9. Describe the pulse duration modulation (PDM) as used in magnetic tape recording and explain its merits and demerits.
10. With neat figure explain the construction and working principle of a digital storage oscilloscope. Compare its advantages over an analog CRO.


UNIT-5
1.) 2 Marks
1. Define transducer.
2. Mention some advantages of electrical transducers.
3. Mention some basic requirements of a transducer.
4. What are the classifications of transducers?
5. What is primary transducer?
6. What is secondary transducer?
7. What is active transducer? Mention some example.
8. What is passive transducer? Mention some example.
9. What is analog and digital transducers?
10. What is inverse transducer?
11. What are the types of potentiometers?
12. What are the advantages and disadvantages of potentiometers?
13. Define strain gauges.
14. Define gauge factor.
15. Mention types of strain gauge.
16. What is resistance thermometer?
17. What are the advantages and disadvantages of resistance thermometers?
18. What is thermistor? State the advantage and disadvantages.
19. What is inductive transducer?
20. Mention some advantages and disadvantages of LVDT.
21. Mention the applications of LVDT.
22. What is the basic principle of capacitive transducer?
23. Mention some advantages and disadvantages of capacitive transducer.
24. What is piezo electric effect?
25. What are the materials used for piezo electric transducer?
26. What are the types of DAS? State the applications also.
27. What are the essential functions of digital DAC?
28. What are the types of ADC?
29. What are the types of DAC?
30. What is smart sensor? Mention some applications.



2.) 16 Marks
1. How the transducers are classified on the basis of principle of operation?
2. Explain the generalized diagram of a digital data acquisition system?
3. Describe the different modes of operation of piezo electric transducers.
4. Describe in details the successive approximation method of ADC.
5. Describe the different principles of working of capacitive transducers.
6. Explain the construction and principle of working of a LVDT.
7. Explain about the thermistor and thermocouples.
8. Discuss R-2R ladder type DAC.
9. Explain the resistive transducer with respective potentiometer.
10. Explain the principle of operation of piezo electric transducer.
11. Discuss in detail about optical encoder, Resistive encoder and shaft encoder.
12. Explain in detail about ADC and DAC converters.



3.) 16 Marks
1. How the transducers are classified on the basis of principle of operation?
2. Explain the generalized diagram of a digital data acquisition system?
3. Describe the different modes of operation of piezo electric transducers.
4. Describe in details the successive approximation method of ADC.
5. Describe the different principles of working of capacitive transducers.
6. Explain the construction and principle of working of a LVDT.
7. Explain about the thermistor and thermocouples.
8. Discuss R-2R ladder type DAC.
9. Explain the resistive transducer with respective potentiometer.
10. Explain the principle of operation of piezo electric transducer.
11. Discuss in detail about optical encoder, Resistive encoder and shaft encoder.
12. Explain in detail about ADC and DAC converters.
Electrical circuits JNTUH Most wanted Quetions

Electrical circuits JNTUH Most wanted Quetions

                                JNTUH Most Wanted Quetions




1. Draw the energy band diagram of insulator, semiconductor and conductor.

2. Explain zener breakdown

3. Explain how depletion region is formed in PN junction diode.

4. Explain avalanche breakdown.

5. Explain Drift and Diffusion current in a diode.

6. Define rectifier. State its classification.

7. Explain the forward biasing  of PN junction diode.

8. Explain avalanche breakdown.

9. Explain the reverse biasing  of PN junction diode

10. Define transistor biasing.

11. Draw the circuit diagram of transistor used in CE configuration.

12. What are the basic conditions for transistor biasing?

13. What are the advantages of negative feedback?

14. Explain the difference between FET and BJT

15. Draw the input and output characteristic curves of CB configuration of a transistor?

16. State the application of UJT?

17. Explain the operation of DIAC when MT2 is negative with respect to MT1.

18. Draw the input and output characteristic curves of CE configuration of a transistor?

19. State the application of  DIAC?

20. Define transistor biasing.

21. Draw the circuit of half wave rectifier and output waveform.

22. State Holding current and peak reverse voltage of  SCR?

23. Draw the circuit of full wave rectifier and output waveform.

24. Draw the symbol of npn and pnp transistor?

25. State the application of JFET .

26. State De-Morgan’s Theorem.

27. What is a logic gate? What is meant by positive and negative logic?

28. What are the basic laws of Boolean Algebra.

29. Explain how OR and AND gate is derived from NAND gate.

30. Write the symbol and truth table for a) NOT, b) NAND and c) NOR gates

31. What is a shift register. Name the different types of shift register.

32. What is the primary disadvantage of asynchronous counter?

33. Explain the Associative  and Distributive law of Boolean algebra.

34. What is the necessary of ADC.

35. Draw the full adder circuit .

36. What is the basic concept of D/A converter.

37. Convert (526.44) 10 =  (?)2  and (1101101)2 = (?)10

38. Write the symbol and truth table of a) OR and b)AND gate

39. Draw the Half adder circuit .

40. What is a logic gate? What is meant by positive and negative logic.

41. What is a shift register. Name the different types of shift register

42. What is the primary disadvantage of asynchronous counter.

43. What is a logic gate? What is meant by positive and negative logic.

44. What is a shift register. Name the different types of shift register

45. Write the symbol and truth table of a) NOR and b)NOT gate.

46. What is asynchronous  and synchronous counter.

47. What is the use of accumulator?

48. How instruction are classified according to their length. Give examples.

49. Explain JUMP instruction used in 8085.

50. Define Program Counter and ALU.

51. With example explain Direct addressing and  Register addressing?

52. What is I/O mapped I/O.

53. What are the control signal pins of 8085,

54.  What is the use of accumulator.

55. What are the different addressing modes of 8085 processor.

56. How are the instructions of 8085 classified?

57. Explain vectored and non vectored interrupt.

58. State the difference between JUMP and CALL instruction used in 8085.

59. Define Program Counter and ALU.

60. How are the instructions of 8085 classified?

61. Explain vectored and non vectored interrupt.

62. What is memory mapped I/O.

63. Define stack pointer .

PART B

Explain the operation of PN junction diode under   forward and reverse biasing. Also      

draw its V-I  characteristics.

With a neat sketch, explain the working of i) Centre tap full wave rectifier ii) Bridge full        

 wave rectifier.

Explain the operation and characteristic of common emitter configuration with diagram.

With neat diagram explain the working principle and VI characteristic of SCR.

Design   the circuits of half adder and full adder with the help of their truth tables

 With neat diagram explain the operation of RS and JKMS flipflop.

 Explain the architecture of 8085 microprocessor with neat sketch

Explain the various addressing modes of 8085 with examples.

Write an 8085 assembly language program to find the square of an 8-bit number.

Explain the I/O interfacing using decode logic for input and output ports

  Explain 8085 microprocessor based stepper motor control.

Explain the operation of Zener diode under   forward and reverse biasing. Also draw its V-I

characteristics.

 With a neat sketch, explain the working of half wave rectifier. Also derive the ripple  factor and

efficiency .

  Explain the operation of npn transistor  with neat diagram.  Explain transistor biasing

  With neat diagram explain the construction and working principle of TRIAC.

 Explain the realization of other gates using NAND gate.

  With neat diagram explain four bit asynchronous up counter.

 Explain the pin diagram of 8085 microprocessor with neat sketch

Explain the arithmetic instruction of 8085 with examples.

Write an 8085 assembly language program to add two 8-bit number.

 Explain the output device interfacing with 8085 processor

  Explain 8085 microprocessor based stepper motor control.

Explain the operation of Zener diode under   forward and reverse biasing. Also draw its V-I

characteristics.

With a neat sketch, explain the working of full wave rectifier. Also derive the ripple factor and

efficiency .

  Describe the input and output characteristics of   common emitter transistor with circuit

diagram and  graphs

  With neat diagram explain the construction and working principle of DIAC.

  Explain the realization of other gates using NOR gate.

With neat diagram explain the shift register.

Explain the status signals of 8085. Also discuss about various interrupts of 8085

Explain the various logical instruction of 8085 with examples.

Explain the input  device interfacing with 8085 processor

Explain 8085 microprocessor based temperature control system.

Explain the n-type and p-type semiconductor with neat diagram

With a neat sketch, explain the working of Bridge rectifier and centre tapped rectifier.

 Explain the construction, working principle and characteristic of JFET.

   With neat diagram explain the construction and working principle of SCR.

 Explain the Logic gates with symbol and truth table.

     What is Universal gate.

With neat diagram explain operation of R-2R ladder D/A converter.

Explain the architecture of 8085 microprocessor with neat sketch

Explain the various data transfer instruction of 8085 with examples.

Explain the input  device interfacing with 8085 processor

Explain 8085 microprocessor based traffic light control system.

Explain the n-type and p-type semiconductor with neat diagram

Explain the operation and characteristic of common emitter configuration with neat diagram.

With neat diagram explain the construction and working principle of TRIAC.

State and prove Demorgan’s Theorems

Construct AND and NAND gates using NOR gate and explain its operation.

With neat diagram explain operation of successive approximation A/D converter.

Explain the architecture of 8085 microprocessor with neat sketch

Explain the various addressing modes of 8085 with examples.

Write an 8085 assembly language program to find the subtraction of two  8-bit number

Explain the I/O interfacing using decode logic for input and output ports

Explain 8085 microprocessor based traffic light control system.
compiler design short quetions with answers of all units

compiler design short quetions with answers of all units



Compiler Design – Set 1

1. What is a compiler?
A compiler is a program that reads a program written in one language –the source language and translates it into an equivalent program in another language-the target language. The compiler reports to its user the presence of errors in the source program.
2. What are the two parts of a compilation? Explain briefly.
Analysis and Synthesis are the two parts of compilation.
The analysis part breaks up the source program into constituent pieces and creates an intermediate representation of the source program.
Image result for compiler phasesThe synthesis part constructs the desired target program from the intermediate representation.
3. List the subparts or phases of analysis part.
Analysis consists of three phases:
  • Linear Analysis.
  • Hierarchical Analysis.
  • Semantic Analysis.
4. Depict diagrammatically how a language is processed.
Skeletal source program
Preprocessor
Source program
Compiler
Target assembly program
Assembler
Relocatable machine code
Loader/ link editor ←library, relocatable object files
Absolute machine code
5. What is linear analysis?
Linear analysis is one in which the stream of characters making up the source program is read from left to right and grouped into tokens that are sequences of characters having a collective meaning.
Also called lexical analysis or scanning.
6. List the various phases of a compiler.
The following are the various phases of a compiler:
  • Lexical Analyzer
  • Syntax Analyzer
  • Semantic Analyzer
  • Intermediate code generator
  • Code optimizer
  • Code generator
7. What are the classifications of a compiler?
Compilers are classified as:
  • · Single- pass
  • · Multi-pass
  • · Load-and-go
  • · Debugging or optimizing
8. What is a symbol table?
A symbol table is a data structure containing a record for each identifier, with fields for the attributes of the identifier. The data structure allows us to find the record for each identifier quickly and to store or retrieve data from that record quickly.
Whenever an identifier is detected by a lexical analyzer, it is entered into the symbol table. The attributes of an identifier cannot be determined by the lexical analyzer.
9. Mention some of the cousins of a compiler.
Cousins of the compiler are:
  • · Preprocessors
  • · Assemblers
  • · Loaders and Link-Editors
10. List the phases that constitute the front end of a compiler.
The front end consists of those phases or parts of phases that depend primarily on the source language and are largely independent of the target machine. These include
  • · Lexical and Syntactic analysis
  • · The creation of symbol table
  • · Semantic analysis
  • · Generation of intermediate code
A certain amount of code optimization can be done by the front end as well. Also includes error handling that goes along with each of these phases.
11. Mention the back-end phases of a compiler.
The back end of compiler includes those portions that depend on the target machine and generally those portions do not depend on the source language, just the intermediate language. These include
  • · Code optimization
  • · Code generation, along with error handling and symbol- table operations.
12. Define compiler-compiler.
Systems to help with the compiler-writing process are often been referred to as compiler-compilers, compiler-generators or translator-writing systems.
Largely they are oriented around a particular model of languages , and they are suitable for generating compilers of languages similar model.
13. List the various compiler construction tools.
The following is a list of some compiler construction tools:
  • · Parser generators
  • · Scanner generators
  • · Syntax-directed translation engines
  • · Automatic code generators
  • · Data-flow engines
14. Differentiate tokens, patterns, lexeme.
  • · Tokens- Sequence of characters that have a collective meaning.
  • · Patterns- There is a set of strings in the input for which the same token is produced as output. This set of strings is described by a rule called a pattern associated with the token
  • · Lexeme- A sequence of characters in the source program that is matched by the pattern for a token.
15. List the operations on languages.
  • · Union – L U M ={s | s is in L or s is in M}
  • · Concatenation – LM ={st | s is in L and t is in M}
  • · Kleene Closure – L* (zero or more concatenations of L)
  • · Positive Closure – L+ ( one or more concatenations of L)
16. Write a regular expression for an identifier.
An identifier is defined as a letter followed by zero or more letters or digits.
The regular expression for an identifier is given as
letter (letter | digit)*
17. Mention the various notational shorthands for representing regular expressions.
  • · One or more instances (+)
  • · Zero or one instance (?)
  • · Character classes ([abc] where a,b,c are alphabet symbols denotes the regular expressions a | b | c.)
  • · Non regular sets
18. What is the function of a hierarchical analysis?
Hierarchical analysis is one in which the tokens are grouped hierarchically into nested collections with collective meaning.
Also termed as Parsing.
19. What does a semantic analysis do?
Semantic analysis is one in which certain checks are performed to ensure that components of a program fit together meaningfully.
Mainly performs type checking.
20. List the various error recovery strategies for a lexical analysis.
Possible error recovery actions are:
  • · Panic mode recovery
  • · Deleting an extraneous character
  • · Inserting a missing character
  • · Replacing an incorrect character by a correct character
  • · Transposing two adjacent characters

Compiler Design – Set 2

  1. Define parser.
Hierarchical analysis is one in which the tokens are grouped hierarchically into nested collections with collective meaning.
Also termed as Parsing.
  1. Mention the basic issues in parsing.
There are two important issues in parsing.
  • · Specification of syntax
  • · Representation of input after parsing.
  1. Why lexical and syntax analyzers are separated out?
Reasons for separating the analysis phase into lexical and syntax analyzers:
    • Simpler design.
    • Compiler efficiency is improved.
    • Compiler portability is enhanced.
  1. Define a context free grammar.
A context free grammar G is a collection of the following
  • · V is a set of non terminals
  • · T is a set of terminals
  • · S is a start symbol
  • · P is a set of production rules
G can be represented as G = (V,T,S,P)
Production rules are given in the following form
Non terminal → (V U T)*
  1. Briefly explain the concept of derivation.
Derivation from S means generation of string w from S. For constructing derivation two things are important.
i) Choice of non terminal from several others.
ii) Choice of rule from production rules for corresponding non terminal.
Instead of choosing the arbitrary non terminal one can choose
i) either leftmost derivation – leftmost non terminal in a sentinel form
ii) or rightmost derivation – rightmost non terminal in a sentinel form
  1. Define ambiguous grammar.
A grammar G is said to be ambiguous if it generates more than one parse tree for some sentence of language L(G).
i.e. both leftmost and rightmost derivations are same for the given sentence.
  1. What is a operator precedence parser?
A grammar is said to be operator precedence if it possess the following properties:
1. No production on the right side is ε.
2. There should not be any production rule possessing two adjacent non terminals at the right hand side.
  1. List the properties of LR parser.
1. LR parsers can be constructed to recognize most of the programming languages for which the context free grammar can be written.
2. The class of grammar that can be parsed by LR parser is a superset of class of grammars that can be parsed using predictive parsers.
3. LR parsers work using non backtracking shift reduce technique yet it is efficient one.
  1. Mention the types of LR parser.
  • · SLR parser- simple LR parser
  • · LALR parser- lookahead LR parser
  • · Canonical LR parser
  1. What are the problems with top down parsing?
The following are the problems associated with top down parsing:
  • · Backtracking
  • · Left recursion
  • · Left factoring
  • · Ambiguity
  1. Write the algorithm for FIRST and FOLLOW.
FIRST
1. If X is terminal, then FIRST(X) IS {X}.
2. If X → ε is a production, then add ε to FIRST(X).
3. If X is non terminal and X → Y1,Y2..Yk is a production, then place a in FIRST(X) if for some i , a is in FIRST(Yi) , and ε is in all of FIRST(Y1),…FIRST(Yi-1);
FOLLOW
1. Place $ in FOLLOW(S),where S is the start symbol and $ is the input right endmarker.
2. If there is a production A → αBβ, then everything in FIRST(β) except for ε is placed in FOLLOW(B).
3. If there is a production A → αB, or a production A→ αBβ where FIRST(β) contains ε , then everything in FOLLOW(A) is in FOLLOW(B).
  1. List the advantages and disadvantages of operator precedence parsing.
Advantages
This typeof parsing is simple to implement.
Disadvantages
1. The operator like minus has two different precedence(unary and binary).Hence it is hard to handle tokens like minus sign.
2. This kind of parsing is applicable to only small class of grammars.
  1. What is dangling else problem?
Ambiguity can be eliminated by means of dangling-else grammar which is show below:
stmt → if expr then stmt
| if expr then stmt else stmt
| other
  1. Write short notes on YACC.
YACC is an automatic tool for generating the parser program.
YACC stands for Yet Another Compiler Compiler which is basically the utility available from UNIX.
Basically YACC is LALR parser generator.
It can report conflict or ambiguities in the form of error messages.
  1. What is meant by handle pruning?
A rightmost derivation in reverse can be obtained by handle pruning.
If w is a sentence of the grammar at hand, then w = γn, where γn is the nth right-sentential form of some as yet unknown rightmost derivation
S = γ0 => γ1…=> γn-1 => γn = w
  1. Define LR(0) items.
An LR(0) item of a grammar G is a production of G with a dot at some position of the right side. Thus, production A → XYZ yields the four items
A→.XYZ
A→X.YZ
A→XY.Z
A→XYZ.
  1. What is meant by viable prefixes?
The set of prefixes of right sentential forms that can appear on the stack of a shift-reduce parser are called viable prefixes. An equivalent definition of a viable prefix is that it is a prefix of a right sentential form that does not continue past the right end of the rightmost handle of that sentential form.
  1. Define handle.
A handle of a string is a substring that matches the right side of a production, and whose reduction to the nonterminal on the left side of the production represents one step along the reverse of a rightmost derivation.
A handle of a right – sentential form γ is a production A→β and a position of γ where the string β may be found and replaced by A to produce the previous right-sentential form in a rightmost derivation of γ. That is , if S =>αAw =>αβw,then A→β in the position following α is a handle of αβw.
  1. What are kernel & non-kernel items?
Kernel items, whish include the initial item, S’→ .S, and all items whose dots are not at the left end.
Non-kernel items, which have their dots at the left end.
  1. What is phrase level error recovery?
Phrase level error recovery is implemented by filling in the blank entries in the predictive parsing table with pointers to error routines. These routines may change, insert, or delete symbols on the input and issue appropriate error messages. They may also pop from the stack.

Compiler Design – Set 3

  1. What are the benefits of intermediate code generation?
    • A Compiler for different machines can be created by attaching different back end to the existing front ends of each machine.
    • A Compiler for different source languages can be created by proving different front ends for corresponding source languages t existing back end.
    • A machine independent code optimizer can be applied to intermediate code in order to optimize the code generation.
  1. What are the various types of intermediate code representation?
There are mainly three types of intermediate code representations.
  • · Syntax tree
  • · Postfix
  • · Three address code
  1. Define backpatching.
Backpatching is the activity of filling up unspecified information of labels using appropriate semantic actions in during the code generation process.In the semantic actions the functions used are mklist(i),merge_list(p1,p2) and backpatch(p,i)
  1. Mention the functions that are used in backpatching.
  • · mklist(i) creates the new list. The index i is passed as an argument to this function where I is an index to the array of quadruple.
  • · merge_list(p1,p2) this function concatenates two lists pointed by p1 and p2. It returns the pointer to the concatenated list.
  • · backpatch(p,i) inserts i as target label for the statement pointed by pointer p.
  1. What is the intermediate code representation for the expression a or b and not c?
The intermediate code representation for the expression a or b and not c is the three address sequence
t1 := not c
t2 := b and t1
t3 := a or t2
  1. What are the various methods of implementing three address statements?
The three address statements can be implemented using the following methods.
  • · Quadruple : a structure with atmost four fields such as operator(OP),arg1,arg2,result.
  • · Triples : the use of temporary variables is avoided by referring the pointers in the symbol table.
  • · Indirect triples : the listing of triples has been done and listing pointers are used instead of using statements.
  1. Give the syntax-directed definition for if-else statement.
1. S → if E then S1
E.true := new_label()
E.false :=S.next
S1.next :=S.next
S.code :=E.code | | gen_code(E.true ‘: ‘) | | S1.code
2. S → if E then S1 else S2
E.true := new_label()
E.false := new_label()
S1.next :=S.next
S2.next :=S.next
S.code :=E.code | | gen_code(E.true ‘: ‘) | | S1.code| | gen_code(‘go to’,S.next) | |gen_code(E.false ‘:’) | | S2.code

Compiler Design – Set 4

  1. Mention the properties that a code generator should possess.
  • · The code generator should produce the correct and high quality code. In other words, the code generated should be such that it should make effective use of the resources of the target machine.
  • · Code generator should run efficiently.
    • · Define and use – the three address statement a:=b+c is said to define a and to use b and c.
    • · Live and dead – the name in the basic block is said to be live at a given point if its value is used after that point in the program. And the name in the basic block is said to be dead at a given point if its value is never used after that point in the program.
  1. List the terminologies used in basic blocks.
  1. What is a flow graph?
A flow graph is a directed graph in which the flow control information is added to the basic blocks.
  • · The nodes to the flow graph are represented by basic blocks
  • · The block whose leader is the first statement is called initial block.
  • · There is a directed edge from block B1 to block B2 if B2 immediately follows B1 in the given sequence. We can say that B1 is a predecessor of B2.
  1. What is a DAG? Mention its applications.
Directed acyclic graph(DAG) is a useful data structure for implementing transformations on basic blocks.
DAG is used in
  • · Determining the common sub-expressions.
  • · Determining which names are used inside the block and computed outside the block.
  • · Determining which statements of the block could have their computed value outside the block.
  • · Simplifying the list of quadruples by eliminating the common su-expressions and not performing the assignment of the form x := y unless and until it is a must.
  1. Define peephole optimization.
Peephole optimization is a simple and effective technique for locally improving target code. This technique is applied to improve the performance of the target program by examining the short sequence of target instructions and replacing these instructions by shorter or faster sequence.
  1. List the characteristics of peephole optimization.
  • · Redundant instruction elimination
  • · Flow of control optimization
  • · Algebraic simplification
  • · Use of machine idioms
  1. How do you calculate the cost of an instruction?
The cost of an instruction can be computed as one plus cost associated with the source and destination addressing modes given by added cost.
MOV R0,R1 1
MOV R1,M 2
SUB 5(R0),*10(R1) 3
  1. What is a basic block?
A basic block is a sequence of consecutive statements in which flow of control enters at the beginning and leaves at the end without halt or possibility of branching.
Eg. t1:=a*5
t2:=t1+7
t3:=t2-5
t4:=t1+t3
t5:=t2+b
  1. How would you represent the following equation using DAG?
a:=b*-c+b*-c

Compiler Design – Set 5

  1. Mention the issues to be considered while applying the techniques for code optimization.
  • · The semantic equivalence of the source program must not be changed.
  • · The improvement over the program efficiency must be achieved without changing the algorithm of the program.
    • · The machine dependent optimization is based on the characteristics of the target machine for the instruction set used and addressing modes used for the instructions to produce the efficient target code.
    • · The machine independent optimization is based on the characteristics of the programming languages for appropriate programming structure and usage of efficient arithmetic properties in order to reduce the execution time.
      • · Available expressions
      • · Reaching definitions
      • · Live variables
      • · Busy variables
  1. What are the basic goals of code movement?
    • To reduce the size of the code i.e. to obtain the space complexity.
    • To reduce the frequency of execution of code i.e. to obtain the time complexity.
  1. What do you mean by machine dependent and machine independent optimization?
  1. What are the different data flow properties?
  1. List the different storage allocation strategies.
The strategies are:
  • · Static allocation
  • · Stack allocation
  • · Heap allocation
  1. What are the contents of activation record?
The activation record is a block of memory used for managing the information needed by a single execution of a procedure. Various fields f activation record are:
  • · Temporary variables
  • · Local variables
  • · Saved machine registers
  • · Control link
  • · Access link
  • · Actual parameters
  • · Return values
  1. What is dynamic scoping?
In dynamic scoping a use of non-local variable refers to the non-local data declared in most recently called and still active procedure. Therefore each time new findings are set up for local names called procedure. In dynamic scoping symbol tables can be required at run time.
  1. Define symbol table.
Symbol table is a data structure used by the compiler to keep track of semantics of the variables. It stores information about scope and binding information about names.
  1. What is code motion?
Code motion is an optimization technique in which amount of code in a loop is decreased. This transformation is applicable to the expression that yields the same result independent of the number of times the loop is executed. Such an expression is placed before the loop.
  1. What are the properties of optimizing compiler?
The source code should be such that it should produce minimum amount of target code.
There should not be any unreachable code.
Dead code should be completely removed from source language.
The optimizing compilers should apply following code improving transformations on source language.
i) common subexpression elimination
ii) dead code elimination
iii) code movement
iv) strength reduction
  1. What are the various ways to pass a parameter in a function?
  • · Call by value
  • · Call by reference
  • · Copy-restore
  • · Call by name
  1. Suggest a suitable approach for computing hash function.
Using hash function we should obtain exact locations of name in symbol table.
The hash function should result in uniform distribution of names in symbol table.
The hash function should be such that there will be minimum number of collisions. Collision is such a situation where hash function results in same location for storing the names.