Skip to content

Beta · Data may be lost.Your data may be reset or lost.

GateBrew
← GATE CSE 2015 Set 3
Questions

Q49

NAT2 marksAlgorithmsMedium

Suppose c=⟨c[0],…,c[k−1]⟩c = \langle c[0], \dots, c[k-1]\rangle is an array of length kk, where all the entries are from the set {0,1}\{0, 1\}. For any positive integers a and na \text{ and } n, consider the following pseudocode.

DOSOMETHING (c, a, n)
    z ← 1
    for i ← 0 to k-1
        do z ← z² mod n
           if c[i]=1
               then z ← (z × a) mod n
    return z

If k=4,c=⟨1,0,1,1⟩,a=2, and n=8k=4, c = \langle 1, 0, 1, 1 \rangle , a = 2, \text{ and } n=8, then the output of DOSOMETHING(c, a, n) is _______.

Sign in to save attempts.

The solution is hidden while you attempt this question. It opens once you check or show the answer.