info@meritcampus.com    +91-85006-22255
...
`

### Weekend Hack 26th Jan 2013 - 1 - Rs. 100 has these questions

Integer conversion output

What will be the output of the following program?
`class IntegerConversion{    public static void main(String args[])    {        long l = 787878;        int i = 656565;        short s = 3333;        byte b    = 111;                l = i;        i = s;        s = b;        System.out.println("l = " + l);        System.out.println("i = " + i);        System.out.println("s = " + s);        System.out.println("b = " + b);    }}`
 A. l = 656565i = 3333s = 111b = 111 B. l = 787878i = 656565s = 3333b = 111 C. l = 111i = 111s = 111b = 111 D. Program does not compile.

Find the order of stroke out letters

Write a program to find out the order of stroke out letters by counting 1, 2, 3 etc. As shown for SACHIN below, A is first cancelled out since it is 2nd (1 + 1) letter from begining, followed by I which is the 3rd letter (2 + 1) from A, followed by H which is the fourth letter (3 + 1) from A and so on. Please note that the last letter remaining should not be included in the output.
Input (Character array) Output (Character array)
['S', 'A', 'C', 'H', 'I', 'N'] `S*CHIN -> AS*CH*N -> IS*C**N -> H**C**N -> S**C*** -> NOutput = ['A', 'I', 'H', 'S', 'N']`
['G', 'A', 'N', 'G', 'U', 'L', 'Y'] ['A', 'U', 'N', 'G', 'G', 'L']
['L', 'A', 'X', 'M', 'A', 'N'] ['A', 'A', 'M', 'L', 'N']
['D', 'R', 'A', 'V', 'I', 'D'] ['R', 'I', 'V', 'D', 'D']
``` class FindStrokeOutLettersOrder {    public static void main(String s[])    {        char input[] = {'Y', 'U', 'V', 'R', 'A', 'J'};        System.out.print("The strike out order is : ");        for (char ch : getStrikeOutOrder(input)) {        System.out.print(ch + " ");        }    } public static char[] getStrikeOutOrder(char[] input) { //Write a code here to get the order of the stroke out letters. } } ```