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                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
Google
 
Categories  >>  Code Snippets  >>  Programming Code  >>  C Code
 
 


 

 
 C Code interview questions  C Code Interview Questions
 C++ Code interview questions  C++ Code Interview Questions
 VC++ Code interview questions  VC++ Code Interview Questions
 Java Code interview questions  Java Code Interview Questions
 Dot Net Code interview questions  Dot Net Code Interview Questions
 Visual Basic Code interview questions  Visual Basic Code Interview Questions
 Programming Code AllOther interview questions  Programming Code AllOther Interview Questions
Question
Write a C function to search a number in the given list of
numbers. donot use printf and scanf
 Question Submitted By :: Karthik
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Write a C function to search a number in the given list of numbers. donot use printf and scanf
Answer
# 1
void search(int data)
{
 for(int i=0;i<n;i++)
  {
   if(a[i]==data)
     break;
  }
}
 
Is This Answer Correct ?    3 Yes 3 No
Bharghavi
 
  Re: Write a C function to search a number in the given list of numbers. donot use printf and scanf
Answer
# 2
void search(int *a,int data,int n)
{
 for(int i=0;i<n;i++)
  {
   if(a[i]==data)
     break;
  }
}
 
Is This Answer Correct ?    1 Yes 2 No
Rohitakhilesh
 
 
 
  Re: Write a C function to search a number in the given list of numbers. donot use printf and scanf
Answer
# 3
the below function return the index value if present else 
return a index which is equal to n;



int search(int n,int data,int *a)
{
  int i;
     for(i=0;i<n;i++)
     if(a[i]==data)
      return i;
}
 
Is This Answer Correct ?    1 Yes 1 No
DinakaranGct
[GCT College]
 
  Re: Write a C function to search a number in the given list of numbers. donot use printf and scanf
Answer
# 4
Once the list of integer was sorted, u can use binary search.
 
Is This Answer Correct ?    0 Yes 3 No
Peter
 

 
 
 
Other C Code Interview Questions
 
  Question Asked @ Answers
 
how to return a multiple value from a function? Wipro2
main() { int i=-1; -i; printf("i = %d, -i = %d \n",i,-i); }  1
write a program to Insert in a sorted list Microsoft4
Program to find the largest sum of contiguous integers in the array. O(n)  7
main() { if ((1||0) && (0||1)) { printf("OK I am done."); } else { printf("OK I am gone."); } } a. OK I am done b. OK I am gone c. compile error d. none of the above HCL1
Derive expression for converting RGB color parameters to HSV values  1
main() { while (strcmp(“some”,”some\0”)) printf(“Strings are not equal\n”); }  1
main() { extern out; printf("%d", out); } int out=100;  1
Is the following code legal? void main() { typedef struct a aType; aType someVariable; struct a { int x; aType *b; }; }  1
#ifdef something int some=0; #endif main() { int thing = 0; printf("%d %d\n", some ,thing); }  1
Is there any difference between the two declarations, 1. int foo(int *arr[]) and 2. int foo(int *arr[2])  1
How to swap two variables, without using third variable ? HCL47
main() { int a=2,*f1,*f2; f1=f2=&a; *f2+=*f2+=a+=2.5; printf("\n%d %d %d",a,*f1,*f2); }  1
How to return multiple values from a function?  4
main() { float i=1.5; switch(i) { case 1: printf("1"); case 2: printf("2"); default : printf("0"); } }  1
main() { char not; not=!2; printf("%d",not); }  1
main() { char *p = “ayqm”; printf(“%c”,++*(p++)); } TCS2
struct Foo { char *pName; char *pAddress; }; main() { struct Foo *obj = malloc(sizeof(struct Foo)); clrscr(); obj->pName = malloc(100); obj->pAddress = malloc(100); strcpy(obj->pName,"Your Name"); strcpy(obj->pAddress, "Your Address"); free(obj); printf("%s", obj->pName); printf("%s", obj->pAddress); } a. Your Name, Your Address b. Your Address, Your Address c. Your Name Your Name d. None of the above HCL1
In the following pgm add a stmt in the function fun such that the address of 'a' gets stored in 'j'. main(){ int * j; void fun(int **); fun(&j); } void fun(int **k) { int a =0; /* add a stmt here*/ }  1
main() { char *p; p="Hello"; printf("%c\n",*&*p); }  1
 
For more C Code 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