ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Programming Languages >> Programming Languages AllOther
 
 


 

 
 C interview questions  C Interview Questions (2265)
 C++ interview questions  C++ Interview Questions (1119)
 VC++ interview questions  VC++ Interview Questions (342)
 Delphi interview questions  Delphi Interview Questions (510)
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions (648)
Question
write a program for finding the union of two integer array
in java?
 Question Submitted By :: Programming-Languages-AllOther
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
void union(int x[],int y[])
{


int n=x.length + y.length ;
int z[]=new int[n];
int p=x.length;
for(int i=0;i<x.length;i++)
{
z[i]=x[i];
}
int j=0;
for(int i=0;i<y.length;i++)
{
for(j=0;j<x.length;j++)
{
if(y[i]!=z[j])
{
continue;
}
else
{
if(y[i]==z[j])

break;
}
}
if(j==x.length)
z[p++]=y[i];
}
 
Is This Answer Correct ?    21 Yes 20 No
Satish Kumar
 
Answer
# 2
the above mentioned code is also good one. but i m giving you an algorithm you can say, so you can get the concept and convert it into any language
int a[3]=1,2,3;
int b[3]=2,3,4;

for(int i=0; i <=2; i++)
{

for(int j=0; j<=2; j++)
{

if(a[i] == b[j])
cout<<a[i]; is a union of a and b
}
}
 
Is This Answer Correct ?    12 Yes 18 No
Nadeem Khokhar
 
 
 

 
 
 
Other Programming Languages AllOther Interview Questions
 
  Question Asked @ Answers
 
converting 41.685 to binary Hughes 1
How to print a name "ARCHANA" in any programming language Value-Labs 5
How to call static method in Java? Epoch 2
What is meant by SQL,PL/SQL,SQL PLUS? Is there any differnece between them? HSBC 2
which of the following is efficient in terms of space a. insertion sort b. quick sort c. selection d. both a and c Hughes 1
What is the maximum amount of memory any single process on Windows can address? Is this different than the maximum virtual memory for the system? How would this affect a system design?   2
how many languages .net is supporting now?   2
WHAT IS NV RAM ?   3
What is the best action a system can take when deadlock is detected   2
I would like to know which institute in hyderabad provides best ms-dot net training along with a project. I want to join immediately. please help   2
Write 5 differences between Memory Reference Instruction and Register Reference Instruction. TCS 1
what are the difference between C,C++and Java Wipro 1
 
For more Programming Languages AllOther Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com