here $ is higher precedence than # $ is left associative because in the sub expression b $ c $ d, b $ c will be evaluated first as per given tree.
As per the given tree structure right # if higher precedence than left #.
Hence it is right associative.
PREVIOUS YEAR SOLVED PAPERS MCQ - GATE 2018
32
Consider the following solution to the producer-consumer synchronization problem. The shared buffer size is N. Three semaphores empty, full and mutex are defined with respective initial values of 0, N and 1. Semaphore empty denotes the number of available slots in the buffer, for the consumer to read from. Semaphore full denotes the number of available slots in the buffer, for the producer to write to. The placeholder variables, denoted by P, Q, R and S, in the code below can be assigned either empty or full. The valid semaphore operations are: wait ( ) and signal ( ).
| Producer | Consumer |
| do{ wait(p); wait(mutex); //Add item to buffer signal(mutex); signal(Q); }while (1); | do{ wait(R); wait(mutex); //Consume item from buffer signal (mutex); signal (); }while (1); |
Which one of the following assignments to P, Q, R and S will yield the correct solution?
Full = N, empty = 0, mutex = 1
Initially buffer will be empty, so consumer should not start first, so options B, D are eliminated.
With option A consumer will never consume the item, so it is wrong.
Option ‘C’ is the correct answer which proper functionality of produce and consumer.
T3T3 because from first T3 bbaac is taken from second T3 abc
is taken longest
possible prefix.
Hence T3T3 token output.
Binary code: (b7b6b5b4b3 ⋅ b2b1b0)2
(31.5)10 = (11111.1)2
(0.875)10 = (0.111)2
(12.100)10 = (01100.000110.....)2
↓
Only 3 bits of fraction
space available
So can't be stored.
(3.001)10 = (00011.000000..........)2
It is also not accurate storage.
P : Set of rational number → countable
Q : Set of functions from {0, 1} to N → N
0 can be assigned in N ways
1 can be assigned in N ways
There are functions, cross product of countable set in countable.
R : Set of functions from N to {0, 1}
Each of thus boxes can be assigned to 0 or 1 so each such function is a binary number with infinite number of bits.
0 can be assigned in N ways
1 can be assigned in N ways
There are functions, cross product of countable set in countable.
R : Set of functions from N to {0, 1}
Each of thus boxes can be assigned to 0 or 1 so each such function is a binary number with infinite number of bits.
Which one of the following is correct for the given parse tree?
