## Accenture Interview Questions

- 0of 0 votes
Given 2 numbers (where 6 can also be written as 5, and 5 as 6), calculate the maximum and minimum possible sum

Ex:-

645 666

545 + 555

646 + 666

- 0of 0 votes

- -2of 2 votes
Program to increment the vavue of array element by 1 and cost require to each increment value us 1 print cost

- -2of 2 votes
dsjfvbhfgvbfhv

- 0of 0 votes
You have a guy who is walking on a street with "X" doors on one side

(say left side).From the third round, He has to walk "X" rounds to and

fro( from point A, starting point to B, ending point).

So he walks "X" times from A to B, and back "X" times.

First two rounds he just walks to and fro.

Every time he walks he closes the particular doors corresponding to

the number of the round of his walk, starting from the third round. So

at the third round, he closes the third door, sixth door, ninth door,

.... upto

"X", if "X" is a multiple of 3,

"X-1", if "X-1" is a multiple of 3

AND

"X-2", if "X-2" is a multiple of 3

Then he walks till the "X" door. This he does for every round, till

the "Xth" round.

So, if X is 300, he walks upto the 300th door, closes the 300th door

and returns.

If X is 400, he closes upto 399th door, goes till the 400th door and returns.

If X is 500, he closes upto 498th door, goes till the 500th door and returns.

While returning, he just does nothing. He just returns to where he

started i.e. POINT A.

Likewise for the fourth round, where he close doors that are multiples

of 4 i.e. 4, 8, 12, 16, etc till X (Similar calc as in the 3rd round,

except that we consider multiples of 4 here).

And so on till the "Xth" round.

I.E.

This continiues till "X" rounds. So, from 3 to X rounds. Note that we

have not included 1st and 2nd rounds.

Problem here is:

Write the code in any language of your choice to find:

What is the minimum number of the round where he would not have to close any door?

- 0of 0 votes
Given a large terabytes of text file, sort the words in the file. Explain how it can be done in Mapreduce and Spark.

- -1of 1 vote
You are given an array of wooden log’s length. each of varying length.You have a wooden cutter with you. it has a sharpness value, say S.

You are supposed to cut as many wooden logs (desired logs), each of length L (not more or less) using only S cuts

if you cut a wood, S will decrease by 1

if you cut two woods together, even then S will decrease by the number of woods in the cut, ie. 2

assume L and S are int. and the length of each wood is also int

- 1of 1 vote
Remove duplicates from string given " cutcopypaste " Return "uoyase"

- 0of 0 votes
there are N employee sitting in consecutive cubicles , we have to send a few of them to onsite , but each time we send one employee onsite , his cubicle becomes empty , now the other employees from both side of that empty cubicle stops working until they are given a gift .

the gifts are given in both sides of the empty cubicle until we reach the end or found another cubicle ,

Input – number of cubicle , and index numbers of people to be sent

output- min number of gifts needed

- 0of 0 votes
A credit card company allows merchants to use their Point-of-sale (POS) terminal to accept payments. It wishes to charge merchants for every transaction that happens through thier POS terminal. Here are some charging rules that it has come up with:

Transactions are charged 2.0% of transaction amount if amount is less than 5000.00

Transactions are charged 1.5% of transaction amount if amount is between 5000.00 and 9999.99 (both inclusive)

Transactions are charged 1.0% of transaction amount if amount is equal to or above 10000.00

If merchant has already done transactions worth 50000.00 in a month, then rest of transactions of that month are charged at 0.5%

Every Month - two transactions of amount less than or equal to Rs. 5000.00 are free

Charges are rounded to nearest higher Rupee (Eg: 9.23 is rounded to 10.00)

Please develop a program to compute the charges for given inputs.

Your input will be in the following format. First Line: number of records follows, say N Next N Lines - Transaction data in the order - Transaction Date, Merchant Name, Amount

15

2014-06-25,XYZ Retail,10000.00

2014-07-01,XYZ Retail,10000.00

2014-07-01,ABC Retail,1000.00

2014-07-02,ABC Retail,3999.00

2014-07-02,ABC Retail,2000.00

2014-07-03,ABC Retail,10000.00

2014-07-15,ABC Retail,6530.00

2014-07-15,XYZ Retail,500.00

2014-07-18,ABC Retail,9750.00

2014-07-18,XYZ Retail,35000.00

2014-07-18,XYZ Retail,500.00

2014-07-18,XYZ Retail,5000.00

2014-07-18,XYZ Retail,5000.00

2014-08-02,XYZ Retail,10000.00

2014-08-02,XYZ Retail,1000.00

Transactions must be read and processed in the order given, else output will not match. Do not try to sort the transactions.

Output (Charges for each transaction on separate line)

100.00

100.00

0.00

0.00

40.00

100.00

98.00

0.00

147.00

350.00

0.00

75.00

25.00

100.00

0.00

Sample Input (Plaintext Link)

15

2014-06-25,XYZ Retail,10000.00

2014-07-01,XYZ Retail,10000.00

2014-07-01,ABC Retail,1000.00

2014-07-02,ABC Retail,3999.00

2014-07-02,ABC Retail,2000.00

2014-07-03,ABC Retail,10000.00

2014-07-15,ABC Retail,6530.00

2014-07-15,XYZ Retail,500.00

2014-07-18,ABC Retail,9750.00

2014-07-18,XYZ Retail,35000.00

2014-07-18,XYZ Retail,500.00

2014-07-18,XYZ Retail,5000.00

2014-07-18,XYZ Retail,5000.00

2014-08-02,XYZ Retail,10000.00

2014-08-02,XYZ Retail,1000.00

Sample Output (Plaintext Link)

100.00

100.00

0.00

0.00

40.00

100.00

98.00

0.00

147.00

350.00

0.00

75.00

25.00

100.00

0.00

Explanation

100.00 // Rule 3 applied

100.00 // Rule 3 applied

0.00 // Rule 5 applied (ABC Retail) for the month of July

0.00 // Rule 5 applied (ABC Retail) for the month of July

40.00 //Rule 1 & 6 applied

100.00 // Rule 3 applied

98.00 // Rule 2 & 6 applied

0.00 // Rule 5 applied (XYZ Retail) for the month of July

147.00 // Rule 2 & 6 applied

350.00 //Rule 3 applied

0.00 // Rule 5 applied (XYZ Retail) for the month of July

75.00 // Rule 2 applied

25.00 // Rule 4 applied

100.00 // Rule 3 applied

0.00 // Rule 5 applied (XYZ retail) - for the month of Augus

- 0of 0 votes
public class Base Test {

protected void finalize() {

System.out.println("Destroying Base");

}

}

public class DerivedTest extends Base Test{

protected void finalize() {

System.out.println("Destroying Derived");

}

}

What is output when an instance of DerivedTest is finalized?

- 0of 0 votes
If a matrix of type float is casted to char *, how is it represented in memory, how to access the array elements.

`float mtrx[200][200] ={ {0}}; char *ptr = (char*)(& mtrx[i][j]);`

- 1of 1 vote
Define a class Point having 2 fields x (int) and y (int) which represents a point (x,y)

Define a class Line having 2 Points, pt1 and pt2.

Define a class Quadrilateral having 4 Points, pt1, pt2, pt3 and pt4. The class also has the following functions

- getAllLines() which returns a Line[] consisting all 4 lines of the Quadrilateral. Note that the 4 lines of the quadrilateral will be pt1:pt2, pt2:pt3, pt3:pt4 and pt4:pt1

- longestSide() which return a Line that represents the longest the side of the Quadrilateral.

Also define the constructors for each class

- 0of 0 votes
what are the top 10 coding standards/code reviews in java?

- -1of 1 vote
Why is returning pointer to a node in linked list from a pointer is unsafe and sometimes gives wrong answers.

- -1of 1 vote
`Programme 1 class A { private: A() { } }; int main() { //Do not create an object of A } Is there any error Compile Time error Y/N Run Time error Y/N Programme 2 class A { private: A() { } }; class B : public A { }; int main() { //Do not create an object of A or B } Is there any error Compile time Y/N Run Time Y/N`

- 0of 0 votes
I have been asked this question in written test. which pattern to use..

Using Java create a simulation of a car park. The

program will record vehicles entering and exiting the car

park, as well as the total balance of parking fees paid.

Cars can park in the car park for $2 per hour.

Trucks can park in the car park for $3 per hour.

For example a car parked for 2 hours will pay $4

and a truck parked for 2 hours will pay $6.

The program can also be asked for a balance report that

will show how many vehicles have entered and exited,

the number of spaces available and how much money has

been paid so far.

Trucks take up 2 car spaces.

The requirements for the interface:

1. The user records vehicles entering and exiting the

car park.

2. Upon exiting the car park a time in whole hours

spent in the car park is also entered.

3. The user can request a balance report of the car park

at any time.

4. The program can be exited at any time.

5. The program should validate user input.

Provide a production ready solution including source

files, project structure and any testing you have used.

Example #1

--------------------------------------------------

Program: How many spaces does the car park have?

User: 10

User: ENTER CAR

User: ENTER TRUCK

User: REPORT

Program:

Cars Entered: 1

Trucks Entered: 1

Cars Exited: 0

Trucks Exited: 0

Parking Cars: 1

Parking Trucks: 1

Spaces available: 7

Fees paid: $0

User: QUIT

Example #2

--------------------------------------------------

Program: How many spaces does the car park have?

User: 15

User: ENTER CAR

User: ENTER TRUCK

User: EXIT CAR 2

User: REPORT

Program:

Cars Entered: 1

Trucks Entered: 1

Cars Exited: 1

Trucks Exited: 0

Parking Cars: 0

Parking Trucks: 1

Spaces available: 13

Fees paid: $4

User: QUIT

- -4of 4 votes
Given 2 strings S1 and S2 where length of each string can go upto 10^5 I need to find Longest Common Substring of the two strings (Both its length and Substring also).

If their are many substrings with same maximum length I need to find that substring which occurs earliest in S2.

EXAMPLE : Let S1=defghi and S2=ghidef Then here answer will be ghi and length is 3.

I tried implemented it using suffix array but got stuck in between.Could someone help and provide the code to do it in c++/java

Note : It was mentioned that length of S1 is always greater or equal to length of S2

- -1of 1 vote
What would be the O/P and why?

`#include<stdio.h> #include<conio.h> int main() { int k = -7; printf("%d", 0 < !k); return 0;`

}

- 0of 2 votes
Given a N*M grid I want to find biggest submatrix not necessarily a square one that has all the value in it same.

Like

If N=4 and M=5 and matrix is

1 2 3 4 5

1 2 2 2 3

4 2 2 2 6

3 4 5 6 7

Then here answer will be matrix will be

2 2 2

2 2 2

So I need to find upper leftmost coordinate of this submatrix that is [2,2] and bottommost right coordinate that is [3,4].

I was to write a code for it in c++ in my interview

- 0of 0 votes
Given a 2d array N*M made of only 1's and 0's . I need to find a maximum subarray(square or rectangle) between two rows of the given 2d array which has all ones inside it. I need to find count of ones in this maximum subarray

EXAMPLE : Let N=4 and M=5 and the array be

1 0 1 1 0

1 0 1 1 1

0 1 1 1 1

0 0 0 0 1

Now if their are Q(say here it be 2) queries each describing upper and lower row between which we need to find this subarray.

Query 1 : 1 1(means start at row 1 and end also at row 1).Then we can clearly see answer will be 2

Query 2 : 2 3(means start at row 2 and end at row 3).Then answer will be 6 here.

Now,if queries can be very large in number(say upto 10^6) .How to tackle this problem

- 0of 0 votes
WAP to generating all the possible combination of a given character.

Example:-

Input: {a,b,c}

output: {a,b,c,ab,ac,ca,ba,,cb,bc,abc,bca,cab,cba,acb,bac}

- 0of 0 votes
You have 13 sorted cards, every cards from "2 ,3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, A".

you can discard all cards, according to some rules:

a pair of cards, like: 2,2

three cards, like: 8,8,8 or 8,9,10; J,Q,K

card A can convert to any cards as you wish, like: A -> 3

For example: Input: 2 2 3 4 5 5 6 7 8 8 9 9 9

you can discard: 2 2

3 4 5

5 6 7

8 8

9 9 9

output:

TURE

Input:

2 2 3 4 5 5 6 7 8 9 10 J A

“A” can be converted to “J”, so

you can discard

2 2

3 4 5

5 6 7

8 9 10

J J

output

TRUE

- -1of 1 vote
Add the diagonal elements of a square matrix (of odd order say 3*3,5*5) but the intersecting element must be added only once.

Sorry for my poor english..That what i understood from interviewer..

- 0of 0 votes
In order to print all the nouns and verbs present in a given book, what is the underlying algorithm you see to achieve this problem? Discuss the pros and cons of your choice and also how would you test this method. You may assume that the system already knows what are nouns and verbs.

- 3of 3 votes
In a given array a = {1, 7, 3, 4, 5, 6, 2} Print the indices of all the combinations which lead to a given sum called target. For e.g. if the method is

Void PrintAllSumCombos(int[] arr, int target) - and the array shown above is passed with sum target = 7, then the output should be:

0, 3, 6

0, 5

1

2, 3

4, 6

Note: For simplicity, You may assume the array does not contain any negative numbers and also consider same set of indices with a different order as identical - for e.g. if 2, 3 is already printed, ignore 3, 2 as they are one and the same.

- 0of 0 votes
what will be the output of the following program and why...

`#include<conio.h> #include<stdio.h> void main() { int a=10,b=20,diff; diff=&a-&b; printf("Difference=%d",diff); float a1=10.0,b1=20.0; diff=&a1-&b1; printf("\nDifference=%d",diff); char a2='a',b2='z'; diff=&a2-&b2; printf("\nDifference=%d",diff); double a3=10.0,b3=20.0; diff=&a3-&b3; printf("\nDifference=%d",diff); getch(); }`

- 0of 0 votes
Phonebook contains number and name.

1.use the java collection to add these entry (name and string).

2.Search the name by number

3.Remove the entry (name and string ) by using name.

I need to do this in Java...But if you can suggest me some Collection that can be used here, I shall do that....

I thought of :

1.using Hashmap,but here both name and number will be key....which wont be good...

2.Another option is to wrap both phone and number in an object and then add them to the list.And then Iterating and adding to the list.

Any other suggestions..?

- 0of 0 votes
Print below series in java

*** 1***

**2 *2**

*3*3*3*

4*4*4*4

- 0of 0 votes
RSpec's stub method can be used to override a method call on

an instance only

a class only

an instance or a class only

any Ruby object