ALLInterview.com :: Home Page KalAajKal.com
 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                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
1.write a program to merge the arrays
2.write efficient code for extracting unique elements from a
sorted list of array?
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: 1.write a program to merge the arrays 2.write efficient code for extracting unique elements from a sorted list of array?
Answer
# 1
#include<stdio.h>
#include<conio.h>
main()
{
 int a[5]={1,2,3,4,5},b[4]={-6,-7,-8,-9},i,j=0;
for(i=5;i<=5+4-1;i++)
{
     
     a[i]=b[j];
     j++;
}                     
for(i=0;i<9;i++)
printf("a[%d]=%d \t",i,a[i]);

getch();
}
 
Is This Answer Correct ?    8 Yes 18 No
Jaggu
 
  Re: 1.write a program to merge the arrays 2.write efficient code for extracting unique elements from a sorted list of array?
Answer
# 2
To merge to arrays ( Note the question has no mention of 
sorting the array elements, hence the program below just 
merges two arrays)

int array1[5] = {1,2,3,4,5};
int array2[7] = {6,7,8,9,10,11,12};
int i;
int merged[(sizeof(array1)+ sizeof(array2))/sizeof(int)];
memcpy( merged, array1, sizeof(array1));
memcpy( (merged+5), array2, sizeof(array2));

for(i=0;i<(sizeof(merged)/sizeof(int)); i++)
{
printf("%d\n",merged[i]);
}
 
Is This Answer Correct ?    9 Yes 4 No
Whyname
 
 
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice) Subex1
write a c program to check weather a particluar bit is set or not? IBM4
how to convert an char array to decimal array  3
what is the return value (status code) of exit() function.... what the arguments(integer value) passed to it means.... TCS1
please give me some tips for the selection in TCS. TCS3
how to print value of e(exp1)up to required no of digits after decimal?  1
difference between semaphores and mutex?  1
how does the C compiler interpret the following two statements p=p+x; q=q+y; a.p=p+x; q=q+y b.p=p+xq=q+y c.p=p+xq; q=q+y d.p=p+x/q=q+y TCS3
what are the difference between ANSI C and Let Us c and Turbo C LG-Soft1
Write a C program that computes the value ex by using the formula ex =1+x/1!+x2/2!+x3+3!+………….  1
Here is alphabets : abcdefgh 1) how to reverse. as hgfedcba 2) after reversal, how to group them in a pair hg fe dc ba.  2
I use turbo C which allocates 2 bytes for integers and 4 bytes for long. I tried to declare array of size 500000 of long type using the following code... long *arr; arr=(long *)(malloc)(500000 * sizeof(long)); It gives a warning that "Conversion may lose significant digits in function main"... And the resulting array size was very less around 8400 as compared to 500000. Any suggestions will be welcomed....  2
what is the use of getch() function in C program.. difference b/w getch() and getche()?? Wipro12
What is function pointer and where we will use it NetApp1
When you call malloc() to allocate memory for a local pointer, do you have to explicitly free() it?  2
Write a program to generate prime factors of a given integer?  1
what is use of loop? Infosys6
what is the differnce between AF_INET and PF_INET? Wipro2
write a c program to accept a given integer value and print its value in words  3
how to find string length wihtout using c function?  4
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com