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

GATE 2006

191 questions

MCQ 1911-mark 191

Questions 71–75 of 191

Q71Number System1 markMCQ−0.33 if wrong
Consider number represented in 4-bit gray code. Let h3h2h1h0h_3h_2h_1h_0 be the gray code representation of a number n and let g3g2g1g0g_3g_2g_1g_0 be the gray code of (n+1) (modulo 16) value of the number. Which one of the following functions is correct?

Q72Machine Instruction1 markMCQ−0.33 if wrong
The memory locations 1000,1001 and 1020 have data values 18,1 and 16 respectively before the following program is executed.

MOVIRs,1; Move immediateLOADRd,1000(Rs); Load from memoryADDIRd,1000; Add immediateSTOREI0(Rd),20; Store immediate\begin{array}{llll} \text{MOVI} & \text{$R_s, 1$} && \text{; Move immediate} \\ \text{LOAD} & \text{$R_d, 1000(R_s)$} && \text{; Load from memory}\\ \text{ADDI} & \text{$ R_d, 1000$} && \text{; Add immediate}\\ \text{STOREI} & \text{$0(R_d), 20$} && \text{; Store immediate} \end{array}

Which of the statements below is TRUE after the program is executed ?

Q73Machine Instruction1 markMCQ−0.33 if wrong
Consider these two functions and two statements S1 and S2 about them.
int work1(int *a, int i, int j)         int work2(int *a, int i, int j)
{                                       {
   int x = a[i+2];                         int t1 = i+2;
   a[j] = x+1;                             int t2 = a[t1];
   return a[i+2] - 3;                      a[j] = t2+1;
}                                          return t2 - 3;
                                        }

S1 : The transformation from work 1 to work 2 is valid, i.e., for any program state and input arguments, work 2 will compute the same output and have the same effect on program state as work 1
S2 : All the transformations applied to work 1 to get work 2 will always improve the performance (i.e. reduce CPU time) of work 2 compared to work 1

Q74Machine Instruction1 markMCQ−0.33 if wrong
Consider a new instruction named branch-on-bit-set (mnemonic bbs). The instruction "bbs reg, pos, label" jumps to label if bit in position pos of register operand reg is one. A register is 32 bits wide and the bits are numbered 0 to 31, bit in position 0 being the least significant. Consider the following emulation of this instruction on a processor that does not have bbs implemented.

temp←\leftarrowreg & mask
Branch to label if temp is non-zero

The variable temp is a temporary register. For correct emulation the variable mask must be generated by

Q75Machine Instruction1 markMCQ−0.33 if wrong
A CPU has 24-bit instructions. A program starts at address 300 (in decimal). Which one of the following is a legal program counter (all values in decimal)?