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 (2253)
 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
 
what is the abap/4   1
Expand the following a) ISDN b) CASE c) CSMA/CD d) OOPS e) MIMD Cts 4
What Is The Difeerence Between C & C++ HCL 2
merge sort time complexity BFL 6
When you?re running a component within ASP.NET, what process is it running within on Windows XP? Windows 2000? Windows 2003?   1
How can successful and thorough systems planning, analysis, and design be ruined by poor systems construction and implementation? How can poor systems analysis or design ruin a smooth construction and implementation? For both questions, list some consequences   1
Given three sides of a triangle. Write the Program to determine whether the triangle is : 1) Invalid 2) Right Angled 3) Isoscales 4) Equilateral 5) Not Special An Isoscales right angled triangle should be taken as a Right Angled Triangle Goldman-Sachs 3
what are wrapper classes   2
How to use string functions in QTP?give some examples   1
what is microprocessor? HCL 1
what is the purpose of postback? Nth-Solution 2
i want to open a helkp file that is txt file on link buttons click   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