Skip to main content

Let G be a grammar s-0B | 1A, A - 0 | 0S | 1AA, B- 1 | 1S | 0BB

Let G be a grammar s-0B | 1A, A - 0 | 0S | 1AA, B- 1 | 1S | 0BB


Let G be a grammar s-0B | 1A, A - 0 | 0S | 1AA, B- 1 | 1S | 0BB


* Let G be a grammar s →0B | 1A, A → 0 | 0S | 1AA, B→ 1 | 1S | 0BB. For the string 00110101,
find
(i) leftmost derivation
(ii) rightmost derivation
(iii) derivation tree



Ans.  (i) S → 0B → 00BB → 001SB → 0 01SB → 0 01/AB → 00110B → 0 01101S → 0011010B → 00110101


Ans.  (ii) S → 0B → 00BB → 00B1S → 00B10B → 00B101 → 001S101 → 0011A 10 → 00110101


Ans.  (iii) 

    S1
  /    \
0      B2
     /   |    \
   0   B3    B6
       /  \     |   \
     1    4S   1   S7
          /  \       |   \
        1   5A     0   B8
               |          |
               0         1


   S1
 /    \
0     B2
     /   |   \
  0    B6   B3
      /  |       |  \
     1  S7     1   S4
         |            |  \
        A8           0   B5
         |                  |
         0                 1



(Ans. iii)


Comments

Popular posts from this blog

Windows Key Shortcuts

List of common keyboard shortcuts that can be used with the Windows key: (Image by - Sharma Guides | Subham232330) 1. Windows Key + D: Show the Desktop 2. Windows Key + E: Open File Explorer 3. Windows Key + I: Open Settings 4. Windows Key + L: Lock the computer 5. Windows Key + R: Open the Run Dialog 6. Windows Key + S: Open the search bar 7. Windows Key + Tab: Open Task View 8. Windows Key + Ctrl + D: Create a new virtual desktop 9. Windows Key + Ctrl + Left or Right arrow: Switch between virtual desktops 10. Windows Key + M: Minimize all windows 11. Windows Key + Shift + M: Undo minimize all windows 12. Windows Key + Up Arrow: Maximize the current window 13. Windows Key + Down Arrow: Minimize the current window 14. Windows Key + Right Arrow: Snap the current window to the right 15. Windows Key + Left Arrow: Snap the current window to the left 16. Windows Key + P: Project to a second screen 17. Windows Key + Home: Minimize all but the active window 18. Windows Key + ...

Computer Short Questions

Computer Short Questions & Answers: 1. What is any part of the computer that you can physically touch? – Hardware 2. Which generation of computers is still under development? – Fifth 3. What is the most common storage device for the personal computer? – Hard Disk Drive 4. Which key is used in combination with another key to perform a specific task? – Control 5. What is the pattern of printed lines on most products? – Barcodes 6. To make the number pad act as a directional arrow, we press which key? – Shift 7. Which devices let the computer communicate with you? – Input 8. What is the most frequently used piece of hardware for inputting data? – Hardware 9. What is the place where the computer stores programs and data? – Storage unit 10. What is the process of dividing the disk into tracks and sectors? – Formatting 11. What is the space in your computer that loads’ and works with data? – RAM memory 12. What is the storage which stores or retains data after power off? – Non-volatile s...

four methods overload these methods

Write a program in java which has the following classes and methods:  Class : OverloadDemo Methods : test() Declare four methods with the same name “test()” and overload these methods class OverloadDemo{  public void test(){  System.out.println("It's a test method for null.");  }  public void test(int n){  System.out.println("It's a test method for displaying the int value "+n);  }  public void test(double d){  System.out.println("It's a test method for displaying the double value "+d);  }  public void test(String s){  System.out.println("It's a test method for displaying the String "+s);  }  }  class overClass{  public static void main(String[] args) {  OverloadDemo old = new OverloadDemo();  old.test();  old.test(12);  old.test(25.35);  old.test("Subham");  }  } OUTPUT: It's a test method for null. It's a test method for displaying the int value 12 It's a test method for ...