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

GATE 2008

185 questions

MCQ 1851-mark 52 · 2-mark 133

Questions 71–75 of 185

Q71Pipeline Processor2 marksMCQ−0.67 if wrong
Delayed branching can help in the handling of control hazards

The following code is to run on a pipelined processor with one branch delay slot:
I1: ADD R2 ←\leftarrow R7 + R8
I2 : SUB R4 ←\leftarrowR5 - R6
I3: ADD R1 ←\leftarrow R2 + R3
I4 : STORE Memory [R4] ←\leftarrow R1
BRANCH to Label if R1==0

Which of the instructions I1, I2, I3 or I4 can legitimately occupy the delay slot without any other program modification?

Q72Pipeline Processor2 marksMCQ−0.67 if wrong
Delayed branching can help in the handling of control hazards

For all delayed conditional branch instructions, irrespective of whether the condition evaluates to true or false

Q73Pipeline Processor2 marksMCQ−0.67 if wrong
Which of the following are NOT true in a pipelined processor?

I. Bypassing can handle all RAW hazards
II. Register renaming can eliminate all register carried WAR hazards
III. Control hazard penalties can be eliminated by dynamic branch prediction

Q74Arithmetic Operation1 markMCQ−0.33 if wrong
Which combination of the integer variables x, y and z makes the variable a get the value 4 in the following expression?
a = (x > y) ? ((x > z) ? x : z) : ((y > z) ? y : z) 

Q75Function2 marksMCQ−0.67 if wrong
Consider the code fragment written in C below :
void f (int n)
{ 
    if (n <= 1)  {
        printf ("%d", n);
    }
    else {
        f (n/2);
        printf ("%d", n%2);
    }
}
Which of the following implementations will produce the same output for f(173) as the above code?
P1
void f (int n)
{ 
    if (n/2)  {
        f(n/2);
    }
    printf ("%d", n%2);
}

P2
 void f (int n)
{ 
    if (n <=1)  {
        printf ("%d", n);
    }
    else {
        printf ("%d", n%2);
        f (n/2);
    }
}