Search Interview Questions | More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know. |
|
| |||||||||||
Interview Questions and Answers - Order By Newest | |||||||||||
| |||||||||||
This question was recently asked at 'Amazon'.This question is still unanswered. Can you please provide an answer. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  code  coding Asked in 1 Companies | |||||||||||
| |||||||||||
Ans. int compare(int a, int b) { a>b? return a: return b; } | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  code  program  coding Asked in 1 Companies basic | |||||||||||
| |||||||||||
This question was recently asked at 'Ola Cabs'.This question is still unanswered. Can you please provide an answer. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  program  code  coding  insertion sort   sort Asked in 1 Companies | |||||||||||
| |||||||||||
This question was recently asked at 'HCL Tech'.This question is still unanswered. Can you please provide an answer. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  coding  code Asked in 1 Companies | |||||||||||
| |||||||||||
Ans. LocalDate today = LocalDate.now(); LocalDate birthday = LocalDate.of(1960, Month.JANUARY, 1); Period p = Period.between(birthday, today); //Now access the values as below System.out.println(period.getDays()); System.out.println(period.getMonths()); System.out.println(period.getYears()); | |||||||||||
Sample Code for LocalDate Sample Code for Period | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  coding  code  date  LocalDate  Period Asked in 1 Companies | |||||||||||
| |||||||||||
Ans. false false | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  object equality  ==  coding  code Asked in 1 Companies | |||||||||||
| |||||||||||
This question is still unanswered. Can you please provide an answer. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  code  coding  duck number | |||||||||||
| |||||||||||
This question was recently asked at 'datalake solutions'.This question is still unanswered. Can you please provide an answer. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  string manipulation  code  coding Asked in 1 Companies | |||||||||||
| |||||||||||
Ans. public static String findStep(int n) { if (n == 1 || n == 0) return 1; else if (n == 2) return 2; else return findStep(n - 3) + findStep(n - 2) + findStep(n - 1); } | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  coding Asked in 1 Companies | |||||||||||
| |||||||||||
This question was recently asked at 'Amazon'.This question is still unanswered. Can you please provide an answer. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  arrays  coding  code Asked in 1 Companies | |||||||||||
| |||||||||||
This question was recently asked at 'Deutsche Bank'.This question is still unanswered. Can you please provide an answer. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  hashmap  coding Asked in 1 Companies advanced | |||||||||||
| |||||||||||
Ans. import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class FileUtility { public static void main(String[] args) { System.out.println(printFile("/home/userme/notes")); } private static int printFile(String filePath) { int wordCount = 0; try (BufferedReader br = new BufferedReader(new FileReader(filePath))) { String line = null; String[] wordsArray = null; while ((line = br.readLine()) != null) { wordsArray = line.split(" "); wordCount = wordsArray.length; } } catch (IOException e) { e.printStackTrace(); } return wordCount; } } | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  code  coding Asked in 2 Companies | |||||||||||
| |||||||||||
Ans. String str = "I had been saying that he had been there"; Map<String,Long> countWords = Arrays.asList(str.split(" ")).stream().filter(p->p.length() = 5).collect(Collectors.groupingBy(p->p,Collectors.counting())); System.out.println(countWords); | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  Collectors  lambda  filter  coding  java 8 | |||||||||||
| |||||||||||
This question was recently asked at 'Bristlecone,Amazon Lab126,Amazon,Microsoft,Facebook,NCR,Google'.This question is still unanswered. Can you please provide an answer. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  arrays  code  coding Asked in 7 Companies   frequent | |||||||||||
| |||||||||||
This question was recently asked at 'Bloomberg'.This question is still unanswered. Can you please provide an answer. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  code  coding  cloning  design pattern   cloning design pattern Asked in 1 Companies | |||||||||||
| |||||||||||
This question was recently asked at 'Bloomberg'.This question is still unanswered. Can you please provide an answer. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  code  coding  string Asked in 1 Companies | |||||||||||
| |||||||||||
Ans. it takes 1 to 4 bytes | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  utf  unicode  utf-8 Asked in 1 Companies | |||||||||||
| |||||||||||
This question was recently asked at 'Softenger'.This question is still unanswered. Can you please provide an answer. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  code  coding  design  string length Asked in 1 Companies basic | |||||||||||
| |||||||||||
Ans. String | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  Code  Coding  method overloading Asked in 1 Companies | |||||||||||
| |||||||||||
This question is still unanswered. Can you please provide an answer. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  encoding  encryption | |||||||||||
| |||||||||||
Ans. HTML Encoding escapes special characters in strings used in HTML documents whereas url Encoding replaces special characters with characters so that they can sent within url. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve   | |||||||||||
| |||||||||||
Ans. Yes they get html encoded. i.e instead of empty space. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve   | |||||||||||
| |||||||||||