Pregunta de entrevista de Zoho

aptitude are from number series and mixtures, C,C++ are from pointers Java from Threads, In programming round they asked, Program to print matrix in spiral form, Program to reverse vowels alone in a given string program to push all zeros to right side in an array and order should be maintained program to print name in a list like below if list contains 10-20 strings and if input is like c*i o/p should print all string in a list contains words starting with 'c' and ending with 'i' eg: list = [chennai, covai, madurai, delhi, dubai, mumbai] then if i/p = c*i o/p-->> chennai, covai if i/p = d*i o/p --->> dubai, delhi

Respuestas de entrevistas

Anónimo

26 feb 2019

/* if list contains 10-20 strings and if input is like c*i o/p should print all string in a list contains words starting with 'c' and ending with 'i' eg: list = [chennai, covai, madurai, delhi, dubai, mumbai] then if i/p = c*i o/p-->> chennai, covai if i/p = d*i o/p --->> dubai, delhi */ package StringPrograms; import java.util.*; class Demo11 { public static void main(String[] args) { List l= new ArrayList(); l.add("chennai"); l.add("covai"); l.add("madurai"); l.add("delhi"); l.add("dubai"); l.add("mumbai"); System.out.println("Enter the pattern"); Scanner cn = new Scanner(System.in); String input=cn.nextLine(); String[] patternElements = input.split("\\*"); Iterator itr=l.iterator(); while(itr.hasNext()) { String element=(String)itr.next(); if(element.startsWith(patternElements[0])&&element.endsWith(patternElements[1])) { System.out.println(element); } } } } /* run: Enter the pattern m*i madurai mumbai BUILD SUCCESSFUL (total time: 3 seconds) */

2

Anónimo

26 feb 2019

// Pgm to push 0 to right keeping order package StringPrograms; class Demo9 { public static void main(String[] args) { String str=""; int diffLength; int length; int length1; int[] elements={3,4,5,6,2,3,0,9,0,9,0}; for(int i: elements) { str=str+i; } length=str.length(); String str1= str.replaceAll("0", ""); length1=str1.length(); diffLength=length-length1; for(int i =0;i

Anónimo

26 feb 2019

// Pgm to push 0 to right keeping order package StringPrograms; class Demo9 { public static void main(String[] args) { String str=""; int diffLength; int length; int length1; int[] elements={3,4,5,6,2,3,0,9,0,9,0}; for(int i: elements) { str=str+i; } length=str.length(); String str1= str.replaceAll("0", ""); length1=str1.length(); diffLength=length-length1; for(int i =0;i

Anónimo

26 feb 2019

/* /* Program to reverse vowels alone in a given string ==================================================== Given a string, your task is to reverse only the vowels of string. Examples: Input : hello Output : holle Input : hello world Output : hollo werld */ */ package StringPrograms; class Driver { public static void main(String[] args) { String str = ""; String input = "hello world"; String indexPos = ""; int position; char value; for (int i = 0; i = 0 && j < indexPos.length()); j++, i--) { position = Integer.parseInt(Character.valueOf(indexPos.charAt(j)).toString()); value = vowels[i]; input2.setCharAt(position, value); } System.out.println(input2); } } /* run: hollo werld BUILD SUCCESSFUL (total time: 0 seconds) */