# GATE Papers >> CSE >> 2016 >> Question No 156

Question No. 156

A student wrote two context-free grammars G1 and G2 for generating a single C-like array declaration. The dimension of the array is at least one. For example,

int a[10][3];
The grammars use $D$ as the start symbol, and use six terminal symbols int ; id [ ] num.
 Grammar G1 Grammar G2 $D\rightarrow\mathbf{int}\boldsymbol\;L;$ $D\boldsymbol\rightarrow\mathbf{int}\boldsymbol\;L;$ $L\rightarrow\mathbf{id}\lbrack E$ $L\boldsymbol\rightarrow\mathbf{id}\boldsymbol\;E$ $E\rightarrow\mathbf{num}\rbrack$ $E\rightarrow E\lbrack\mathbf{num}\rbrack$ $E\rightarrow\mathbf{num}\rbrack\lbrack E$ $E\rightarrow\lbrack\mathbf{num}\rbrack$

Which of the grammars correctly generate the declaration mentioned above?

##### Answer : (A) Both G1 and G2

Solution of Question No 156 of GATE 2016 CSE Paper

Both G1 and G2 can generate int a[10][3];

as follows:

G1:  D → int L; int id[E ;

→  int id [ num][ E;

→  int id [num] [num];

G2:  D → int L ;  →  int id E;

→  int id E [num];

→  int id [num][num];

ckrLfq http://pills2sale.com/ levitra nizagara

Posted on  18/10/2020 15:37:53  by  dobsonz
nviNIs http://pills2sale.com/ levitra nizagara

Posted on  18/10/2020 15:39:42  by  dobsonz

Posted on  01/11/2020 20:27:14  by  johnanx

Posted on  04/12/2020 01:41:48  by  dobson

Posted on  04/12/2020 03:02:52  by  dobson
jfm7eO http://xnxx.in.net/ xnxx videos

Posted on  12/12/2020 20:10:42  by  johnan
rCRlHR http://xnxx.in.net/ xnxx videos

Posted on  12/12/2020 21:45:41  by  johnan

Posted on  13/12/2020 04:18:48  by  dobson
ost2nC https://writemyessayforme.web.fc2.com/

Posted on  13/12/2020 04:59:10  by  dobson
SUm2dz https://writemyessayforme.web.fc2.com/#writemyessay

Posted on  15/12/2020 05:18:39  by  dobson
tjNBgr https://writemyessayforme.web.fc2.com/#writemyessay

Posted on  15/12/2020 05:59:06  by  dobson

Posted on  09/01/2021 10:32:03  by  dobson