GATE 2006 Computer Science and Information Technology (CS) Questions with Solutions

GATE 2006

191 questions

MCQ 1911-mark 191

Questions 141–145 of 191

Q141Parsing1 markMCQ−0.33 if wrong
Consider the following grammar.
S →\rightarrow S * E
S →\rightarrow E
E →\rightarrow F + E
E →\rightarrow F
F F →\rightarrow id
Consider the following LR(0) items corresponding to the grammar above.
(i) S →\rightarrow S * .E
(ii) E →\rightarrow F. + E
(iii) E →\rightarrow F + .E
Given the items above, which two of them will appear in the same set in the canonical sets-of-items for the grammar?

Q142Syntax-directed Translation1 markMCQ−0.33 if wrong
Consider the following translation scheme.
S →\rightarrow ER
R →\rightarrow* E{print('*');}R|ε\varepsilon
E→\rightarrowF+E{print('+');}|F
F→\rightarrow(S)|id{print(id.value);}
Here id is a taken that represents an integer and id.value represents the corresponding integer value. For an input '2*3+4', this translation scheme prints

Q143Intermediate Code Generation1 markMCQ−0.33 if wrong
Consider the following C code segment.

for (i = 0; i < n; i++) 
{ 
    for (j=0; j < n; j++) 
    { 
        if (i%2) 
        { 
            x += (4*j + 5*i); 
            y += (7 + 4*j); 
        } 
    } 
} 
Which one of the following is false?

Q144Process1 markMCQ−0.33 if wrong
The process state transition diagram of an operating system is as given below. Which of the following must be FALSE about the above operating system?

Start Ready Running Terminated Blocked Create a new process Schedule Exit I/O complete or resource released Wait for I/O completion or resource released

Q145Process Synchronization1 markMCQ−0.33 if wrong
The wait and signal operations of a monitor are implemented using semaphores as follows. In the following,
x is a condition variable,
mutex is a semaphore initialized to 1,
x_sem is a semaphore initialized to 0,
x_count is the number of processes waiting on semaphore x_sem, initially 0,
next is a semaphore initialized to 0,
next_count is the number of processes waiting on semaphore next, initially 0.
The body of each procedure that is visible outside the monitor is replaced with the following:
 P(mutex);
...
body of procedure
...
if (next_count > 0)
    V(next);
else
    V(mutex);

Each occurrence of x.wait is replaced with the following:
 x_count = x_count + 1;
if (next_count > 0)
    V(next);
else
    V(mutex);
------------------------------------------------------------ E1;
x_count = x_count - 1;

Each occurrence of x.signal is replaced with the following:
if (x_count > 0)
{
    next_count = next_count + 1;
    ------------------- E2;
    P(next);
    next_count = next_count - 1;
} 

For correct implementation of the monitor, statements E1 and E2 are, respectively,