## Infosys Interview Questions

- 0of 0 votes
A flipping rule is given as a follows: Consider a series of positive integer. Take three numbers in the series next to each other. On applying the flipping rule to these numbers, the right most number will go to the left most number position and the other two numbers will move one position to the right at the same time. The rule can be applied to any three numbers present next to each in the series and can be applied as many times as needed.

Given n as the number of element in the original series, elements of the original series and a target series of a numbers, figures out if the target series can be created by flipping numbers of the original number and output the word “POSSIBLE” followed by the number of times the flipping rule has to be applied. In case, the target series cannot be formed, output the word “IMPOSSIBLE”.

Example :

For a series with 4 elements in it, 1 3 4 2 a new series = 4 3 2 1 can be formed by applying flipping rule as follows, From the table below we can say the output is POSSIBLE 3.

Steps

Series

The three Numbers Flipped

Resultant Series

1

1 3 4 2

1 3 4

4 1 3 2

2

4 1 3 2

1 3 2

4 2 1 3

3

4 2 1 3

2 1 3

4 3 2 1

Example input

Example OutPut

4 1 3 4 2 4 3 2 1

POSSIBLE 3

6 1 2 3 4 5 6 6 5 4 3 2 1

IMPOSSIBLE

- 0of 0 votes
what is the difference between internal repository and internet repository?

- 0of 0 votes
what about your project performance...how can i answer this question?

- 0of 0 votes
How to convert http to https in java....can anyone knows please tell me?

- 0of 0 votes
`public class Gen { public static void main(String[] args) { Integer i1 = new Integer(1); Integer i2 = new Integer(1); System.out.println(i1 != i2); System.out.println(i1 <= i2); System.out.println(i1 >= i2); } }`

WHY THE OUTPUT IS TRUE IN ALL CASES?

- 0of 0 votes
Consider an array which may contains the alphabets from A to Z.

suppose consider the below examples

A[9] = {A,C,D,G,D,E,A,C,A}; then the output should be in the format of A=3;C=2;D=2;E=1;G=1

A[9] = {A,B,D,C,D,B,A,B,A}; then the output should be in the format of A=3;B=3;C=1;D=2

write the logic in C. the values in array may vary. the output should count the alphabets in the array

- 0of 0 votes
Suppose an array contains below values

A = {A,B,C,B,A,C,A,B,C,A} then the output should display in the below format

A=4;B=3;C=3

Could you please send the logic for the above question in C ?

- 0of 0 votes
quicksort using divide and counquer . Need code please java

- -2of 2 votes
The bin packing problem is an example of a wide set of problems. The task is to find how many set sized bins are required to hold a number of differently sized boxes. How many bins (10 units high) are required to contain the following boxes (1,3,4 and 5 units high)?

- 0of 0 votes
Write a program to calculate the Loan Balance, where a person borrows an amount A and in return he/she agrees to make N payments per year, each of amount P. While the person is repaying the loan, interest will accumulate at an annual percentage rate of R, and this interest will be compounded N times a year (along with each payment). Therefore, the person must continue paying these installments of amount P until the original amount and any accumulated interest is repaid.

NOTE: The formula to calculate the amount that the person needs to repay after T years is -

Balance Amount after T years = A[(1+R/N)^NT]-P

- 0of 0 votes
Given a list L of integers, a1 , a2 , . . . , an , and an integer M , describe an algorithm that finds the largest

subset of L whose sum is at most M . Your algorithm should run in linear time

- 0of 0 votes
`int[] array = {3,-1,-2,2,2,3,2,-6,2,3,-8,0,2}; out put needed : {3,2,2,3,2,2,3,0,2,-1,-2,-6,-8} order is maintained and -ve numbers are sent to rightmost in order.`

Design a code with single iteration to do it.

- 0of 0 votes
How will you find out size of a variable without using sizeof ();

- 0of 0 votes
what does the yeild method do in case of a thread lifecycle ? Explain with a neat example demonstrating the use of yield method?

- 0of 0 votes
`c++`

- 0of 0 votes
find all the subset of an array having integers from 1 to 9 such that sum of each subset is 10.

- 0of 0 votes
You are given an array say

5,4,2,7,9,6

You need to convert it to a sorted array in minimum operation where only operation allowed is decrement.

For example above array becomes

2,2,2,6,6,6 (operations=9)

- 0of 0 votes
what is the maximum number of binary trees that can be formed using 3 unlabeled nodes ? explain..

- 0of 0 votes
Given two integers A & B. Determine how many bits required to convert A to B. Write a function

int BitSwapReqd(int A, int B);

- 0of 0 votes
write a program to check if the tree is BST

- 0of 0 votes
Write a program to generate a mirror (copy) of the binary tree without using recursion.

- 0of 0 votes
There are 3 societies a, b, and c. A lent tractors to B and C as many as they had. After some time B gave as many tractors to A and C as many as they have. After sometime c did the same thing. At the end of this transaction each one of them had 24.

Find the tractors each originally had.

- 0of 0 votes
Three friends divided some bullets equally. After all of them shot 4 bullets the total no. of remaining bullets is equal to that of one has after division. Find the original number divided.

- 0of 0 votes
Write an algo to exchange the elements of secondary digonal of a matrix.

- 0of 0 votes
How many ways can you paint a cube if you have three colors of paint?

- 0of 0 votes
What is the benefit of using StringBuffer?

- 0of 0 votes
What log file can you refer to for determining if a JUnit test failed?

- 0of 0 votes
How does Struts implement MVC?

- 0of 0 votes
In Java, if we insert a return statement inside the try block of a try-catch-finally, will the finally block still get executed?

- 0of 0 votes
Other questions as came up during the conversation ... total of 45 minutes on the phone. Informed me that HR will be in touch for a 2nd technical interview.