# Zoho interview Quest

UvarajS
Zoho interview Quest
5 Answer(s)      4 years and 2 months ago
Posted in : Java Interview Questions

Input array 1,2,3,4,5,6 Output 1,3,5,0,0,0 Remove even nos and fill it with zeros U can use only one loop for ur logic Two variables apart from the array.

June 2, 2013 at 7:04 PM

Try the following code friend may, this will be helpful for you.

```class RemoveEvenNumber
{
int a[] = new int[]{1,2,3,4,5,6};
int b [] = new int[a.length];

public void removeEvenNumber()
{
int i = 0;
while(i< a.length)
{
if(a[i] % 2 == 0)
{
a[i]=0;
}
else if(a[i] % 2== 1)
{
b[i]=a[i];
}
System.out.print(b[i]+",");
i++;
}
}

public static void main(String args[])
{
RemoveEvenNumber remove = new RemoveEvenNumber();
remove.removeEvenNumber();
}
}
```

June 3, 2013 at 11:40 AM

Here is the program :

```import java.util.Scanner;

/**
* @author JavaWithUs
* www.javawithus.com
*/
public class RemoveEvenNumbers {

public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("Enter length of array: ");
int[] arr = new int[s.nextInt()];
System.out.println("Enter elements:");
for (int i = 0; i < arr.length; i++) {
arr[i] = s.nextInt();
}
int numberOfZeroes = 0;
for (int i = 0; i < arr.length; i++) {
if (arr[i] % 2 == 0) {
arr[i] = 0;
numberOfZeroes++;
}
}
System.out.println("Modified array:");

for (int i = 0; i < arr.length; i++) {
if (arr[i] != 0) {
System.out.print(arr[i] + " ");
}
}
for (int i = 0; i < numberOfZeroes; i++) {
System.out.print("0 ");
}
}
}
```

Here is the output :

```Enter length of array:
6
Enter elements:
1 2 3 4 5 6
Modified array:
1 3 5 0 0 0
```

To learn about arrays, see these pages :

August 11, 2013 at 7:43 AM

public class Evenodd {

```public static void main(String[] args) {
```

int g=0,i; int a[ ]={1,2,3,4,5,6}; int n=a.length; for(i=0;i

August 25, 2013 at 1:48 AM

/*

One Loop and two variables are used. Runtime o(n*n)

*/

public class OneLoopTwoVariables {

```public static void main(String x[])
{

int xArray[]={1,2,3,4,5,6,7};
int xCnt=0,xTmp=0;

for(int i=0;i<xArray.length;i++)
{

if(xCnt==0 )
{

if(xArray[i]%2 == 0)
{
xArray[i]=0;
}

}

else if(xCnt == (xArray.length * xArray.length))
{
System.out.print(xArray[i]);
}

else

{
if(xArray[i] == 0)
{
if(i+1 != xArray.length)
{
xTmp = xArray[i+1];
xArray[i+1] = 0;
xArray[i] = xTmp;
}
}
}

if(i == xArray.length-1) {

i=-1;
xCnt+=1;

if(xCnt == (xArray.length * xArray.length)+1){ break; }

}

}

}
```

}

October 29, 2013 at 3:43 PM

private int[] a = { 1, 2, 3, 4, 5, 6 };

```private void removeEven()
{
for (int i = 0; i < a.length; i++)
{
if (a[i] == 0 || a[i] % 2 == 0)
{
traverseArray(i);
}
System.out.print(a[i]);

if (i != a.length - 1)
System.out.print(", ");
}
}

private void traverseArray(int i)
{
if (i != a.length - 1)
{
a[i] = a[i + 1];
a[i + 1] = 0;

traverseArray(i + 1);
}
}
```

Zoho interview Quest
Zoho interview Quest  Given a string , you have to predict whether it can be changed into a palindrome or not by changing the positions of the characters Eg. Tests Yes Explanation:tests can be changed to tsest or stets
Zoho interview Quest
Zoho interview Quest  Print the pattern N=4 4444444 4333334 4322234 4321234 4322234 4333334 4444444 N=3 33333 32223 32123 32223 33333
Zoho interview Quest
Zoho interview Quest  Input array 1,2,3,4,5,6 Output 1,3,5,0,0,0 Remove even nos and fill it with zeros U can use only one loop for ur logic Two variables apart from the array.   Try the following code friend may
Zoho Writer
Zoho Writer       Zoho Writer is a web-based word processor currently in beta. It is much like Writely. Zoho Writer Zoho Writer is the component of Zoho's Online Office
interview - Java Interview Questions
interview  kindly guide me some interview questions of Java
Interview Que
Interview Que  I want to Java Interview Questions   Please visit the following link: Java Interview Questions
Interview Question - Java Interview Questions
Interview Question  I need Interview Questions on Java,J2EE Pls help me
interview questions - Java Interview Questions
interview questions for Java  Hi Any one can u please post the interview point of questions.Warm Regards, Satish
Interview question
Interview question - Java Interview Questions
Interview question   Hi Friends, Give me details abt synchronization in interview point of view. I mean ow to explain short and neat. Thanks
Interview Tips - Java Interview Questions
Interview Tips  Hi, I am looking for a job in java/j2ee.plz give me interview tips. i mean topics which i should be strong and how to prepare. Looking for a job 3.5yrs experience
tech. interview
tech. interview   java support round robin algo. if yes why? and if no why
Interview question - JSP-Interview Questions
Interview question   Hi Friend, Can we inherit interface in JSP. Thank u in advance
java interview question and answer - Java Interview Questions
java interview question and answer   sir, i want one mark java interview question and answers
interview question - Java Interview Questions
interview question  hello i want technical interview question in current year   Hi Friend, Please visit the following links: http://www.roseindia.net/interviewquestions/ http://www.roseindia.net
interview question - Servlet Interview Questions
interview question  What is Servlet? Need interview questions on Java... and HTTP Servlet.While going through an interview you could be asked for number... according to your experience.And for collection of Java Servlet Interview Question you
Client Interview
Client Interview  Hi, I am kumar i am having client round in polaries client is a BANK. how to face client interview. what are the expected questions from CITI
java interview - JSP-Interview Questions
java interview  what type of questions would be asked to a 3 years experience person in java? can anyone please provide list of topics or interview questions for 3 years experience in java
java - Java Interview Questions
Jsp - Java Interview Questions
Need JSP Interview Questions  Hi, I need JSP interview questions.Thanks
struts interview Question - Struts
struts interview question and answer java  struts interview question and answer java
Java Interview Questions
Java Interview Questions  Hi, Can anyone tell the urls of Java Interview Questions on roseindia.net? Thanks
Struts - Java Interview Questions
Struts Interview Questions  I need Java Struts Interview Questions and examples