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 | ||||
| ||||
Ans. public class Class{ public static void main(String[] args){ String str = "xyz@123.com"; if(!str.contains("@") && !str.contains(".") && (str.indexOf('.') < str.indexOf('@'))){ System.out.println("Not a Valid Email Address"); } } } | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  validate an email address  coding  code Asked in 3 Companies | ||||
| ||||
Ans. public class Class{ public static void main(String[] args){ String str = "xyz123.co@m"; if(str.indexOf('.') < str.indexOf('@')){ System.out.println("Not a Valid Email Address"); } } } | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  string  string.indexOf  coding  code | ||||
| ||||
Ans. Arrays.sort(numArray); double median; if (numArray.length % 2 == 0) median = ((double)numArray[numArray.length/2] (double)numArray[numArray.length/2 - 1])/2; else median = (double) numArray[numArray.length-1/2]; | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  coding Asked in 2 Companies | ||||
| ||||
This question was recently asked at 'karya technology'.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. https://www.geeksforgeeks.org/check-for-balanced-parentheses-in-an-expression/ | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  string  code  coding Asked in 14 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  Code  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  code  Coding Asked in 1 Companies | ||||
| ||||
This question was recently asked at 'Bind Software Innovations'.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  oding  cod Asked in 1 Companies | ||||
| ||||
This question was recently asked at 'Horizon 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  coding  code Asked in 1 Companies | ||||
| ||||
Ans. int convert(int binaryInt) { int sumValue=0; int multiple = 1; while(binaryInt > 0) { binaryDigit = binaryInt; binaryInt = binaryInt /10; sumValue = sumValue (binaryDigit * multiple); multiple = multiple * 2; } return sumValue; } | ||||
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 basic | ||||
| ||||
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 | ||||