Find jobs for senior java developer

Senior java developer Interview Questions in India

3K

Senior Java Developer interview questions shared by candidates

Top Interview Questions

Sort: Relevance|Popular|Date
Atlassian
Senior Java Developer was asked...13 April 2016

A company uses a format to exchange messages with us. You need to validate the input. The character encoding ASCII. Valid characters are between 0x20 (space) and 0x7E (~). write validate function to generate valid output or the error message.

9 Answers

public static void printValidMassage(){ String msg="204a6176617e"; String msg1=convertHextoChars(msg); boolean isValid=(msg1.startsWith(" ") && msg1.endsWith("~")) ? true : false; } private static String convertHextoChars(String hex) { StringBuffer sb = new StringBuffer(); for (int i=0; i Less

public static void printValidMassage(){ String msg="204a6176617e"; String msg1=convertHextoChars(msg); boolean isValid=(msg1.startsWith(" ") && msg1.endsWith("~")) ? true : false; System.out.println(isValid); } private static String convertHextoChars(String hex) { StringBuffer sb = new StringBuffer(); for (int i=0; i Less

for (int i=0; i

Show More Responses
Morgan Stanley

Core Java questions & this person was also not aware about the immutability concept properly except what is given on internet. I had to teach him the immutability of class & object, else for this person both are same.

6 Answers

This also happened to me, the guy who was taking an interview (Bharat Bhagat) told me that he will not use video since he is having poor internet connection. Initially I thought he is genuine, but when my interview started with basic java stuff and I answered him with granular level details he fainted and he started googling the questions. He was not capable and not having enough knowledge which I came to know on his cross questioning. He asked me question on data structure and he was not aware about Heap data structure. He never came back with the feedback. Later on, I checked his profile on LinkedIn and found he kept on changing firm every year. Less

Many companies are doing the same either companies are just giving illusion to people that they are hiring or the incompetent interviewers are not selecting any worthy candidate for the safety of their own job. In short, all seems to be a kind of fraud going on in name of hiring. Less

I had the same experience. I was supposed to be interviewed by some Morgan Stanley person on 16th April 2020, then this Morgan Stanley person called me to reschedule the call. Then in evening, this person never showed his face in video conference & he also didn't seem to have proper technical understanding. I think his name was 'Dhaval' & I don't feel that he will select any person more capable. Less

Show More Responses
Veeva Systems

public class Person { Person father; Person mother; Gender gender; Integer age; List<Person> children; int level = 0; public enum Gender { Male, Female; } } For the above class, you basically have to implement 2 methods. public List<Person> getOldestSisters() public List<Person> getGreatestAncestors()

5 Answers

/** * Returns the Persons which are the greatest number of levels up the family tree * from this instance. Examples: * Given a tree where this person instance only has a mother and father, return mother and father. * Given a tree where this person instance has a mother &amp; father, and a grandfather on the mother's side, return only the grandfather on the mother's side. * @return List of Person */ public List getGreatestAncestors() { // If this is the root of the tree, return empty array because there is no ancestor for the tree if (this.father == null &amp;&amp; this.mother == null) { return new ArrayList(); } List fList = new ArrayList(); List mList = new ArrayList(); if (this.father != null) { fList = this.father.getGreatestAncestors(); } if (this.mother != null) { mList = this.mother.getGreatestAncestors(); } List results = new ArrayList(); for (Person p : fList) { if (results.contains(p)){ continue; } results.add(p); } for (Person p : mList) { if (results.contains(p)){ continue; } results.add(p); } return results; } Less

What do they expect in onsite interview for senior software engineer for app development Less

I cranked this out in about 30 minutes. I believe it works quite well. I've also included the corresponding unit tests: file: Person.java ------------------------------------------------------------------------------------------------------------- package Command; import java.util.ArrayList; import java.util.HashSet; import java.util.List; public class Person { Person father; Person mother; Gender gender; Integer age; List children; int level = 0; public enum Gender { Male, Female; } Person(Person dad, Person mom, Gender gender, int age, int level) { this.father = dad; this.mother = mom; this.gender = gender; this.age = age; this.level = level; } public void setChildren(List children) { this.children = children; } public void addChild(Person child) { this.children.add(child); } public List getOldestSisters () { // given the current person (self), determine parents // then get children of those parents // Determine gender of each child // Where they are female, get ages // return females with age &gt; mine // Note: must check on both sides father/mother as there may be a mixed marriage // Combine list of children - Exclude YOU as you cannot be your own sister. // Use a set to eliminate duplicates. HashSet allChildren = new HashSet(); // Can't add null to a hashSet so screen for it. if ((father != null) &amp;&amp; (father.children != null)){ allChildren.addAll(father.children); } if ((mother != null) &amp;&amp; (mother.children != null)) { allChildren.addAll(mother.children); } // If you are not in this list, there is an issue! if (allChildren.contains(this)) { allChildren.remove(this); // System.out.println("Removing self from list."); } else { System.out.println("Error: You are not a child of your parents! Adopted?"); } // Filter down to only women and get any older than me: int myAge = this.age; List oldestSisters = new ArrayList(); for (Person child : allChildren) { if (child.gender == Gender.Female) { if (child.age &gt; myAge) { oldestSisters.add(child); } } } return oldestSisters; } public List getGreatestAncestors() { if ((this.father == null) || (this.mother == null)) { return null; // You must have two parents to have ancestors } // Find root parents List myParents = getParents(this); return getElders(myParents); } private List getElders(List parents) { List elders = new ArrayList(); List myParents = new ArrayList(); boolean newElders = false; for (Person parent : parents) { myParents = getParents(parent); if (myParents.isEmpty()) { elders.add(parent); } else { elders.addAll(myParents); newElders = true; } } if (newElders == true) { return getElders(elders); } return elders; } private List getParents(Person person) { List parents = new ArrayList(); if (person.father != null) parents.add(person.father); if (person.mother != null) parents.add(person.mother); return parents; } } // For the above class, you basically have to implement 2 methods. // public List getOldestSisters() // public List getGreatestAncestors() Less

Show More Responses
Wallet Hub

Write Java code to check if a string is a palindrome.

4 Answers

public class Palindrom { final Logger logger = LoggerFactory.getLogger(this.getClass().getName()); public boolean isPalindrom(String source) { int length = source.length(); String reverse = ""; for (int i = length - 1; i &gt;= 0; i--) { reverse = reverse + source.charAt(i); } return source.equals(reverse); } } Less

public static void main(String[] args) { String[] arrPalindrom = new String[]{"test","tsest","view", "viv"}; for(String item: arrPalindrom) System.out.println(item + " is " + (isItemPalindrom(item)?"palindrom": "not palindrom")); } static boolean isItemPalindrom(String str){ if(str.equals(new StringBuilder(str).reverse().toString())){ return true; } return false; } Less

static boolean isPalindrome(String str){ boolean success=true; s=s.toLowerCase(); for(int i=0;i Less

Show More Responses
ADP

Write a query to get the required data regarding employees.

4 Answers

You can use &amp; modify below query - select e.ename, dep.loc from emp e, (select d.deptno, d.dname, d.loc from dept d, (select deptno dno, count(*) ct from emp group by deptno order by deptno desc) dn where rownum = 1 and dn.dno = d.deptno) dep where e.deptno = dep.deptno order by e.ename; Less

I think query will be like given below. Check or change a bit for your requirements. select EMP.ENAME, lc.LOCNAME from employee emp, company org, location lc where emp.cID = ORG.CID and org.locID = lc.locID and lc.locID in ( select place.locID from ( select loc.locID, count(*) ct from employee e, company c, location loc where e.cID = c.cID and c.locID = loc.locID group by loc.locID order by ct desc) place where rownum = 1); Enjoy :) Less

These people in ADP have been in such a comfort zone that they don't like to pick more capable people who can challenge their capability disturbing their comfort zone &amp; rest who cares about the profits of the company till the time salary is getting credited in the account with less or no work. So continue to show-off &amp; keep capable people away. Less

Show More Responses
Acuitus

A rustic village contains one million married couples and no children. Each couple has exactly one child per year. Each couple wants a girl, but also wants to minimize the number of children they have, so they will continue to have children until they have their first girl. Assume that children are equally likely to be born male or female. Let p(t) be the percentage of children that are female at the end of year t. What is p(t)? "Can't tell" is a potential answer if you don't have sufficient information.

4 Answers

p(t) = 50% at all years (with some rounding) P(1) = 1,000,000 children, 500,000 of them girls, 500,000 of them boys P(2) = 500,000 more children (only those who had boys have another child), 250,000 girls, 250,000 boys so overall, there are now 750,000 girls, and 750,000 boys P(3) = 250,000 more children, 125,000 girls, 125,000 boys so there are now 875,000 girls (with 500,000 being only children, 250,000 having one brother, and 125,000 having 2 brothers), and 875,000 boys So, except for some rounding when the previous year's number of all boy families is an odd number, you will always have 50% of each Less

can't tell

The answer is 2^-t

Show More Responses
Plymouth Rock Assurance

Write an algorith to print a series of roman numerals.

4 Answers

public class Roman { public static void main(String args[]) { String digits[] = { "", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX" }; String prefixes[] = { "", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC", "C" }; int i = 1; System.out.println("Roman Numbers from 1 to 100: "); do { if (0 0); } } Less

public class Roman { public static void main(String args[]) { String digits[] = { "", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX" }; String prefixes[] = { "", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC", "C" }; int i = 1; System.out.println("Roman Numbers from 1 to 100: "); do { if (0 0); } } Less

do { if (0 0);

Show More Responses
ADP

Java question was around String pattern searching which you can do easily in around 20 minutes, if you can keep your mind calm where that clock is also ticking.

4 Answers

Suggestion - Give only 10-15 minutes for the MCQs then you can easily do remaining SQL &amp; Java code questions easily in remaining time. Less

Anyone looking for the exact code then leave the message.

Answers of both these questions are over internet &amp; here on Glassdoor.

Show More Responses
Atlassian

Implement a method 'find' that will find the starting index (zero based) where the second list occurs as a sub-list in the first list. It should return -1 if the sub-list cannot be found. Arguments are always given, not empty. Sample Input 1 list1 = (1, 2, 3) list2 = (2, 3) Sample Output 1 1 Explanation As second list (2, 3) is sub-list in first list (1, 2, 3) at index 1 Sample Input 2 list1 = (1, 2, 3) list2 = (3, 2) Sample Output 2 -1

4 Answers

To code in Test Driven Development(TDD).

static int find(LinkedListNode list, LinkedListNode sublist) { String listString = asString(list); String sublistString = asString(sublist); return listString.indexOf(sublistString); } static String asString(LinkedListNode l){ String s =""; while (l !=null){ s+= l.val; l = l.next; } return s; } Less

static int find(LinkedListNode list, LinkedListNode sublist) { String listString = asString(list); String sublistString = asString(sublist); return listString.indexOf(sublistString); } static String asString(LinkedListNode l){ String s =""; while (l !=null){ s+= l.val; l = l.next; } return s; } Less

Show More Responses
FREE NOW

technologies, not algorithms nor data structures

4 Answers

How long it took to receive their process termination email. Was it right away or they took some time to respond? Less

2-3 days

What kind of questions they ask on the technical review of your solution? Best Regards Less

Show More Responses
Viewing 1 - 10 of 3,253 Interview Questions