UiPath Interview Question

Interview 1: - Abstract classes over interfaces. Why we use interfaces over abstract classes. - Given a sentence with each letter as a node of the linkedlist. Reverse the order of the words (not the word itself). "My name is Batman" -> "Batman is name my" - Zigzag level traversal of a tree.

Interview Answers

Anonymous

Mar 19, 2021

String givenString=""My name is Batman"; // output : "Batman is name my" String strArray[]=givenString.split(" "); for(int i=strArray.length()-1;i<=0;i++){ return strArray[i]+" "; }

Anonymous

Mar 19, 2021

String givenString=""My name is Batman"; // output : "Batman is name my" String strArray[]=givenString.split(" "); for(int i=strArray.length()-1;i<=0;i--){ return strArray[i]+" "; }

Anonymous

Mar 19, 2021

Final answer: String givenString="My name is Batman"; // output : "Batman is name my" String strArray[]=givenString.split(" "); int length=strArray.length-1; System.out.println("Hello World"+length); for(int i=length;i>=0;i--){ System.out.print(strArray[i]+" "); }