GATE Solved Paper 2017-19 - GATE 2017 Shift 2

31. Consider a quadratic equation x2 - 13x + 36 = 0 with coefficients in a base b. The solutions of this equation in the same base b are x = 5 and x = 6. Then b = _____.

  • Option : A
  • Explanation :
    Clearly 13 = 1 x 10 + 3 and 36 = 3 x 10 + 6 ⇒ base b = 10
    The quadratic equation with solutions x = 5 and x = 6 is x2 - 11x + 30 = 0
    According to the given condition, we have b + 3 = 11 and 3b + 6 = 30 ⇒ b = 8
    Answer is 8
    Alternative solution:
    x2 - 13x + 36 = 0 (given quadratic equation)
    In bae b, 13 = 1xb1 + 3xb0 = b+3 and
    36 = 3x1 + 6x0 = 3b + 6
    So the equation becomes x2 - (b + 3)x + (3b + 6) = 0
    Since x = 5 is a solution
    ∴ 52 - (b + 3)5 + (3b + 6) = 0 ⇒ b = 8
    Similarly, by putting x = 6, we get b = 8
Cancel reply
Cancel reply

32. Identify the language generated by the following grammar, where S is the start variable.
S → XY
X → aX∣a
Y → aYb∣ϵ

  • Option : C
  • Explanation :
    The given grammar with S as start symbol is
    S → XY
    X → aX∣a
    Y → aYb∣ϵ
    X generates atleast one 'a'. While Y generates equal no of a's and b's( including epsilon).
    L = { a , ab, aab, aabb, aaabb ....}
Cancel reply
Cancel reply

33. The representation of the value of a 16-bit unsigned integer X in hexadecimal number system is BCA9. The representation of the value of X in octal number system is

  • Option : D
  • Explanation :
    (BCA9)16 = (001 011 110 010 101 001)2 = (136251)8
    Convert hexadecimal to the octal number system.
Cancel reply
Cancel reply

34. Consider the following function implemented in C:
void printxy (int x, int y) {
int *ptr;
x = 0;
ptr = &x;
y = * ptr;
* ptr = 1;
printf (“%d, %d,” x, y);
}
The output of invoking printxy (1, 1) is

  • Option : C
  • Explanation :
    void printxy (int x, int y) {
    int *ptr;
    x = 0; // x=0,y=1
    ptr = &x; // x=0,y=1, and ptr points to x
    y = * ptr; //x=0, y=0
    * ptr = 1; //x=1, y=0
    printf (“%d, %d,” x, y); // It prints 1 AND 0.
    }
Cancel reply
Cancel reply

35. The maximum number of IPv4 router addresses that can be listed in the record route (RR) option field of an IPv4 header is _________.

  • Option : B
  • Explanation :
    Record Route is an optional field used to record address.
    In IPv4 header, 40 bytes are reserved for OPTIONS. For Record Route to stores, 1 byte is used to store type of option, 1 byte for length and 1 byte for pointer. Out of 40, 37 bytes are left.
    An IP4 address takes 32 bits or 4 bytes.
    We can store at most floor(37/4) = 9 router addresses.
    Alternate Solution
    In IPV4 frame format there are 40 bytes of option field, out of which only 38 bytes can be used, 2 bytes are reserved. Also one IPV4 address is of 4 bytes
    Thus maximum IPV4 address that can be hold <= 38/4 = 9
Cancel reply
Cancel reply