ADP Interview Question for Developer Program Engineers


Country: United States




Comment hidden because of low score. Click to expand.
2
of 2 vote

What is an Area? Assuming that area is something like this:

class Area{
    int i, j;
    
     @Override
     public String toString(){...}
}

then the code will operate just fine. It should execute and output the following

[Area.toString() with i = 203, and j = 115]
end of function2()
203
end main

Given that you have ints i and j floating around in the OdemoA class which is unrelated to Area, that could be a problem. There's some sort of ambiguous relationship between OdemoA and Area that just isn't explained.

- zortlord July 14, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

see we can able to print the object address...tooo

- Avinash July 14, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

As long as we are unaware of the implementation of Area class, first thing it prints is the toString() of Area object, and the subsequent print statements will be :

end of function2()
203
end main

- Vinay August 14, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Let's actually format the code and see if it makes more sense:

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");
    }
}

- zortlord July 14, 2015 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More