0% found this document useful (0 votes)
7 views28 pages

Accenture Coding Questions Answers

The document outlines a series of coding questions and tasks categorized into steps, covering topics such as factors of a number, adding fractions, quadratic equations, string manipulations, and finding the greatest common divisor. Each section includes example inputs and expected outputs for clarity. The focus is on implementing functions to solve various programming challenges.

Uploaded by

Siva Raj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views28 pages

Accenture Coding Questions Answers

The document outlines a series of coding questions and tasks categorized into steps, covering topics such as factors of a number, adding fractions, quadratic equations, string manipulations, and finding the greatest common divisor. Each section includes example inputs and expected outputs for clarity. The focus is on implementing functions to solve various programming challenges.

Uploaded by

Siva Raj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

ACCENTURE CODING QUESTIONS

STEP 0: (Qn: 30, 31)

30) Factors of a number


#Code:

#OUTPUT:
31) Add two fractions

#Code:
#OUTPUT:
STEP : 1 (Qn: 18, 19)

18) Roots of a quadratic equation

#Code:
#OUTPUT:
19) Count possible decoding of a given digit sequence

#Code
#OUTPUT :
STEP 2: (Qn: 49, 50, 51)

49) Count common sub-sequence in two strings

#Code:
#OUTPUT:
50) Check if two strings match where one string contains wildcard
characters

#Code:
#OUTPUT:
51) Print all permutations of a given string in lexicographically sorted
order

#Code:
#OUTPUT:
STEP 3: (Slide no: 87, 88, 89)
Slide 87
The Greatest Common Divisor(GCD) of two or more Integers (at least
one of which is not zero), is the largest positive integer that divides the
numbers without a remainder.
Given two numbers, 'a' and 'b' as input, implement the following
function to find and return their greatest common divisor:

Example:
Input:
8
12
Output:
4

Explanation:
8-2*2*2
12-2*2*3
gcd(8, 12) - 4
Thus, the output is 4.

Sample Input
36
63
Sample Output
9
#Code:

#OUTPUT:
Slide 88
The function accepts a positive integer 'n' as its argument. A number 'n'
can always be represented as a sum of squares of other integers.
Implement the function to find the count of minimum number of
squares that adds up to 'n' and retum the court.

Input: n: 13
Output: 2

#Code:
#OUTPUT :
Slide 89
You are given a function,
int FindLargestPairSum(int* arr, int n);
The function accepts an integer array 'arr' of length 'n'. Implement the
function to find the largest pair sum in 'arr'. Here, you need to find two
elements whose sum is the largest of all the other pairs sum and print
the result.
Input: arr: 3 9 2 30 12 17
Output: 47
Explanation: The largest pair sum will be 30 + 17, l.e. 47.

#Code :
#OUTPUT:

You might also like