Accenture Pseudo Code

Questions 1: What will be the output of the following pseudocode?

Integer value, n, num
Set value = 1, n = 45
num = num >> 1
num = num + value
Print num

  • Options
  • a : 44
  • b : 0
  • c : 1
  • d : 12
  • Answer: c) 1

    Questions 2: What will be the output of the following pseudocode?

    Integer x, y
    for(each x from 1 to 11)
    x = x + 2
    end for
    Print x

  • Options
  • a : 11
  • b : 10
  • c : 12
  • d : 13
  • Answer: d) 13

    Questions 3: What will be the output of the following pseudocode?

    Integer j, m
    Set m = 1, j = 1
    Integer a[3] = {0, 1, 0}
    a[0] = a[0] + a[1]
    a[1] = a[1] + a[2]
    a[2] = a[2] + a[0]
    if(a[0])
    a[j] = 5
    End if
    m = m + a[j]
    Print m

  • Options
  • a : 3
  • b : 2
  • c : 6
  • d : 4
  • Answer: c) 6

    Questions 4: What will be the output of the following pseudocode for k = 150?

    fun(integer k)
    if(k>155)
    return
    end if
    print k
    fun(k+2)
    print k
    End of function fun()

  • Options
  • a : 150 152 154
  • b : 150 152 154 154 152 150
  • c : 150
  • d : None of the mentioned
  • Answer: b) 150 152 154 154 152 150

    Questions 5: What will be the output of the following pseudocode?

    Integer a, n, b
    Set a = 0, n = 0, b
    for(each n from 0 to 4)
    n = n + 1
    if(n EQUALS 3)
    Print 'Hello World'
    end if
    Jump out of the loop
    End for
    Print n

  • Options
  • a : 2
  • b : 1
  • c : 3
  • d : Hello World
  • Answer: b) 1

    Questions 6: What will be the output of the following pseudocode?

    Integer a[5], b[5], c[5], k, l
    Set a[5] = {5, 9, 7, 3, 1}
    Set b[5] = {2, 4, 6, 8, 10}
    for(each k from 0 to 4)
    c[k] = a[k] - b[k]
    end for
    for(each 1 from 0 to 4)
    Print c[1]
    end for

  • Options
  • a : 7 13 13 11 11
  • b : 3 5 1 -5 -9
  • c : -3 -5 -1 5 9
  • d : None
  • Answer: b) 3 5 1 -5 -9

    Questions 7: How many times “A” will be printed in the following pseudocode?

    Integer a, b, c
    for(a = 0 to 4)
    for(b = 0 to 2)
    if(a is greater than b)
    Print 'A'
    End if
    End for
    End for

  • Options
  • a : 8
  • b : 7
  • c : 9
  • d : 10
  • Answer: c) 9

    Questions 8: What will be the output of the following pseudocode?

    Integer p, q, r
    Set q = 13
    for(each p from 1 to 4)
    r = q mod p
    p = p + 5
    q = p + r
    end for
    r = q / 5
    Print q, r

  • Options
  • a : 6 4
  • b : 1 3
  • c : 7 2
  • d : 6 1
  • Answer: d) 6 1

    Questions 9: What will be the output of the following pseudocode?

    Integer x
    Set x = 259
    if(x EQUALS 0)
    Print '0'
    otherwise if(x MOD 9 EQUALS 0)
    Print '9'
    otherwise
    Print x MOD 9
    end if

  • Options
  • a : 8
  • b : 16
  • c : 7
  • d : None
  • Answer: c) 7

    Questions 10: What will be the output of the following pseudocode?

    Integer a, b
    et a = 12, b = 25
    a = (a + b) MOD 2
    b = b = a
    a = a + b - 13
    Print a, b

  • Options
  • a : -11 1
  • b : -12 00
  • c : 11 22
  • d : 37 24
  • Answer: a) -11 1


    If you find any question wrong, please send your solution to [email protected]