Accenture Pseudo Code

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

Integer a, b, c
Set a = 4, b = 4, c = 4
if (a & (b ^ b) & c)
a = a >> 1
End if
Print a + b + c

  • Options
  • a : 16
  • b : 24
  • c : 8
  • d : 12
  • Answer: d) 12

    Questions 12: What will be the output of the following pseudocode for a = 10, b = 11?

    Integer funn(Integer a, Integer b)
    if(0)
    return a - b - funn(-7, -1)
    End if
    a = a + a + a + a
    return a
    End function funn()

  • Options
  • a : 40
  • b : 30
  • c : 44
  • d : 0
  • Answer: a) 40

    Questions 13: What will be the output of the following pseudocode for a = 5, b = 1?

    Integer funn(Integer a, Integer b)
    if(b + a || a - b) && (b > a) && 1)
    a = a+b+b-2
    return 3-a
    Else
    return a-b+1
    End if
    return a+b
    End function fun()

  • Options
  • a : 0
  • b : 5
  • c : 16
  • d : 11
  • Answer: b) 5

    Questions 14: What will be the output of the following pseudocode for a = 5, b = 1?

    Integer funn(Integer a, Integer b)
    if((b mod a && a mod b) || (a ^ b > a))
    a=a^b
    Else
    return a-b
    End if
    return a+b
    End function funn()

  • Options
  • a : -9
  • b : 5
  • c : 6
  • d : 21
  • Answer: b) 5

    Questions 15: What will be the output of the following pseudocode for a = 4, b = 8?

    Integer funn(Integer a, Integer b)
    if(a > b)
    b = b ^ a
    End if
    if(b > a)
    a = a ^ b
    End if
    return a + b
    End function funn()

  • Options
  • a : 35
  • b : 20
  • c : 14
  • d : 25
  • Answer: b) 20

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

    Integer x
    Set x = 2
    if(x is EQUAL TO 1)
    if(x IS EQUAL TO 0)
    Print "A"
    else
    Print "B"
    end if
    else
    Print "C"
    end if

  • Options
  • a : B C
  • b : C
  • c : A
  • d : B
  • Answer: b) C

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


    More Questions Will Be Uploaded Soon............