Accenture Coding Questions | Coding Test for Accenture 2019-20

Accenture Coding Questions

Accenture Coding Test is part of the new Accenture syllabus after it has been updated now, and coding round has been introduced as a new section in the Accenture Online Examination.  Accenture Coding Test Round Questions with Answers are discussed below. A lot of questions in Accenture will be repeated from our Dashboard so it is suggested that you prepare from PrepInsta. For more detailed information you can visit to the Accentutre Dashboard.

 In the Accenture Coding Round , Stundets can code using –

  • C
  • C++
  • Java
  • Python
Accenture coding
Total number of questions 2 questions
Total Time Duration 45 minutes
Type of Test Non Adaptive
Negative Marking No

Accenture Coding Questions marking Scheme

There will be total of 2 Questions asked in the Accenture Coding Round. For successfully clearing the Coding Round, Students need to have 1 Complete Output and 1 Partial Output.

Accenture Coding RoundNo of QuestionsMin. Selection Criteria
Coding Questions2One Complete Output
One Partial Output

 

Rules for Accenture Coding Round Questions Section:

  • There are two question for 45 minutes.
  • We must start our code from the scratch.
  • The coding platform is divided into two, one for writing the code and other for output. We should write the whole program.
  • The errors are clearly mentioned.
  • One Partial and One Complete Output is required for clearing the round.

In online classes you will get the access to the paid preparation materials as well, but if you want the materials then you can buy the ones below:-

or

Prices increase for Paid materials in

All the important practice questions for Accenture Coding will be solved in depth in our Online classes:

Click here to join Online Live Class

Question : 1

Problem Statement 

 

You are required to implement the following function:

Int Calculate(int m, int n);

The function accepts 2 positive integer ‘m’ and ‘n’ as its arguments.You are required to calculate the sum of numbers divisible both  by 3 and 5, between ‘m’ and ‘n’ both inclusive and return the same.
Note 
0 < m <= n

Example 

Input:

m : 12

n  : 50

Output 

90

Explanation: 
The numbers divisible by both 3 and 5, between 12 and 50 both inclusive are {15, 30, 45} and their sum is 90.
Sample Input 
m : 100
n : 160
Sample Output 
405

/* Programming Question */

#include <stdio.h>

int Calculate(int, int);

int main()
{
int m, n, result;

// Getting Input

printf("Enter the value of m : ");
scanf("%d",&m);
printf("Enter the value of n : ");
scanf("%d",&n);

result = Calculate(n,m);

// Getting Output

printf("%d",result);

return 0;
}

/* Write your code below . . . */

int Calculate(int n, int m)
{
// Write your code here

int i, sum = 0;
for(i=m;i<=n;i++)
{
if((i%3==0)&&(i%5==0))
{
sum = sum + i;
}
}

return sum;
}
#include<iostream>
using namespace std;

int Calculate(int, int);

int main()
{
int m, n, result;

// Getting Input

cout<<"Enter the value of m :";
cin>>m;
cout<<"Enter the value of n :";
cin>>n;

result = Calculate(n,m);

// Getting Output

cout<<result;

return 0;
}

/* Write your code below . . . */

int Calculate(int n, int m)
{
// Write your code here

int i, sum = 0;
for(i=m;i<=n;i++)
{
if((i%3==0)&&(i%5==0))
{
sum = sum + i;
}
}

return sum;
}

Question : 2

Problem Statement 

 

You are required to input the size of the matrix then the elements of matrix, then you have to divide the main matrix in two sub matrices (even and odd) in such a way that element at 0 index will be considered as even and element at 1st index will be considered as odd and so on.
then you have sort the even and odd matrices in ascending order then print the sum of second largest number from both the matrices

Example

enter the size of array : 5
enter element at 0 index : 3
enter element at 1 index : 4
enter element at 2 index : 1
enter element at 3 index : 7
enter element at 4 index : 9

Sorted even array : 1 3 9
Sorted odd array : 4 7

10

#include <stdio.h>

int main()
{
int arr[100];
int length, i, j, oddlen, evenlen, temp, c, d;
int odd[50], even[50];

printf("enter the length of array : ");
scanf("%d",&length);

for(i=0;i<length;i++)
{
printf("Enter element at %d index : ",i);
scanf("%d",&arr[i]);
}

if(length%2==0)
{
oddlen = length/2;
evenlen = length/2;
}
else
{
oddlen = length/2;
evenlen = (length/2) + 1;
}

for(i=0;i<length;i++) // seperation of even and odd array
{
if(i%2==0)
{
even[i/2] = arr[i];
}
else
{
odd[i/2] = arr[i];
}
}

for(i=0; i<evenlen-1; i++) // sorting of even array
{
for(j=i+1; j<evenlen; j++)
{
temp = 0;
if(even[i]>even[j])
{
temp = even[i];
even[i] = even[j];
even[j] = temp;
}
}
}

for(i=0; i<oddlen-1; i++) // sorting of odd array
{
for(j=i+1; j<oddlen; j++)
{
temp = 0;
if(odd[i]>odd[j])
{
temp = odd[i];
odd[i] = odd[j];
odd[j] = temp;
}
}
}

printf("\nSorted even array : "); // printing even array
for(i=0;i<evenlen;i++)
{
printf("%d ",even[i]);
}

printf("\n");

printf("Sorted odd array : "); // printing odd array
for(i=0;i<oddlen;i++)
{
printf("%d ",odd[i]);
}

printf("\n\n%d",even[evenlen-2] + odd[1]); // printing final result
}

#include <iostream>
using namespace std;


int main()
{
int arr[100];
int length, i, j, oddlen, evenlen, temp, c, d;
int odd[50], even[50];

cout<<"enter the length of array : ";
cin>>length;

for(i=0;i<length;i++)
{
cout<<"Enter element at index : ",i;
cin>>arr[i];
}

if(length%2==0)
{
oddlen = length/2;
evenlen = length/2;
}
else
{
oddlen = length/2;
evenlen = (length/2) + 1;
}

for(i=0;i<length;i++) // seperation of even and odd array
{
if(i%2==0)
{
even[i/2] = arr[i];
}
else
{
odd[i/2] = arr[i];
}
}

for(i=0; i<evenlen-1; i++) // sorting of even array
{
for(j=i+1; j<evenlen; j++)
{
temp = 0;
if(even[i]>even[j])
{
temp = even[i];
even[i] = even[j];
even[j] = temp;
}
}
}

for(i=0; i<oddlen-1; i++) // sorting of odd array
{
for(j=i+1; j<oddlen; j++)
{
temp = 0;
if(odd[i]>odd[j])
{
temp = odd[i];
odd[i] = odd[j];
odd[j] = temp;
}
}
}

cout<<"\nSorted even array : "; // printing even array
for(i=0;i<evenlen;i++)
{
cout<<even[i];
}

cout<<"\n";

cout<<"Sorted odd array : "; // printing odd array
for(i=0;i<oddlen;i++)
{
cout<<odd[i];
}

cout<<even[evenlen-2] + odd[1]; // printing final result
}

Question : 3

Instructions: You are required to write the code. You can click on compile and run anytime to check compilation/execution status. The code should be logically/syntactically correct.

Problem: Write a program in C to display the table of a number and print the sum of all the multiples in it.

Test Cases:

Test Case 1:
Input:
5
Expected Result Value:
5, 10, 15, 20, 25, 30, 35, 40, 45, 50
275

Test Case 2:
Input:
12
Expected Result Value:
12, 24, 36, 48, 60, 72, 84, 96, 108, 120
660

 #include <stdio.h>
int main()
{
int n, i, value=0, sum=0;

printf("Enter the number for which you want to know the table: ",n);
scanf("%d",&n);

for(i=1; i<=10; ++i)
{
value = n * i;
printf("table is %d \n",value);
sum=sum+value;
}

printf("sum is %d",sum);

return 0;
}
#include <iostream>
using namespace std;

int main()
{
int n, i, value=0, sum=0;

cout<<"Enter the number for which you want to know the table: ",n;
cin>>n;

for(i=1; i<=10; ++i)
{
value = n * i;
cout<<value<<endl;
sum=sum+value;
}

cout<<"sum is "<<sum ;

return 0;
}

Question : 4

Instructions: You are required to write the code. You can click on compile and run anytime to check compilation/execution status. The code should be logically/syntactically correct.

Question: Write a program in C such that it takes a lower limit and upper limit as inputs and print all the intermediate pallindrome numbers.

Test Cases:

TestCase 1:
Input :
10 , 80
Expected Result:
11 , 22 , 33 , 44 , 55 , 66 , 77.

Test Case 2:
Input:
100,200
Expected Result:
101 , 111 , 121 , 131 , 141 , 151 , 161 , 171 , 181 , 191.

 #include<stdio.h>
int main()
{
int i, n, reverse, d,f,l;
printf("enter the starting \n",f);
scanf("%d",&f);
printf("enter the ending\n",l);
scanf("%d",&l);
for (i = f; i <= l; i++)
{
reverse = 0;
n = num;
while (n != 0)
{
d = n % 10;
reverse = reverse * 10 + d;
n = n / 10;
}
if (i == reverse)
printf("%d ",i);
}
return 0;
}
#include<iostream>
using namespace std;
int reverse(int);
int main()
{
int i,f,l;
cout<<"enter the starting \n",f;
cin>>f;
cout<<"enter the ending\n",l;
cin>>l;
for (i = f; i <= l; i++)
{
if(i==reverse(i))
cout<<" "<<i;
}
return 0;
}
int reverse(int a)
{
int n=0,d=0,rev=0;
n = a;
while (n != 0)
{
d = n % 10;
rev = rev * 10 + d;
n = n / 10;
}
return rev;

}

Question : 5

Instructions: You are required to write the code. You can click on compile & run anytime to check the compilation/ execution status of the program. The submitted code should be logically/syntactically correct and pass all the test cases.

Ques: The program is supposed to calculate the distance between three points.

For
x1 = 1 y1 = 1
x2 = 2 y2 = 4
x3 = 3 y3 = 6

Distance is calculated as : sqrt(x2-x1)2 + (y2-y1)2

#include <stdio.h>
#include <math.h>

int isDistance(float *pt1, float *pt2, float *pt3)
{
float a, b, c;
a = sqrt(((pt2[0]-pt1[0])*(pt2[0]-pt1[0]))+((pt2[1]-pt1[1])*(pt2[1]-pt1[1])));
printf(“%f”,a);
b = sqrt(((pt3[0]-pt2[0])*(pt3[0]-pt2[0]))+((pt3[1]-pt2[1])*(pt3[1]-pt2[1])));
printf(“%f”,b);
c = sqrt(((pt3[0]-pt1[0])*(pt3[0]-pt1[0]))+((pt3[1]-pt1[1])*(pt3[1]-pt1[1])));
printf(“%f”,c);
}

int main()
{
int t;
float p1[2], p2[2], p3[2];
printf("enter x1 and y1 : ");
scanf("%f%f",&p1[0],&p1[1]);
printf("enter x2 and y2 : ");
scanf("%f%f",&p2[0],&p2[1]);
printf("enter x3 and y3 : ");
scanf("%f%f",&p3[0],&p3[1]);
t = isDistance(&p1, &p2, &p3);
printf("%d",t);
return 0;
}

FAQ | Accenture Coding Test

Question : In which all coding languages we can solve the Coding Question asked in Accenture Coding Round?

Ans: Students can use any of the following languages to solve the Coding Questions

  • C
  • C++
  • Python
  • Java

Question: Which platform does Accenture uses for the Coding Round?

Ans: For the complete Online Assessment of the Exam, Accenutre uses CoCubes as a platform to conduct the exam.

Question : What is the difficulty of the Coding Questions asked in Accenture Coding Test 2019?

Ans: The Coding Questions asked in Accenture are of two difficulty type

  • 1 Question with Medium to High difficulty
  • 1 Question High difficulty

Ques. Is PrepInsta enough to prepare for Accenture Coding Round and Questions asked in the exams?

Ans. Yes, it is the best resource out there in the internet to prepare for Accenture Coding section paper.

Question: How to Clear Accenture Coding Round?

Ans: Prepare for PrepInsta’s best Coding Question material, this will help you understand the difficulty of the questions that can be asked in the exam and also Students in PrepInsta’s Online class for Accenture will get the opportunity to solve all the previous year questions that were asked in Accenture Coding Round.

Summary
Review Date
Reviewed Item
Accenture Coding Questions
Author Rating
51star1star1star1star1star

Please Login/Signup to comment