GATE Solved Paper 2017-19 - GATE 2017 Shift 1

56. The number of integers between 1 and 500 (both inclusive) that are divisible by 3 or 5 or 7 is ______.

  • Option : A
  • Explanation :
    {integers between 1 to 500 divisible by 3}
    {integers between 1 to 500 divisible by 5}
    {integers between 1 to 500 divisible by 7}
    To find number of integers between 1 to 500 that are divisible by 3 or 5 or 7 is to find

    (166+100+71) - (33+23+14)+4
    337-70+4 = 271
Cancel reply
Cancel reply

58. In a RSA cryptosystem a participant A uses two prime numbers p = 13 and q = 17 to generate her public and private keys. If the public key of A is 35. Then the private key of A is ______.

  • Option : C
  • Explanation :
     Given DataAs per RSA Algorithm
     P = 13Step1: Calculate n = pxq = 13x 17 = 221
     Q = 17Step2: Calculate ϕ(n) = (p-1)(q-1) = (12)(16) = 192
     E = 35Step3: de mod ϕ(n) = 1 (or) de = 1modϕ(n)
     ⇒ d x 35 mod 192 = 1  ⇒ d = 11
    D = ?
    So, D is 11
Cancel reply
Cancel reply

59. Let A be an array of 31 numbers consisting of sequence of 0’s followed by a sequence of 1’s. The problem is to find the smallest index i that A[i] is 1 by probing the minimum numbers of locations in A. The worst case number of probes performed by an optimal algorithm is _____.

  • Option : D
  • Explanation :
    The best way to solve such a problem is by using Binary Search. Search the sorted array by repeatedly dividing the search interval in half. Begin with an interval covering the whole array. If the value of the search key is less than the item in the middle of the interval, narrow the interval to the lower half. Otherwise narrow it to the upper half.
    Find mid element
    Is mid = 1 ?
    Is mid >1?(not possible here)
    Is mid < 1 ?
    Proceed accordingly, Worst case of this problem will be 1 at the end of the array i.e 00000…..1 OR 1…….0000. It will take log n time worst case.
    n=31, Hence log231 = 5.
    Therefore, option D is correct.
Cancel reply
Cancel reply