## ADP Interview Questions

- 0of 0 votes

AnswersWant Facebook Customer Service Number ?

- thedevicesupport June 09, 2017 in United States| Report Duplicate | Flag | PURGE

ADP abc - 0of 0 votes

AnswersGiven a movie X that the user had watched, write an algorithm to suggest more movies to the user. How to display the other movies based on same genre?

- suneel March 24, 2017 in India| Report Duplicate | Flag | PURGE

ADP SDE-2 Algorithm - 0of 0 votes

AnswersConsider an array A of N integers, only permitted operation in this array to reverse the subarray of any length, where the middle index of sub array and middle index of array a are equal. you need to find whether the given array can be sorted using multiple such reverse operations. if sorting is possiable print "Possible". "Not Possible" otherwise.

- sarath.chalasani46 August 10, 2016 in India

For example, if the given array is [1,6,3,4,5,2,7] then 2 reverse operations are needed to make this array sorted. first [3,4,5] is reversed to make [1,6,5,4,3,2,7], then [6,5,4,3,2] is reversed to make [1,2,3,4,5,6,7]. so "Possible" should be printed.

Input: first line contains a number N denotes the length of array, Next line contains N numbers separted by spaces.

output : "Possible" if sorting is possible, " Not Possible otherwise.| Report Duplicate | Flag | PURGE

ADP - 0of 0 votes

Answersa positive non reduceable fractions can be written has x/y where x,y are positive integers, find the count of non

- sarath.chalasani46 August 10, 2016 in India

reduceable fractions which is less than 1 for the given N where x,y <=N.

For example , if N=>4 then your output should be 5.

explanation : for N=4 the fractions can be formeted as fallows.

1/1,1/2,2/2,1/3,2/3,3/3,1/4,2/4,3/4,4/4

but 2/4 can be reduce to 1/2, also 1/1,2/2,3/3 and 4/4 is equal to 1, so we can elimi nate those fractions the list and we

have 5 non reduceable fractions whic is less than 1.

input : single number

out put : single number displayed the count of non reduceable fraction less than 1.| Report Duplicate | Flag | PURGE

ADP Developer Program Engineer - 0of 0 votes

AnswersWrite a java program:

- sarath.chalasani46 April 26, 2016 in India

There is plant species (say P) in a desert that has a specific living pattern. A rectangular

field of the land is divided into squara cell.The land will have R rows and C columns of the

cell.Each cell will be surrounded by up-to eight neighboring cells(note that the cells at the

edge of the field will have fewer then eight nuighboring cells). A cell can either be empty

(having no plant in it) or living(having a plant in it).A particular cell is said to have N

neighbors(1<N<8), if exactly N cells in the neighborhood have living plants.

the plants fallow a certain rules for survival.the rules are as fallows.

1) if a cell with plant s1 to s2 neighbors (1<=s1<=s2<=8), it survives to the next generation.

i.e. the plant dies if it has less than s1 neighbors or more than s2 neighbors.

2) If an empty cell has B1 to B2 neidhbors (1<=B1<=B2<=8), a new plant takes birth in that cell

in the next generation.

Input Specification:

theinput will have two arrays, as fallows

1)An integer array: {R,C,S1,S2,B1,B2,G}

where R and C specify size of the field in row and columns respectively, with 1<=R<=2000 and

1<=C<=2000 s1,s2,B1 and B2 are integers as explained in the survival rules. G is the number of

generations for wich the simulation has to be run.

2)An integer array specifying intial state of the field: size of the array will be R*c

the data will be expressed in the array as fallows:{E11,E12,E1c,E21,....,E2C,ER1,ERC} where Eij

is cell in the field at ith row and jth column. Eij can have value 0 or 1. 0 corresponds to

empty cell and 1 corresponds to living cell.

output specification:

output will be an integer array specifying state of the field at the end of the simulation in

the same manner as in input.

Examples:

Example 1:

input1: {3,4,2,3,3,3,3}

input2: {0,1,0,0,0,1,1,0,1,0,1,0}

output : {0,1,1,1,0,0,0,1,0,0,1,0}

Example 2:

input1: {3,4,2,3,3,3,4}

input2: {0,1,0,0,0,1,1,0,1,0,1,0}

output: {0,0,1,1,0,1,0,1,0,0,0,0}

Method Signature:

public static int[] survivalcells( int[] input1,int input2){

}| Report Duplicate | Flag | PURGE

ADP abc - 0of 0 votes

Answersyou are given an MxN matric.Every cell of the matrix has a cost associated. initially you are at(0,0) and you have to reach (M-1,N-1). Question is to find the minimum cost path from (0,0) to (M-1,N-1) and also the minimum cost. From a cell you can only make a move to right cell or down cell or diagonally lower cell.

- sarath.chalasani46 April 26, 2016 in India

Input Specification:

Input1: A string array containing rows of the cost matrix as element.

input2: An integer having number of rows in the cost matrix.

For above example, the matrix would be {5#7#2#4,1#8#1#3,6#2#9#5,1#6#2#8} and number of rows would be 4.

output Specification:

The output will be a string containing minimum cost and the path chosen separated by the comma.

For Example , Given the cost matrix

5 7 2 4

1 8 1 3

6 2 9 5

1 6 2 8

1) minimum cost value is 5+1+2+2+8=18

2) minimum cost path from (0,0,) to (M-1,N-1) is BDDR

B- for down move

D- Diagonal Move

R- Right move

NA- No solution

Hence your output will be 18,BDDR

method signature:

public static String minimumCost(String[] input1, int input2) {

}| Report Duplicate | Flag | PURGE

ADP abc - 1of 1 vote

AnswersNeed Java Program :

- sarath.chalasani46 March 31, 2016 in India

A rectangular plot comprising n*m block ( cement block in shape of a cube) were kept, one block per each cell. the base of

each block covers one cell completely and its surface is equals to one square meter. cube on adjacent cell are so close

that there are no gaps between them.due to a heavy rain on the constuction, water is accumulated in the gaps created

between a group of blocks due to the difference in their heights.

write a program to calculate the volume of water accumulated between the blocks on the constrution.

Input Specifications:

your function must read three arguments i.e plot_length,plot_breadth and block_height

where

- Plot_length (r) : provides the length of each rectangular plot in metres.

- Plot_breadth (c) : provides the breadth of each rectangular plot in metres.

- Block_height(int array) : provides the height of r*c blocks row-wise.

Constraints

1<=plot_length,plot_breadth,block_height<=10

Output Specifications:

output will be an integer that will depict the volume of water (in cubic metres) accumulated in the puddles due to the

difference in heights of block.

Examples:

Example 1:

input1 =3

input2=6

input3={3,3,4,4,4,2,3,1,3,2,1,4,7,3,1,6,4,1}

output: 5

Example 2:

input1 =6

input2=3

input3={3,3,7,3,1,3,4,3,1,4,2,6,4,1,4,2,4,1}

output: 5| Report Duplicate | Flag | PURGE

ADP Applications Developer - 0of 0 votes

AnswersNeed Java code:

- sarath.chalasani46 March 30, 2016 in India

In a Multinational company employees are ordered to seat according to their height in a line. they always choose their

positions randomly to displeasure their manager. one evening, the employee learn that their strict manager has secretly

recorded their seating positions from that morning, and that he will be checking their positions in the next moning to

make sure they are exactly the same.

Each employee only remember one thing from that morning: the number of people to his left that were teller then him.

there are N employees, each with a different height between 1 to n. using this information you must reconstruct the

seating arrangement from that morning.

you are given a int[], the ith element of which represents the number of taller employees to the left of the employee with

height i (where i is a 1-based index). Return a int[] containing the heights of the employees from left to right in the line.

Note: The input is guaranteed to produce a valid and unique output.

Inputs Specifications:

your function should accept the fallowing inputs:

Input 1: N

Input 2: An array(left[]) of n integers

Output Specifications:

you need to return the int [] containing the heights of the employees from left to right in the line.

Example :

Input:

input 1: 4

input 2: {2,1,1,0}

Output: {4,2,1,3}

Explanation:

Employee of height 1 remembered there were 2 employees taller than him to his left.

Employee of height 2 remembered there were 1 employees taller than him to his left.

Employee of height 3 remembered there were 1 employees taller than him to his left.

Employee of height 4 remembered there were no employees taller than him to his left.

the orginal order from left to right must have been 4,2,13.

this ordering satisfies all four conditions.

For example, there are exactly two employees to the left of the employees with height 1 that are taller then him(heights 4

and 2). A different ordering,like 4,3,1,2, satisfies some, but not all of the four conditions. in this incorrect ordering, there

are two employees to the left of employee with height 2 that are taller then him(height 4 and 3), but input states that

there was only one.| Report Duplicate | Flag | PURGE

ADP Applications Developer - 0of 0 votes

AnswersThere are N friends sitting in a circle, they are numbered clockwise 1 to N. Game starts with

- sarath.chalasani46 March 28, 2016 in India

player 1 receiving the ball. A player needs to pass the ball to other player based on some

conditions.

1. if he is receiving ball for pth time,he passes that ball to persion L places to left if P is even

or L places right if P is odd.

2. if any player receives the ball M times then game is over.

Eample :

Input 1(N):5

Input 1(M):3

Input 1(L):2

Output: 10

Explanation:

First player 1 gets tha ball. since he has held the ball 1 time , he passes the ball to player 4,

who is two places to his right. this is player 4 first time holding the ball, so he gives it to

player 2, who passes it to player 5. player 5 then passes the ball to player3. who passes it

back to player 1.since player 1 has now held the ball 2 times, hepasses it to player 3, who

passes it to player 5, who then passes the ball to player 2. finally, player 2 passes the ball to

player 4, who then passes it to player 1. player 1 has now held the ball 3 times, and the game

ends.| Report Duplicate | Flag | PURGE

ADP abc - 0of 0 votes

AnswerHow to find primes using SQL?

- Engineer1111 February 26, 2016 in United States

This is the SQL I came up to , but it looks like it'll only get numbers more than the square root

SELECT m1

FROM

(SELECT rownum m1 FROM dual d CONNECT BY LEVEL <1000

)

WHERE NOT EXISTS

(

SELECT x

FROM

(SELECT ROWNUM x FROM DUAL CONNECT BY LEVEL <= (sqrt(1000)))

WHERE x > 1

AND mod(m1,x) = 0

)| Report Duplicate | Flag | PURGE

ADP Applications Developer - 0of 0 votes

Answerswrite a java program for below question.

- sarath.chalasani46 August 10, 2015 in United States

suppose john has been give task of monitoring a radio which is jumping to random frequency on a hourly basis. joha has to find the maximum positive frequency difference of that radio in at most two selections.

examples :

1. suppose radio is tuned to 91MHz to 98MHz and then to 95MHZ.

In first tunning Df= f2-f1 =98-91=7 (positive frequency diff)

In second tunning Df= f2-f1 =95-98=-3 (negative frequency diff)

2. Input1: {2,30,15,10,8,25,80}

input2: 7

output:100

To have maximum frequency diff with at most two selections. john has to select 2MHZ and he has to drop it to 30MHZ and second selection, he has to pick 8MHz to 80Mhz.

so output is 28+72=100

Java method signature :

public static int maximumPositiveFrequency(int[] input1,int input2)

{

}| Report Duplicate | Flag | PURGE

ADP Developer Program Engineer - 0of 0 votes

Answerssuppose john has been give task of monitoring a radio which is jumping to random frequency on a hourly basis. joha has to find the maximum positive frequency difference of that radio in at most two selections.

- sarath.chalasani46 August 10, 2015 in India

examples :

1. suppose radio is tuned to 91MHz to 98MHz and then to 95MHZ.

In first tunning Df= f2-f1 =98-91=7 (positive frequency diff)

In second tunning Df= f2-f1 =95-98=-3 (negative frequency diff)

2. Input1: {,30,15,10,8,25,80}

input2: 7

output:100

To have maximum frequency diff with at most two selections. john has to select 2MHZ and he has to drop it to 30MHZ and second selection, he has to pick 8MHz to 80Mhz.

so output is 28+72=100| Report Duplicate | Flag | PURGE

ADP Developer Program Engineer - 0of 0 votes

AnswersPassing objects and correct the program:---

- Avinash July 14, 2015 in United States

class OdemoA

{

int i,j;

void function1(int i)

{

System.out.println(i);

System.out.println("Inside function()");

}

void function2(Area a1)

{

if(a1!=null)

{

a1.i=203;

a1.j=115;

}

System.out.println(a1);

System.out.println("end of function2()");

}

public static void main(String args[])

{

OdemoA d1 = new OdemoA();

Area a2 = new Area();

d1.function2(a2);

System.out.println(a2.i);

System.out.println("end main");

}

}| Report Duplicate | Flag | PURGE

ADP Developer Program Engineer Java - 0of 0 votes

AnswersFind the most frequent element in an array in logn time.

- ksahoo June 28, 2015 in United States| Report Duplicate | Flag | PURGE

ADP Java Developer Algorithm - 0of 0 votes

AnswersA seller sells lot of products in his store and people place orders,just like any other store. Each item has a different weight and price.

- Kittu November 22, 2014 in India

And each order can be a combination of different number of items with random quantity. Now each of these orders areto be put into different packages and sent to the courier company for delivery.

But there are certain rules while splitting items into packages, they are as below:

1. If the cost of all the items in an order is more than $1000, split those items into multiple

packages, otherwise one package would be enough.

2. If the items in the same order are split into multiple packages, then the weight of the

packages should be equally distributed over the packages with consideration of optimum

courier charges.

3. While splitting, NO PACKAGE can have a total price above $1000| Report Duplicate | Flag | PURGE

ADP Dev Lead Dev Lead Algorithm - 0of 0 votes

AnswersA parent array P is given where P[i] denotes the parent of the ith node in the tree(the tree is generic). Parent of root is indicated with -1. I need to find the height/depth of tree. (Best sol in O(n))

- gopi.komanduri October 30, 2014 in India| Report Duplicate | Flag | PURGE

ADP Analyst Algorithm Arrays C# Data Structures Trees and Graphs - 0of 0 votes

AnswersFind if there is a cycle in a list of parent-child tuples.

- Alok May 25, 2014 in United States

You are given a list of tuples

(a,b) => a is parent of b

(b,c) => b is parent of c

(c, d) => c is parent of d

(d, a) => d is parent of a ----> Cycle detected..

Implement a Java method.| Report Duplicate | Flag | PURGE

ADP Java Developer - -1of 1 vote

AnswersYou are given parent-child relationships. Your goal is to find find the data is cyclical.

- Alok May 25, 2014 in United States

(a,b) => a is a parent of b

(b, c) => b is a parent of c

(c, a) => c is a parent of a ... Oops! Cycle found!

public bool hasCycle(List<String, String> input);| Report Duplicate | Flag | PURGE

ADP Java Developer Algorithm - 0of 0 votes

AnswersI was asked this during a recent interview.

- kloblivioner April 18, 2014 in United States

Lucky number – a number is a lucky number if it comprises of combination of 4′s and 7′s.

For example , if 32 is the input number, the next nearest lucky number would be 44.

Similarly ,

43 -> 44

45 -> 47

1004 -> 4444

Input number can be of any digits.

Design an algorithm that will take any random number and return its next lucky number| Report Duplicate | Flag | PURGE

ADP Developer Program Engineer Algorithm - 0of 0 votes

AnswersThis was asked to one of my friends in her telephonic interview with ADP.

- Jeanclaude February 07, 2014 in United States

Imagine you have a 5x5 matrix containing integers... If any of the elements in this original matrix is 0, then your resultant matrix should have the corresponding row and column filled with 0s. For e.g. if 1st element of 1st row, 2nd element of 2nd row......up to 5th element of 5th row are all 0s, then your resultant 5x5 matrix should be all 0s. Your code should be flexible and work for any size of matrix (not just with 5x5).| Report Duplicate | Flag | PURGE

ADP Software Engineer in Test - 0of 0 votes

Answers1h 15m.

- anonymous September 28, 2011 in United States| Report Duplicate | Flag | PURGE

ADP Graphics Programmer Algorithm

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.