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                      
tip   SiteMap shows list of All Categories in this site.
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
if array a conatins 'n' elements and array b conatins 'n-1' 
elements.array b has all element which are present in array 
a but one element is missing in array b. find that 
element.
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: if array a conatins 'n' elements and array b conatins 'n-1' elements.array b has all element which are present in array a but one element is missing in array b. find that element.
Answer
# 1
a[0]
 
Is This Answer Correct ?    1 Yes 15 No
Guest
 
  Re: if array a conatins 'n' elements and array b conatins 'n-1' elements.array b has all element which are present in array a but one element is missing in array b. find that element.
Answer
# 2
It is not true that there is a[0] missing.
Because as per my knowledge array is starting from a[0] and
running up to a[n] continuously.
But if my ans is wrong then sorry and please send me right ans.
 
Is This Answer Correct ?    1 Yes 6 No
Bhavik
 
 
 
  Re: if array a conatins 'n' elements and array b conatins 'n-1' elements.array b has all element which are present in array a but one element is missing in array b. find that element.
Answer
# 3
define one variable say t_max and save a[0] in that,loop 
through it, if a[1] is grater than a[0] save a[1] in t_max 
otherwisw a[0] remain as it is....check it same way for all 
elemnts in array...finally t_max will hold max elemnt from 
array.
 
Is This Answer Correct ?    2 Yes 5 No
Rahul
 
  Re: if array a conatins 'n' elements and array b conatins 'n-1' elements.array b has all element which are present in array a but one element is missing in array b. find that element.
Answer
# 4
firt do sum of n elements in first array a i.e., n(n+1)/2
next the sum of n-1 elements in second array b i.e., n(n-1)/2...
from diff of these 2 sums we will get the missing element in b
 
Is This Answer Correct ?    13 Yes 3 No
Sumanth
 
  Re: if array a conatins 'n' elements and array b conatins 'n-1' elements.array b has all element which are present in array a but one element is missing in array b. find that element.
Answer
# 5
add the sum of elements in array a and then that of array 
b.. subtract the sums of the two arrays a and b. ul get the 
missing element
 
Is This Answer Correct ?    17 Yes 0 No
Nikita
 
  Re: if array a conatins 'n' elements and array b conatins 'n-1' elements.array b has all element which are present in array a but one element is missing in array b. find that element.
Answer
# 6
The answers are only applicable to array of numbers.. what 
if the array is of strings..?
 
Is This Answer Correct ?    2 Yes 0 No
Rasika
 
  Re: if array a conatins 'n' elements and array b conatins 'n-1' elements.array b has all element which are present in array a but one element is missing in array b. find that element.
Answer
# 7
a[n] is missing in b bcoz a contains n,(n-1),(n-2)....
and b contains n-1,n-2,.....so hear n is missing
 
Is This Answer Correct ?    0 Yes 5 No
Navs
 
  Re: if array a conatins 'n' elements and array b conatins 'n-1' elements.array b has all element which are present in array a but one element is missing in array b. find that element.
Answer
# 8
the question says that we have to find the element which is
not there in array b but there in array a. So we can just
compare each element in a with all the elements in b and if
we don't find a match then that is the desired element.
 
Is This Answer Correct ?    3 Yes 1 No
Brijesh
 
  Re: if array a conatins 'n' elements and array b conatins 'n-1' elements.array b has all element which are present in array a but one element is missing in array b. find that element.
Answer
# 9
Take a temp variable of datatype of the array element.
Place a[0] in temp.

now for each element in array a compare with all elements 
of array b. if any element is not found in array b, that is 
the missing element.

what i guess though is that the interviewer may be trying 
to look for a short-cut method to achieve the above. So, i 
googled it and found a very nice answer:
http://stackoverflow.com/questions/1235033/java-comparing-
two-string-arrays-and-removing-elements-that-exist-in-both-
arrays
 
Is This Answer Correct ?    0 Yes 0 No
Ajay C.
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
dynamically allocate memory for linear array of n integers,store some elements in it and find some of them  1
write a C code To reverse a linked list Motorola2
can we write a program in c for printf and scanf without using header file stdio.h  1
what is the output? #define fun(a,b,t) (g ##t=(a),(a)=(b),(b)=g##t) float gfloat; main() { float a=1.12,b=3.14; fun (a,b,float); printf("na=%4.2f,b=%4.2f",a,b); } A)Error in Defining Macro B)a=1.12,b=3.14 C)a=3.14,b=1.12 D)None of the Above Accenture2
How can we open a file in Binary mode and Text mode?what is the difference? PanTerra1
#include <stdio.h> #define sqr(x) (x*x) int main() { int x=2; printf("value of x=%d",sqr(x+1)); } What is the value of x? Oracle13
how to find that no is int or float?  5
How would you write qsort?  1
Which of the following is not an infinite loop ? a.while(1){ .... } b.for(;;){ ... } c.x=0; do{ /*x unaltered within theloop*/ ... }while(x==0); d.# define TRUE 0 ... while(TRUE){ .... } TCS4
for example user gives input as " 20 or 20.0 or rs 20.0 or 20.00 or rs20 and so .. on " and the output should be stored as " rs.20.00 " in a variable  2
CAN WE DEFINE ANY FUNCTION WITHIN A FUNCTION.  6
how to create c progarm without void main()?  1
program to find the roots of a quardratic equation  1
Can we write a program without main() function?  9
Look at the Code: #include<string.h> void main() { char s1[]="abcd"; char s2[10]; char s3[]="efgh"; int i; clrscr(); i=strcmp(strcat(s3,ctrcpy(s2,s1))strcat(s3,"abcd")); printf("%d",i); } What will be the output? A)No output B) A Non Integer C)0 D) Garbage Accenture5
which header file contains main() function in c? TCS3
how to impliment 2 or more stacks in a single dimensional array ? iFlex1
Which of the following about the C comments is incorrect ? a.commentscan go over multiple lines b.comments can start any where in the line c.a line can contain comments with out any language statements d.comments can occur within comments TCS6
write an algorithm to get a sentence and reverse it in the following format: input : I am here opuput: Here Am I note: first letter of every word is capiatlised  2
Who had beaten up hooligan "CHAKULI" in his early college days?  1
 
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