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 (2254)
 C++ interview questions  C++ Interview Questions (1111)
 VC++ interview questions  VC++ Interview Questions (342)
 Delphi interview questions  Delphi Interview Questions (510)
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions (646)
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 ?    20 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 ?    11 Yes 17 No
Nadeem Khokhar
 
 
 

 
 
 
Other Programming Languages AllOther Interview Questions
 
  Question Asked @ Answers
 
plz send me NIC Scientific Officer /Engineer-SB(Programmer) previous question paper or syllabus NIC 2
what is the difference between a looping statement and a decision statement   2
how we can call xml file in java file using Android platform? TCS 2
if we want to move all the items that are already added in a combobox into an empty list box or vice-versa then how can it possible in vb or C# ?   1
Diff between %let and Call symput? Accenture 1
Corillian's product is a "Component Container." Name at least 3 component   1
preorder of A*(B+C)/D-G BFL 6
two MIT math grads bump into each other at Fairway on the upper west side. they haven't seen each other in over 20 years. the first grad says to the second: "how have you been?" second: "great! i got married and i have three daughters now" first: "really? how old are they?" second: "well, the product of their ages is 72, and the sum of their ages is the same as the number on that building over there.." first: "right, ok.. oh wait.. hmm, i still don't know" second: "oh sorry, the oldest one just started to play the piano" first: "wonderful! my oldest is the same age!" problem: how old are the daughters?   1
WHAT IS NV RAM ?   3
What is the difference b/w Object base and object oriented programming?   1
what is different betweet class and interface in java? Sun-Microsystems 2
What is the difference between CriteriaQuery and CreateQuery in Hibernate???? Thanks in advance!!!!!! Accenture 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