Prime #### Prepinsta Prime

Video courses for company/skill based Preparation

(Check all courses)
Get Prime Video
Prime #### Prepinsta Prime

Purchase mock tests for company/skill building

(Check all mocks)
Get Prime mock

# Accenture Pseudo Code Question and Answer 2021-22

## Accenture PseudoCode Questions 2022 for Freshers

Accenture PseudoCode Test Questions with Answers 2022 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 18 mins .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

 Company Accenture Total Time Duration 18 minutes Number of Question 18 Ques Negative Marking No

## Accenture PseudoCode Questions 2022 for Freshers

Accenture PseudoCode Test Questions with Answers 2022 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 18 mins specifically 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

 Company Accenture Total Time Duration 18 minutes Number of Question 18 Ques Negative Marking No

## 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.58%

625

625

29.31%

3125

3125

39.95%

525

525

12.15%

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.41%

97

97

37.53%

a

a

14.2%

error

error

31.86%

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.95%

315

315

15.78%

320

320

12.26%

337

337

57.01%

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

37.8%

3 5 7 9 11

3 5 7 9 11

26.29%

3 5 9 15 20

3 5 9 15 20

8.9%

error

error

27.01%

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.65%

1

1

14.52%

2

2

56.3%

3

3

8.53%

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.65%

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

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

21.4%

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

34.14%

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

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

34.81%

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

12.74%

2 5 7
7 9 10

2 5 7
7 9 10

20.2%

1 2 3
4 5 6
7 8 9

1 2 3
4 5 6
7 8 9

37.39%

3 4 5
8 6 10

3 4 5
8 6 10

29.67%

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

15.96%

5

5

59.6%

13

13

15.96%

7

7

8.49%

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);
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

10.75%

Sort the elements of array

Sort the elements of array

58.91%

Find the smallest element in the array

Find the smallest element in the array

26.52%

None of the above

None of the above

3.82%

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.62%

It reverses  the string

It reverses  the string

69.07%

It prints the string in the same order

It prints the string in the same order

16.82%

none of the above

none of the above

4.49%

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

28.26%

5

5

52.17%

7

7

3.26%

6

6

16.3%

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.87%

Prime

Prime

7.66%

Prepinsta

Prepinsta

25.18%

error

error

53.28%

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

10.38%

10

10

9.23%

8

8

45.38%

7

7

35%

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

27.78%

1

1

46.43%

3

3

5.16%

5

5

20.63%

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

24.3%

Prime Prepinsta Prime Prepinsta

Prime Prepinsta Prime Prepinsta

30.84%

Prime Prepinsta Prepinsta Prime

Prime Prepinsta Prepinsta Prime

28.5%

Prepinsta Prime Prepinsta Prime

Prepinsta Prime Prepinsta Prime

16.36%

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

33.19%

4

4

31%

-1

-1

32.75%

-2

-2

3.06%

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

10.47%

'Z'

'Z'

6.59%

90

90

46.12%

122

122

36.82%

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

15.65%

55

55

14.35%

53

53

10.43%

45

45

59.57%

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

10.09%

15

15

75.69%

20

20

5.96%

25

25

8.26%

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

83.06%

11

11

8.68%

19

19

3.72%

7

7

4.55%

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 ×

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

There are 10 Questions that need to solve in 30 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.