Académique Documents
Professionnel Documents
Culture Documents
1. S&P 500 index closed at 2000 on Friday last week, and it went up by 20
points on Monday. The index lost 30 points the next day and closed at
2040 on Wednesday. Then it went up by 40 points on Thursday and
closed the week gaining another 40 points on Friday, hitting a record
high. What was the change in the index on Wednesday? (1 - Mark)
a. -10
b. 40
c. 50
d. 80
Solution:
The index on each day is as follows:
5. There are 100 people in a room, exactly 99% are physicist. How many
physicist must leave the room to bring down the percentage of physicist
to exactly 98%?
a. 49
b. 50
c. 99
d. None
Solution:
let x represent the number of physicist that need to leave
so we get:
99- x / 100-x = .98
99-x = 98 - .98x
1 = .02x
x = 50
so it is 50 physicist
10. Varma, Naveen, and Subbarao race each other in a 100 meters race.
All of them run at a constant speed throughout the race.
Varma beats Naveen by 20 meters.
Naveen beats Subbarao by 20 meters.
How many meters does Varma beat Subbarao by?_____ (meters)
Solution:
Answer is 36
Varma beats Naveen by 20m and Naveen beats Subbarao by 20 m in a
100m race
When Varma runs 100m Naveen runs 80m
When Naveen runs 100m Subbarao runs 80m
So when Naveen will run 80m Subbarao will run 80*80/100 = 64m
Hence when Varma runs 100m Subbarao runs 64m
Varma beats Subbarao by 100 - 64 = 36m
Computer Science
1. A commuter bus has 10 seats. The probability that any passenger will not
show up for the bus is 0.6 independent of other passengers. If the bus
company sells 12 tickets for the bus operation, what is the probability that at
least one passenger will have to stand? (Discrete Maths - 2 Marks)
10
38×2
a. 11
5
12
38×2
b. 12
5
11
2
c. 12
5
11
38×2
d. 12
5
Solution:
Let X be the random variable that represents the number of passengers
showing up for the bus, and p be the probability that any passenger will
show up for the bus. Then, the probability that the number of passengers
exceeds the number of seats is
P(X>10) = P(X=11) + P(X=12)
Since anybody's absence is independent of others', X follows the binomial
distribution X ~ B (12, p) Therefore for all k, P(X=k) is
Hence we have
2. A tower is built with cards. Only 2 cards are needed for 1 floor, and 7 cards
are needed for 2 floors, and so on. What is the number of cards needed for a
10-floor tower?_________ (Discrete Maths 2 Marks)
Solution:
To build an n-floor tower, what we need at the bottom below the (n-1)-floor
tower already built is the following:
a. n 1 -floor towers which need 2 cards each
b. (n-1) cards to be laid on top of these n 1 -floor towers.
Let x.n be the number of cards needed for an n-floor tower, then x1 =2 and
for n>=2
3. Consider the following statements (Maths - 2 marks)
I. Suppose A is a 3×3 matrix whose third row elements are the sum of
first two row elements. Then A is invertible.
II. Let An denote n×n matrix whose diagonal entries are equal to 3 and all
other entries are equal to 1. Then An is invertible for each n≥1.
Which of the following is true?
a. I only
b. II only
c. Both I and II
d. None of these
Solution:
Let A =
By doing the row operation R3 -> R3 - (R1 + R2) we get
The reduced echelon form of A has a row of zeros. So, A is not invertible
(therefore |A| = 0)
Statement II:
An =
Apply row operation R1 -> R1 + R2 + R3 + ….. + Rn on An, we get
R1
R1 -> n+2 , we get
=
R2 -> R2 - R1, R3 -> R3 - R1, ….., ….. Rn -> Rn -R1, we get
=
R2 R3 Rn
R2 -> 2 , R3 -> 2 ,... Rn -> 2 , we get
=
Then the reduced echelon form of An is identity matrix
Therefore |An| =/ 0
So, An is invertible
4. Suppose f(x) is a differentiable function on the interval [6,9] such that
f(6)=18 and f(9)=27 Which of the following values must be contained in
f’([6,9])._____ (Maths - 2 Marks)
Solution:
Answer is 3
Let g(x) = f(x)-18-(x-6) 27−18
9−6 =f(x)-18-3(x-6) = f(x)-3x on [6, 9].
Then g(6)=0=g(9) and g(x) is differentiable on [6, 9]
By rolle’s theorem, there is c ∈ (6, 9) such that g’(c) = 0
Since g’(x) = f’(x) -3, thus 0 = g’(c) = f’(c)-3 which implies f’(c) = 3 Hence
3 must be contained in f’([6,9]).
Now, suppose that f(x)=3x then f(x) satisfies the conditions in the problem
and f’(x)=3 on [6,9]. So, 2,0,4 may not contained in f’([6,9])
5. Suppose 3 married couples are randomly seated around a circular table. (It is
not required that the members of any couple must be seated together.) The
probability that no spouses are seated next to one another is ab , where a and
b are positive coprime integers. Find b-a._____ (Discrete Maths 2 Marks)
Solution:
Answer is 11
no. of ways when all three spouses sit together=16
no. of ways when two of the three spouses sit together=24
no. of ways when only one pair of spouses sit together=48
therefore 16+24+48=88
there are total (6-1)! ways... =120
Thus there are 32 ways in which spouses don't sit together...
therefore after simplifying we get 4/15 = then b-a = 15-4 = 11
6. A theater is inviting 2670 total students from various schools to see a movie.
Each individual school invited is only allowed to bring at most 38 students.
If the theater has 193 seats in each row, how many rows do they need to set
aside for schools in order to guarantee that all students from the same school
can be seated in the same row?___________ (Discrete Maths - 2 Marks)
Solution:
Answer is 17
The following table shows the number of extra (unoccupied) seats in each
row based on the assumption that exactly n students show up from each
school:
the second row of which is the quotient of 193 upon division by n, and the
third row of which is the remainder of 193 upon division by n. The reason
for this table is to find the worst case scenario where the most number of
seats are unoccupied in each row. As we can see in the table, n=33 is the
worst case where as many as 28 seats are unoccupied in each row. (For
n<=28 the number of extra seats is less then, 28 because the remainder must
be smaller than the divisor.)
Thus in the worst case scenario, the number of students sitting in each row
is33*5 =165(<193).
165*16 = 2640, which is 30 short. Again in the worst case, those 30 remain
as a single class. Since there are 28 empty spaces per row, that means the
extra 30 must go on a new row, so 17 rows are needed.
8. Satish has 4 black shirts and 6 white shirts in his closet. He also has 5 black
ties and 3 white ties in his drawer. If Satish reaches into the closet and takes
out a shirt at random, then reaches into the drawer and takes out a tie at
random, then the probability that the shirt and the tie are the same color is ab
, where a and b are coprime positive integers. What is the value of
a+b?_________ (Discrete Maths 1 Mark)
Solution:
4
The probability of picking out a black shirt and a black tie is 10 × 58 = 14
6 3 9
The probability of picking out a white shirt and a white tie is 10 × 8 = 40
Hence, the probability of picking out a shirt and tie of the same color is
1 9 19
4 + 40 = 40
Hence a+b = 59
Observe that if f(4) = -8,0 then, by the condition given in the problem, it
follows that f(1), f(2), f(3), f (3) ≤ f (4) = -8, 0
This implies that there does not exist an element x of X such that f(x) = 20
since 4 is the largest element in X. This contradicts the condition that f is a
surjective function.
Therefore, the only possible value of f(4) is 20 implying that the minimum
possible value of f(4) is 20
12.Given an 8-bit message 11010011. Assuming that even parity is used in the
Hamming code, suppose the bit pattern transmitted for this message as
follows
Bit 1 2 3 4 5 6 7 8 9 10 11 12
positi
on
Check C1 C2 M1 C3 M2 M3 M4 C4 M5 M6 M7 M8
and
msg
bits
? ? 1 ? 1 0 1 ? 0 0 1 1
0 1 1 1 1 0 1 0 0 0 1 1
13. Calculate the total time to transmit a 1500 KB file over a link. Assuming the
one way delay in either direction is 40ms, and an initial RTT of
“handshaking” before any data is sent.(Note: 1 KB = 210 bytes, 1 Mbps = 106
bits/s). The bandwidth is 1 Mbps, the packet size including the header is 1
KB of which the header is 40 bytes, and the data packets are sent
continuously and never lost (Computer Networks - 2 Marks)
a. 12.28 sec
b. 12.78 sec
c. 12.91 sec
d. None of these
Solution:
Given that the maximum size of the packet is 210 bytes, we can only fit
10
1500*2
210 − 40 bytes in the payload. Therefore we need to send 10 packets,
2 −40
which is 1,561 packets. (Note, the last packet is less than 1 KB in size.)
We then have the following: Total Full Packets + Last packet
(1560 ∗ 210) + (40+960) = 1,598,440 bytes to send = 12,787,520 bits
With the bandwidth set at 106 bits/sec, the transmission time of the data is:
12,787,520
106
= 12.78752 sec.
But we’re not done: we have to add the RTT of handshaking and the
one-way delay, so the total time is 12.78752 + 0.08 + 0.04 sec = 12.90752
sec (for which it’s reasonable to round up to 12.91 sec)
Suppose A wins this second backoff race. A transmits A3, and when it is
finished, A and B collide again as A tries to transmit A4 and B tries once
more to transmit B1. Give the probability that A wins this third backoff race
immediately after the first collision. (Computer networks 2 Marks)
a. 58
11
b. 16
13
c. 16
d. None of these
Solution:
(Option c is correct)
Suppose A picks kA(3) to be either 0 or 1 with probability 1/2
each, while B picks kB(3) from (0, 1, 2, 3, 4, 5, 6, 7), each with probability
1/8:
P[A wins] = P[kA(3) < kB(3)] = P[kA(3) = 0] × P[kB(3) > 0] + P[kA(3) = 1] ×
P[kB(3) > 1] = 1/ 2 × 7 /8 + 1 /2 × 6/ 8 = 13 /16
15.Consider the effect of using slow start on a line with a 10-msec round-trip
time and no congestion. The receive window is 28 KB and the maximum
segment size is 2KB. How long does it take before the first full window can
be sent? ______(milli seconds) (Computer Networks 1 Mark)
Solution:
As there is no congestion(given) with slow start, the first RTT sends out 1
segment (or 2KB), the 2nd RTT sends out 2 segments (or 4KB), the 3rd 4
segments (or 8KB), the 4th 8 segments (or 16KB). The 5th RTT would have
sent out 16 segments (or 32KB), however, it'll exceed the receiver's window.
Therefore, the amount of time it takes BEFORE the 5th RTT (or full
window, that is, 24KB) is 4*10=40 msec.
16. In a public key system using RSA, what is the private key of the user if the
following values are given p=17, q=31 and e=7? (Computer Networks 1 -
Mark)___________
a. 481
b. 343
c. 1441
d. None of these
Solution:
Explanation:
⇒ P = 17, q = 31, n = p*q = 527
⇒ e = 7.
⇒ φ(n) = (p −1) × (q −1) = 16 * 30 = 480
⇒ We know that, e × d = 1 mod φ(n)
⇒ We substitute the values of d in the above equation to find d.
⇒ d = 343
Calculate the average MIPS ratings for each machine, M1 and M2. (MIPS:
Million Instruction per second) (Computer Organization 2 Marks)
a. 40, 50
b. 50, 40
c. 40, 40
d. 50, 50
Solution:
For Machine M1:
Clocks per Instruction = (60/100)* 1 + (30/100)*2 + (10/100)*4
= 1.6
For Machine M2:
Clocks per Instruction = (60/100)*2 + (30/100)*3 + (10/100)*4
= 2.5
18. Assume a fully associative write-back cache with many cache entries that
starts empty. Below is a sequence of five memory operations (the address is
in square brackets):
Write Mem[300];
Write Mem[300];
Read Mem[400];
Write Mem[400];
WriteMem[300];
What is the number of hits and misses when using no-write allocate versus
write allocate? (Computer Organization - 2 Marks)
(Note: Write Allocate - the block is loaded on a write miss, followed by the
write-hit action.
No Write Allocate - the block is modified in the main memory and not
loaded into the cache.)
a. No-write allocate: hits-1, misses-4
Write allocate: hits-2, misses-3
b. No-write allocate: hits-4, misses-1
Write allocate: hits-3, misses-2
c. No-write allocate: hits-1, misses-4
Write allocate: hits-3, misses-2
d. No-write allocate: hits-4, misses-1
Write allocate: hits-2, misses-3
Solution:
For no-write allocate, the address 300 is not in the cache, and there is no
allocation on write, so the first two writes will result in misses. Address 400
is also not in the cache, so the read is also a miss. The subsequent write to
address 400 is a hit. The last write to 300 is still a miss. The result for
no-write allocate is four misses and one hit.
For write allocate, the first accesses to 300 and 400 are misses, and the rest
are hits since 300 and 400 are both found in the cache. Thus, the result for
write allocate is two misses and three hits.
= 1
(1−0.3)* 0.3
12
= 1.38
New execution time = Old execution time / Speedup = 20/1.38 = 14.49 ≡
14.5 sec
20. How many 128k*8 Ram chips are needed to construct 2MB RAM?
___________(Computer Organization - 1 Mark)
Solution:
Given capacity is 128*8 RAM chips
Target capacity is 2 MB RAM
Number of chips required = 2MB/128*8 = 24 = 16
21. Consider the following statements where O and θ denote Big-Oh and
Big-Theta notations respectively. (c is a constant > 1)
I. c + 1n = O(1)
n
1
II. 1- ∑ 2
i = Θ(log(n))
i=1
Which of the above statements is/are NOT correct? (Algorithms 1 Mark)
a. I only
b. II only
c. Both I and II
d. None of these
Solution:
I. True: lim [c + 1n ] = c
n→∞
Therefore [c + 1/n] = O(1)
Statement 1 is true
n 1− 1
1 2n+1 1
II. False: ∑ 2
i = 1− 12
=2 − 2n
i=0
n
1 1
⇒ ∑ 2
i = 1- 2n
i=1
n
1 1
⇒1− ∑ 2
i = 2n =/ Θ(log n)
i=1
Therefore statement 2 is false
22. Suppose an alphabet consists of the symbols {A,B,C,D,E} with the
probabilities for their access being 0.33, 0.22, 0.2, 0.15 and 0.1 respectively.
If we use Huffman coding for encoding the symbols, then what is the
average encoding length of the symbols? (Algorithms 1 Mark)
a. 2.34
b. 2.25
c. 2.17
d. None of these
Solution:
A B C D E
0.33 0.22 0.2 0.15 0.1
Arrange increasing order their probabilities
Average encoding length = 2(0.33) + 2(0.22) + 2(0.2) + 3(0.1) + 3(0.15) =
= 2.25
23.Consider the following multistage graph has 9 vertices and k=5 stages.
Answer is 10
Cost(S, D) = min { 4 + cost(v2, D), 1 + cost(v3, D)}
Cost (v2, D) = min{3+cost(v4, D), 3+ cost(V6, D)}
Cost(v4, D) = min{1+cost(v7, D), 4 + cost(v8, D)}
Cost(v7, D) = 6
Cost(v8, D) = 2
Cost(v4, D) = min{1+6, 4+2} = 6
Cost(v6, D) = min{6+cost(v7, D), 2+cost(v8, D)} = 4
Cost(v2, D) = min{3+6, 3+4} = 7
Cost(v3, D) = min{6+cost(v4, D) 5+cost(v5, D), 8+cost(v6, D)}
Cost(v5, D) = min{6+cost(v7, D), 2+cost(v8, D)} = 4
Cost(v3, D) = min{6+6, 5+4, 8+4} = 9
Cost(S, D) = min{4+7, 1+9} = 10
25.Consider the following digraph.(Assume that the adjacency lists are in sorted
order: e.g., when iterating through the edges emanating from vertex 5,
consider the edge 5 → 3 before the others.)
Which of the following is the correct reverse postorder listing of the above
digraph?
(Algorithms - 2 Mark)
a. 5 7 8 6 1 0 4 2 3
b. 8 5 7 6 1 0 4 2 3
c. 0 4 2 3 8 5 7 6 1
d. None of these
Solution:
Reverse Postorder :
Optio 8 5 7 6 1 0 4 2 3
nB
Finish 18 16 15 13 10 8 7 6 5
ing
time
26. Which of the following statements is/are True. The activation record or
stack frame consists of the following data. (Data structures - 2 Marks)
I. Parameters and local variables
II. Pointer to previous activation record
III. Return address i.e the instruction in the caller function which is
immediately after the function call
IV. Return value if function is not void
a. I, II, III
b. I, II, IV
c. I, III, IV
d. I, II, III and IV
Array index 0 1 2 3 4 5 6 7 8 9
value 4 6 10 7 9 21 11 13 19 10
Now, delete one by one element from min heap (delete root element from
min heap) and inserted into binary search tree. Print the preorder traversal of
the binary search tree. (Note: suppose If two of the elements have same
value then insert new element on left side in the tree)
(Data structures- 2 Marks)
a. 4, 6, 10, 7, 9, 21, 11, 13, 19, 10
b. 4, 6, 7, 9, 10, 10, 11, 13, 19, 21
c. 4, 10, 19, 13, 11, 21, 9, 7, 10, 6
d. 4, 10, 9, 7, 6, 10, 19, 13, 11, 21
Solution:
Deletion of elements from min heap in the following order.
4, 6, 7,9, 10, 10, 11, 13, 19, 21
The binary search tree will be
28. What is the length of the longest chain if the following keys are inserted in a
table of size 11 using modulo division and separate chaining__________
1457, 2134, 8255, 4720, 6779, 2709, 1061, 3213
(Data structure 1 Mark)
Solution:
Answer is 3
(i) 1457 %11 = 5
(ii) 2134%11 = 0
(iii) 8255%11 = 5
(iv) 4720%11 = 1
(v) 6779%11 = 3
(vi) 2709%11 = 3
(vii) 1061%11 = 5
(viii) 3213%11 = 1
At location 5, maximum length of the longest chain is 3
29. Consider the following c function
void foo(struct node *head, int n)
{
int count;
struct node *p, *q;
p =head;
q = head;
if(head)
{
for(count=0; count<n; count++)
{
if(!q) return;
q = q->next;
}
while(q)
{
p = p->next;
q = q->next;
}
printf(“%d”, p->data);
}
}
What is the equivalent behaviour of foo()? (Assume head is pointer points to
start node of the linked list)
(Data structures 1 Mark)
a. print nth node element from the beginning of given linked list
b. print nth node from the end in a given linked list
c. print middle element in the given linked list
d. None of these
Solution:
It doesn’t print if it is greater than the no. of nodes in list
Otherwise it will print nth node from the end in a given linked list
Given two pointers – reference pointer (q) and main pointer (p). Initialize
both reference(q) and main pointers(p) to head. First move reference
pointer(q) to n nodes from head. Now move both pointers one by one until
reference pointer(q) reaches end. Now main pointer(p) will point to nth node
from the end..
30. Assume we want to sort an array of integers. In which scenario is the use of
counting sort the most sensible? (Algorithms 1 Mark)
a. An array of integers that is sorted except for a certain number of
randomly located anomalies.
b. An array of integers that is completely random.
c. Integers that are sorted except for certain randomly pairs of adjacent
elements that have been swapped.
d. An array of randomly arranged integers that are each within a
specific range.
Solution:
Let us say that we are sorting n elements where each integer is between 0
and p
Employing counting sort would involve: initializing an array
(with a size of p ), iterating through the n integers while incrementing the
numbers in the array. The recovery of the sorted list would require iterating
through p buckets and outputting n numbers.This is a total of O(2n + 2p) =
O(n) time.
int main()
{
int a[5] = {1, 2, 3, 4, 5};
int *p = a;
printf("%d\t", *p);
fun1(p);
printf("%d\t", *p);
fun2(&p);
printf("%d\t", *p);
return 0;
}
a. 1 2 3
b. 1 1 2
c. 1 2 2
d. 1 1 3
32. What is the output of the following C -Program (C-program 2 Mark)
int main()
{
int a=4, b=8, c=3, d=9, z;
z = a++ + ++b * c-- - --d;
printf(“%d%d%d%d%d”, a, b, c, d, z);
return 0;
}
a. 4, 8, 3, 9, 19
b. 5, 9, 2, 8, 23
c. 5, 9, 3, 9, 19
d. 4, 9, 2, 9, 23
33. How many essential and non-essential prime implicants are there in the
given K-map respectively?(Digital 1 Mark)
a. 3, 0
b. 4, 0
c. 1, 2
d. None
Solution:
Which of the below state transition is not possible with the above circuit?
(Digital 2 Marks)
a. 1 → 3
b. 0 → 3
c. 1 → 2
d. 2 → 2
Solution:
Q1n = Q0 ⊕ Q1
Q0n, = Q0 ⊙ Q1
Q1 Q0
0 0
0 1
1 0
1 1
Q1n Q0n
0 1
1 0
1 0
0 1
S E M
1 6 9
Solution:
Example:
Employee table:
Query 1 Result:
dept
A1
A2
Query 2 Result:
dept
A1
A2
A3
Query 3 Result:
dept
A1
A2
Option B is correct
a. 3
b. 4
c. 5
d. None of these
Solution:
Try A+ = BG. Decompose into R1(A,B,G) and R2(A,C,D,E,F,H).
Decompose R2(A,C,D,E,F,H). Try C+ = D. Decompose into R3(C,D) and
R4(A, C, E, F, H).
Decompose R4(A, C, E, F, H). Try EF+ = CH. Decompose into
R5(E,F,C,H) and R6 (A, E, F).
End result: R1(A,B,G) (key=A), R3(C,D) (key=C), R5(E,F,C,H) (key=EF),
and R6 (A, E, F) (key = AEF).
Find the primary keys for the tables A,C , S? (DBMS 2 Marks)
a. A: a
C: a
S: a
b. A: a, c
C: a
S: a, g
c. A: a, c
C: a, c
S: a, c, g
d. None of these
Solution:
Entity A is weak and dependent on B. Hence, the key of A needs to include
the key of B. C is a refinement of A and, hence, needs to include the key of
A.
a. Schedule 1 Only
b. Schedule 2 Only
c. Both Schedule 1 and Schedule 2
d. Neither Schedule 1 nor Schedule 2
Solution:
Schedule 1 is conflict-serializable because the precedence graph has no
cycles. There is an arrow T2→ T1 because of the conflict R2(A) ...W1(A).
There is an arrow T2 → T3 because of the conflict W2(B) ...R3(B). There is
an arrow T1 → T3 because of the conflict R1(C) ...W3(C).
The only possible conflict-equivalent serial schedule is (T2, T1, T3)
42.Suppose the Operating System (OS) manages the physical memory of the
RAM, and has an area reserved for processes. The OS needs to find 64
physical pages in this area. These pages will be used for the
virtual-to-physical mapping in the page table. How would the OS find these
pages? (Operating System 1 Mark)
a. It will try to find 64 continuous unused pages
b. It will try to find 64 pages in monotonically increasing order
c. It will try to find 64 unused pages from anywhere in any order
d. None of these
Solution:
The physical pages may not be in use for other purposes but the location of
the physical pages doesn’t matter. Therefore, the OS will find unused pages
from anywhere.
44. Consider the following set of processes and their burst times
Process Burst Time
P1 6
P2 8
P3 7
P4 3
a. Fragment 1
b. Fragment 2
c. Both are same
d. None
Solution:
Number of elements can accommodate in each page =1024 byte/4byte = 256
Fragment 1: Number of page faults = 1
Fragment 2: Number of page faults = 1
46. A unix file system has 2 KB blocks and 4 byte disk addresses. Each inode
contains 10-direct entries, one singly indirect entry and one doubly indirect
entry. Suppose half of all files are exactly 1.5 KB and the other half of all
files are exactly 2 KB. What fraction of disk space would be wasted?
(Consider only blocks used to store data)(Operating systems 2 Marks)
a. 25%
b. 12.5%
c. 6.25%
d. None
Solution:
Both 1.5 KB and 2 KB file will use 2KB space. For each 2 KB file, 0KB
is wasted, for each 1.5 KB file, 0.5KB is wasted. Therefore, the fraction
wasted is (0/2)*50% + (0.5/2)*50% = 12.5%
DFA accepts the all the strings of 0’s and 1’s , does not contain 11 as
substring and does not ends with 1
B. E→ {E}E’ | cE’ | ε
E’ → subRE’ | supEE’ | ε
R→ EsupE | E
C. E→ {E}E’ | cE’
E’ →subRE’ | supEE’ | ε
R→ EsupE | E
D. E→ {E}E’ | cE’
E’ → subRE’ | supEE’ | ε
R→ EsupE | ε
Explanation:
Left Recursion: If the production is of the form A→ Aα | β, then the
grammar contains left recursion.
Eliminate left recursion by using the formula
A→ βA’
A’ → αA’ | ε
Given grammar is
E→ EsubR | EsupE | {E} | c
R→ EsupE | E
Eliminating left recursion
E→ {E}E’ | cE’
E’ → subRE’ | supEE’ | ε
R→ EsupE | E
Explanation:
void, main, (, ),{ ,char, s, [, ], =, “”, ;, printf, (, “”, ‘,’ , s, ), ;, }
Total number of tokens is 20
The language accepted by the given DFA is every string contains even
number of a’s and even number of b’s.