Home / GATE 2017-2018 / GATE CSE :: Practice Test Paper 2

GATE 2017-2018 :: GATE CSE

  1. Consider an instruction pipeline with five stages without any branch prediction: Fetch Instruction (FI), Decode Instruction (DI), Fetch Operand (FO), Execute Instruction (EI) and Write Operand (WO). The stage delays for FI, DI, FO, EI and WO are 5 ns, 7 ns, 10 ns, 8 ns and 6 ns, respectively. There are intermediate storage buffers after each stage and the delay of each buffer is 1 ns. A program consisting of 12 instructions I1, I2, I3, ...., I12 is executed in this pipelined processor. Instruction I4 is the only branch instruction and its branch target is I9. If the branch is taken during the execution of this program, the time (in ns) needed to complete the program is
  2. A.
    132
    B.
    165
    C.
    176
    D.
    328

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. A RAM chip has a capacity of 1024 words of 8 bits each (1K × 8). The number of 2 × 4 decoders with enable line needed to construct a 16K × 16 RAM from 1K × 8 RAM is
  4. A.
    4
    B.
    5
    C.
    6
    D.
    7

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. The following code segment is executed on a processor which allows only register operands in its instructions. Each instruction can have atmost two source operands and one destination operand. Assume that all variables are dead after this code segment.
    c = a + b;
    d = c * a;
    e = c + a;
    x = c * c;
    if (x > a) {
         y = a * a;
    }
    else {
          d = d * d;
          e = e * e;
    }
    What is the minimum number of registers needed in the instruction set architecture of the processor to compile this code segment without any spill to memory? Do not apply any optimization other than optimizing register allocation.
  6. A.
    3
    B.
    4
    C.
    5
    D.
    6

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. The procedure given below is required to find and replace certain characters inside an input character string supplied in array A. The characters to be replaced are supplied in array oldc, while their respective replacement characters are supplied in array newc. Array A has a fixed length of five characters, while arrays oldc and newc contain three characters each. However, the procedure is flawed. 
    void find_and_replace (char *A, char *oldc, char *newc) { 
                for (int i=0; i<5; i++) 
                    for (int j=0; j<3; j++) 
                         if (A[i] == oldc[j]) A[i] = newc[j]; 
    The procedure is tested with the following four test cases.
    (1) oldc = "abc, newc = "dab       (2) oldc = "cde, newc = "bcd
    (3) oldc = "bca, newc = "cda       (4) oldc = "abc, newc = "bac
    The tester now tests the program on all input strings of length five consisting of characters 'a', 'b', 'c', 'd' and 'e' with duplicates allowed. If the tester carries out this testing with the four test cases given above, how many test cases will be able to capture the flaw?
  8. A.
    Only one
    B.
    Only two
    C.
    Only three
    D.
    All four

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. The procedure given below is required to find and replace certain characters inside an input character string supplied in array A. The characters to be replaced are supplied in array oldc, while their respective replacement characters are supplied in array newc. Array A has a fixed length of five characters, while arrays oldc and newc contain three characters each. However, the procedure is flawed. 
    void find_and_replace (char *A, char *oldc, char *newc) { 
                for (int i=0; i<5; i++) 
                    for (int j=0; j<3; j++) 
                         if (A[i] == oldc[j]) A[i] = newc[j]; 
    The procedure is tested with the following four test cases.
    (1) oldc = "abc, newc = "dab       (2) oldc = "cde, newc = "bcd
    (3) oldc = "bca, newc = "cda       (4) oldc = "abc, newc = "bac
    If array A is made to hold the string "abcde, which of the above four test cases will be successful in exposing the flaw in this procedure?
  10. A.
    None
    B.
    2 only
    C.
    3 and 4 only
    D.
    4 only

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. A computer uses 46-bit virtual address, 32-bit physical address, and a three-level paged page table organization. The page table base register stores the base address of the first-level table (T1), which occupies exactly one page. Each entry of T1 stores the base address of a page of the second-level table (T2). Each entry of T2 stores the base address of a page of the third-level table (T3). Each entry of T3 stores a page table entry (PTE). The PTE is 32 bits in size. The processor used in the computer has a 1 MB 16-way set associative virtually indexed physically tagged cache. The cache block size is 64 bytes.
    What is the size of a page in KB in this computer?
  12. A.
    2
    B.
    4
    C.
    8
    D.
    16

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. A computer uses 46-bit virtual address, 32-bit physical address, and a three-level paged page table organization. The page table base register stores the base address of the first-level table (T1), which occupies exactly one page. Each entry of T1 stores the base address of a page of the second-level table (T2). Each entry of T2 stores the base address of a page of the third-level table (T3). Each entry of T3 stores a page table entry (PTE). The PTE is 32 bits in size. The processor used in the computer has a 1 MB 16-way set associative virtually indexed physically tagged cache. The cache block size is 64 bytes.
    What is the minimum number of page colours needed to guarantee that no two synonyms map to different sets in the processor cache of this computer?
  14. A.
    2
    B.
    4
    C.
    8
    D.
    16

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. Relation R has eight attributes ABCDEFGH. Fields of R contain only atomic values. 
    F={CH→G, A→BC, B→CFH, E→A, F→EG} is a set of functional dependencies (FDs) so that F+ is exactly the set of FDs that hold for R.
    How many candidate keys does the relation R have?
  16. A.
    3
    B.
    4
    C.
    5
    D.
    6

    View Answer

    Workspace

    Discuss Discuss in Forum


  17. Relation R has eight attributes ABCDEFGH. Fields of R contain only atomic values. 
    F={CH→G, A→BC, B→CFH, E→A, F→EG} is a set of functional dependencies (FDs) so that F+ is exactly the set of FDs that hold for R.
    The relation R is
  18. A.
    in 1NF, but not in 2NF.
    B.
    in 2NF, but not in 3NF.
    C.
    in 3NF, but not in BCNF.
    D.
    in BCNF.

    View Answer

    Workspace

    Discuss Discuss in Forum


  19. Which one of the following options is the closest in meaning to the word given below? 
    Nadir
  20. A.
    Highest
    B.
    Lowest
    C.
    Medium
    D.
    Integration

    View Answer

    Workspace

    Discuss Discuss in Forum