Accenture Pseudo Code Question and Answer 2023

Accenture PseudoCode Questions 2023 for Freshers

Accenture PseudoCode Test Questions with Answers 2023 are discussed below. Pseudo Code is mainly based on Input Output Form contain some programming languages c,c++ etc.In pseudo Code round there will be total 18 questions and the time limit will be 40 mins (Shared)  .The difficulty level of the paper is high.Pseudo Code is mainly based on Input Output Form contain some programming languages C/CPP etc.

For more detailed information you can visit to the Accenture Dashboard.

Accenture Pseudocode Question and Answer 2020

Accenture PseudoCode Question and Answer

CompanyAccenture
Total Time Duration40 minutes (Shared)
Number of Question18 Ques
Negative MarkingNo

Accenture PseudoCode Questions 2023 for Freshers

Accenture PseudoCode Test Questions with Answers 2023 are discussed below. Pseudo Code is mainly based on Input Output Form contain some programming languages c,c++ etc.In Pseudo Code round there will be total 18 questions and the time limit will be 40 mins (Shared) for pseudo code.The difficulty level of the paper is high.Pseudo Code is mainly based on Input Output Form contain some programming languages c,c++ etc.

For more detailed information you can visit to the Accenture Dashboard.

Accenture Pseudocode Question and Answer 2020

Accenture PseudoCode Question and Answer

CompanyAccenture
Total Time Duration40 minutes (Shared)
Number of Question18 Ques
Negative MarkingNo

Accenture Pseudo Code Curriculum

Detailed Accenture Pseudo Code Paper Pattern

TopicsNo. of questions in testSuggested Avg. TimeDifficulty
C2MedMedium
C++3MedMedium
OOPS3HighMedium
Data Structure2HighMedium

Practice from Accenture Sample Pseudo Code Questions

1. What will be the output of the following pseudo code?

For input a = 5 & b = 5.
  function (input a, input b)
  If (a < b)
  return function (b, a)
  elseif (b != 0)
  return (a * function (a, b - 1))
  else
  return 0

15625

15625

18.12%

625

625

28.95%

3125

3125

40.04%

525

525

12.88%

function(5,5) will return 5 x function(5,4)

function(5,4) will return 5 x 5 x function(5,3)

function(5,3) will return 5 x 5 x 5 x function(5,2)

function(5,2) will return 5 x 5 x 5 x 5 function(5,1)

function(5,0) will return 5 x 5 x 5 x 5 x 5 = 3125

2. What will be the output of the following pseudo code

initialize char c
set c= a
print "%d",a

64

64

16.92%

97

97

35.59%

a

a

15.45%

error

error

32.04%

The code will print the ASCII value of the entered character

3. What will be the output of the following code ?

#include<stdio.h>
int main ()
{
  char c,a,b;
  c='f';
  a='s';
  b='x';
  int sum= c+a+b;
  printf ("%d", sum);
}

324

324

14.4%

315

315

15.66%

320

320

12.34%

337

337

57.6%

The following code will add the ASCII values of the given characters
f = 102
s = 115
x = 120
sum = 102+115+120 = 337

4. What will be the output of the following pseudo code for arr[]= 1,2,3,4,5

initialize i,n
intialize an array of size n
  accept the values for the array
for i= 0 to n
  arr[i] = arr[i]+arr[i+1]
end for
print the array elements

3 5 7 9 5

3 5 7 9 5

36.95%

3 5 7 9 11

3 5 7 9 11

26.57%

3 5 9 15 20

3 5 9 15 20

8.67%

error

error

27.81%

The following pseudo code will add the first element with the second, the second element with the third, the third element with the fourth and the fourth element with the fifth, the fifth element will remain as it is
and hence the output will be 3 5 7 9 5

5. What will be the output of the following pseudo code ?

#include<stdio.h>
int fun(int x, int y);
int main()
{
  int i,n;
  i=5;
  n=7;
  int f = fun(5,7);
  printf("%d", f);
}

int fun(int x, int y)
{
  if(x<=0)
  return y;
  else
  return(fun(x-1,y-1));
}

 

0(zero)

0(zero)

20.32%

1

1

14.7%

2

2

56.78%

3

3

8.2%

This is a recursive code the function fun(int x, int y) will keep on calling itself until the value of x becomes zero, and when the base condition executes it will print the value of y
Since the value of x is 5 and it is getting decremented by 1 on every function call and the value of y is also getting decremented by 1 on every function call. On the execution of base condition the value of x will become 0(as it has been decremented by 1, 5 times) and the value of y will become 2(as it is also has been decremented by 1, 5 times) and hence the output will be 2

6. What will be the output of the following code

#include <stdio.h>
#include <stdlib.h>
#define LIMIT 10 /*size of integers array*/
int main(){
    unsigned long long int i,j;
    int *primes;
    int z = 1;
    primes = malloc(sizeof(int)*LIMIT);
    for (i=2;i<LIMIT;i++)
      primes[i]=1;
    for (i=2;i<LIMIT;i++)
      if (primes[i])
        for (j=i;i*j<LIMIT;j++)
          primes[i*j]=0;
    for (i=2;i<LIMIT;i++)
      if (primes[i])
        printf("%dth prime = %dn\n",z++,i);
  return 0;

}

None of the below

None of the below

9.18%

1th prime - 2n
2th prime - 3n
3th prime - 5n

1th prime - 2n
2th prime - 3n
3th prime - 5n

21.69%

1th prime - 2n
2th prime - 3n
3th prime - 5n
4th prime - 7n
5th prime - 9n
6th prime - 11n

1th prime - 2n
2th prime - 3n
3th prime - 5n
4th prime - 7n
5th prime - 9n
6th prime - 11n

35.41%

1th prime - 2n
2th prime - 3n
3th prime - 5n
4th prime - 7n

1th prime - 2n
2th prime - 3n
3th prime - 5n
4th prime - 7n

33.72%

The following code calculated the Prime Number upto the given range using the concept of Sieve method
The sieve of Eratosthenes is an ancient algorithm for finding all prime numbers up to any given limit. It does so by iteratively marking as composite the multiples of each prime, starting with the first prime number, 2.

7. What will be the output of the following code snippet?

#include <stdio.h>
#include <stdlib.h>int main(){
int m = 2, c=1;
int n,a,b, limit=10;
while(c < limit)
{
for (int n = 1; n < m; ++n)
{
a = m * m - n * n;
b = 2 * m * n;
c = m * m + n * n;
if (c > limit)
break;
printf("%d %d %d\n", a, b, c);
}
m++;
}
}

1 5 7

1 5 7

10.26%

2 5 7
7 9 10

2 5 7
7 9 10

17.15%

1 2 3
4 5 6
7 8 9

1 2 3
4 5 6
7 8 9

29.79%

3 4 5
8 6 10

3 4 5
8 6 10

42.8%

The following code snippet generated Pythagorean triplets upto the given LIMIT

8. What will be the output of the following Code ?

#include<stdio.h>
int main( )
{
  int n=5, k, f1, f2, f;
  if ( n < 2 ) 
   return n;
  else 
  {
    f1 = f2 = 1;
    for(k=2;k<n;k++)
      {
        f = f1 + f2;
        f2 = f1;
        f1 = f;
      }
    printf("%d",f) ;
  }
}

8

8

16.53%

5

5

59.5%

13

13

15.61%

7

7

8.36%

The following code is generating Fibonacci series and returning the nth term

9. What purporse does the following code serves

int main() 
{ 
  int array[] = {5, 3, 1, 9, 8, 2, 4, 7}; 
  int size = sizeof(array)/sizeof(array[0]);
  int i, j, min_idx,temp;  
      for (i = 0; i < size-1; i++)  
    {  
        min_idx = i;  
        for (j = i+1; j < size; j++)
        {
        if (array[j] < array[min_idx])  
            min_idx = j;  
        }
              temp = array[min_idx];
              array[min_idx] = array[i]; 
              array[i] = temp; }
}

 

Finds some specific element in the array

Finds some specific element in the array

11.13%

Sort the elements of array

Sort the elements of array

58.22%

Find the smallest element in the array

Find the smallest element in the array

26.37%

None of the above

None of the above

4.28%

Following code snippet is the code of selection sort, which compares each element of the array with all the other elements and arrange them in a specific order

10. What operation does the following pseudo code performs

Declare an array of string type variable called word
Declare a loopcounter
Store a string in the array word
for loopcounter = (length of the word) – 1 to 0
  loopcounter = loopcounter – 1
  print arrayword[loopcounter]
endfor
Algorithm end

It accepts a string

It accepts a string

9.14%

It reverses  the string

It reverses  the string

69.44%

It prints the string in the same order

It prints the string in the same order

16.63%

none of the above

none of the above

4.79%

The following pseudo code prints the entered string in the reverse order. We have used a reverse for loop, for reverse printing the string

11. What will be the output of the following pseudocode?

#include<stdio.h>
int func(int a)
{
    return a--;
}
int main()
{
    int a= func(5);
    printf("%d",a++);
    return 0;
}

4

4

27.45%

5

5

53.56%

7

7

4.79%

6

6

14.2%

When func() is called the function return value as 5 and it will be assigned to local variable a of main() function after that it will decrement the local variable a of func to 4. Now inside main function the value of a is printed as 5 and then it will increment to 6.
Hence option (B) is the correct answer

12. What will be the output of the following pseudocode?

#include<stdio.h>

int main()
{
    float m=3.0;
    switch((int)m)
    {
        case 1:
                printf("Prepinsta");
                break;
        case 2:
                printf("Prime");
                break;
        case 3:
                printf("Prepinsta Prime");
                break;
    }
    return 0;
}

PrepInsta

PrepInsta

13.34%

Prime

Prime

9.44%

Prepinsta

Prepinsta

30.99%

error

error

46.23%

As we know switch argument allows only int value so after typecasting the variable m is converted to int type. Now the value passed will be 3 so case 3 will get executed and it will print Prepinsta prime as an output.

13. What will be the output of the following pseudo code?

#include

#include<stdio.h>
int main()
{
  int val=5;
  do{
     val++;
     ++val;
  }while(val++>7);
 printf("%d",val);
 return 0;
}

11

11

7.47%

10

10

9.53%

8

8

42.5%

7

7

40.5%

The value of variable val will increment 2 times so it becomes 7 after executing the body of do while loop. The variable val at while condition returns value as 7 and as we know 7>7 is false. So it will move outside the loop and after post increment the value of variable val becomes 8 which will be printed as an output.

14. What will be the output of the following pseudocode?

#include<stdio.h>
int main()
{
    int m=0;
    if(m==0)
    {
        m=((5,(m=3)),m=1);
        printf("%d",m);
    }
    else 
    printf("Test");
    return 0;
}

Test

Test

26.76%

1

1

43.68%

3

3

9.29%

5

5

20.28%

Comma operator has a least priority and whenever comma operator present inside brackets then it will return the value present at the end. So the value of m will be 1.

15. What will be the output of the following pseudo code?

#include<stdio.h>

void fun1(char *s1, char *s2)  { 
     char *tmp;  
     tmp = s1; 
     s1 = s2; 
     s2 = tmp; 
} 

void fun2(char **s1, char **s2)  { 
     char *tmp; 
     tmp = *s1; 
     *s1 = *s2; 
     *s2 = tmp; 
}

int main ()  { 
     char *str1 = "Prepinsta", *str2 = "Prime"; 
     fun1(str1, str2);     printf("%s %s ", str1, str2); 
     fun2(&str1, &str2);   printf("%s %s ", str1, str2); 
     return 0; 
} 

Prepinsta Prime Prime Prepinsta

Prepinsta Prime Prime Prepinsta

26.22%

Prime Prepinsta Prime Prepinsta

Prime Prepinsta Prime Prepinsta

30.69%

Prime Prepinsta Prepinsta Prime

Prime Prepinsta Prepinsta Prime

25.65%

Prepinsta Prime Prepinsta Prime

Prepinsta Prime Prepinsta Prime

17.44%

The first call to the function ‘func1(str1, str2);’ is call by value.
Hence, any change in the formal parameters are NOT reflected in actual parameters.
Hence, str1 points at “Prepinsta” and str2 points at “Prime”.
The second call to the function ‘func2(&str1, &str2);’ is call by reference.
Hence, any change in formal parameters are reflected in actual parameters.
Hence, str1 now points at “Prime” and str2 points at “Prepinsta”.

16. What will be the output of the following pseudo code ?

#include<stdio.h>
void main() 
{ 
 int i=0; 
 while(+(+i--)!=0) 
 i=i+5; 
 printf("%d",i); 
} 

5

5

37.93%

4

4

27.12%

-1

-1

31.3%

-2

-2

3.65%

Unary + is the only dummy operator in C. So it has no effect on the expression and now the while loop is, while(i--!=0) which is false and so breaks out of while loop. The value –1 is printed due to the post-decrement operator.

17. What will be the output of the following pseudo code ?

#include<stdio.h>
int main()
{
   char c= 'Z';
   printf(“%d”,c);
}

Z

Z

12.14%

'Z'

'Z'

7.7%

90

90

42.06%

122

122

38.09%

Since the format specifier is integer format specifier - ‘%d’, the ASCII Value of character ‘Z’ will be printed as an output

18. What will be the output of the following pseudo code ?

#include<stdio.h>
int func(int n)
{
    int i=0;
    while(n%10!=0)
    {
        n=n+3;
        i++;
    }
    n=n-i;
    return n;
}
void main()
{
    printf("%d",func(35));
}

50

50

14.82%

55

55

14.82%

53

53

11.51%

45

45

58.86%

Loop will execute for n=35,38,41,44,47,50.
Making i=5
So , 50-5=45.

19. What will be the output of the following pseudo code ?

#include<stdio.h>
int func(int no)
{
    static int count=0;
    count=count+no;
    return count;
}
void main()
{
    int i,j;
    for(i=0;i<=5;i++)
       j=func(i);
    printf("%d",j);
}


18

18

9.38%

15

15

72.74%

20

20

9.85%

25

25

8.03%

At i=0 , count=0
i=1, count=1
i=2, count=3
i=3, count=6
i=4, count=10
i=5, count=15

20. What will be the output of the following pseudo code ?

#include<stdio.h>

void main()
{
    int a=5,b=2,c=1;
    if(b>a && a>c && c>b)
        b=a+1;
    else 
        a=b+1;
    printf("%d",a+b+c);
}

6

6

82.7%

11

11

7.7%

19

19

4.65%

7

7

4.95%

Let’s check out the if condition => if(2>5 and 5>1 and 1>2) is False. So code inside else will be taken into account. a = b+1 => a = 3 Now, a+b+c => 3 + 2+1 => 6

×

Please login to report

 

Additional Information (FAQ's)

Question. How many Questions are there in Accenture Pseudo Code MCQ?

There are 18 Questions that need to solve in 40 min including both sections.

What is the difficulty level of Pseudo Code Questions in the Test Paper?

The Difficulty level of the paper is high.You need to score atleast  70 percentile to clear next round.

What is the most important topic?

The The most important topic is data structure and C.

3 comments on “Accenture Pseudo Code Question and Answer 2023”


  • divyanisha2005

    In question1 :
    For input a = 5 & b = 5.
    function (input a, input b)
    If (a < b)
    return function (b, a)
    elseif (b != 0)
    return (a * function (a, b – 1))
    else
    return 0

    The function call for arguments a=5, b = 0 will return 0. So, final answer should be 0.
    Correct me if I am wrong but I think the right options are not given in the options.
    Thank you.