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       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
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.find the second maximum in an array?
2.how do you create hash table in c?
3.what is hash collision
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: 1.find the second maximum in an array? 2.how do you create hash table in c? 3.what is hash collision
Answer
# 1
#include<stdio.h>
#include<conio.h>
void soft(int *,int *);
void main()
{
int a[30],n;
printf("enter the number of elements going to enter :");
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%d",a[i]);
soft(a);
printf("the second maximum in the given array is :");
getch();
}
void soft(int *a,int *n);
{
 int temp;
for(int i=0;i<(*n);i++)
  {
    for(j=0;j<(*n);j++)
       { 
         if(a[j+1]<a[j])
          {
             temp=a[j+1];
       a[j+1]=a[j];
     a[j]=temp;
}
}
}
printf("%d",a[n-1]);
}

sorry i dont know the concept of hash table!!!!!!!!!!!!!!!
 
Is This Answer Correct ?    0 Yes 4 No
Vignesh1988i
 
  Re: 1.find the second maximum in an array? 2.how do you create hash table in c? 3.what is hash collision
Answer
# 2
#include <stdio.h>

int main ( int argc, char* argv[] )
{

	int* array_int, nTotalCount = 10, sbig, big, i;
	printf ( "\n/********************** Second Biggest 
Number ********************/" );
	array_int = ( int* ) malloc ( nTotalCount * sizeof 
( int ) );

	for ( i = 0; i < nTotalCount; i++ )
		array_int [i] = rand() % 100;

	printf( "\nThe Numbers in given order" );
	for ( i = 0; i < nTotalCount; i++ )
		printf ( "\t%d", array_int [i] );

	for ( i = 0; i < nTotalCount; i++ )
	{
		switch ( i )
		{
			case 0:
				sbig = big = array_int [i];
				break;
			default:
				if ( big < array_int [i] ) {
					sbig = big;
					big = array_int [i];
				} else {
					if ( sbig < 
array_int [i] ) sbig = array_int [i] ;
				}
				break;
		}
	}
	printf ( "\n sbig :%d big :%d", sbig, big );

	free ( array_int );
}


For hashtable please refer the following link
http://www.geocities.com/abdur_rab7/Open_Hash/openhash.html
 
Is This Answer Correct ?    1 Yes 2 No
Abdur Rab
 
 
 
  Re: 1.find the second maximum in an array? 2.how do you create hash table in c? 3.what is hash collision
Answer
# 3
1.#include<stdio.h>
int main()
{
    int a[10]={222,111,4,5,6,8,1,77,0,4};
    int i=0,max=0,sec_max=0;
    
    for(i=0;i<10;i++)
    {
       if(a[i]>max)
       {
         sec_max=max;
         max=a[i];	
       }
       else if(a[i]>sec_max)
       {
       	  sec_max=a[i];
       }
       	
    	
    }
    
printf("Max= %d  Second Max=%d",max,sec_max);
    
}
 
Is This Answer Correct ?    4 Yes 0 No
Sachin
 
  Re: 1.find the second maximum in an array? 2.how do you create hash table in c? 3.what is hash collision
Answer
# 4
#include<stdio.h>

int main()
{
        int arr[] = {2,3,20,7,8,1};
        int max, sec;
        int i;
        max=0;
        sec=0;
        for ( i=0; i< 6; i++)
        {
                if(arr[i] > max)
                max = arr[i];
        }

        for ( i=0; i< 6; i++)
        {
                if ( (arr[i] > sec) && (arr[i] < max))
                        sec = arr[i];
        }
        printf(" max=%d\n sec=%d\n", max, sec);
}
 
Is This Answer Correct ?    0 Yes 0 No
Rao
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
What is the difference between null pointer and the void pointer?  2
print the following using nested for loop. 5 4 3 2 1 1 2 3 4 3 2 1 1 2 1 2 1 1 2 3 4 3 2 1 1 2 3 4 5  4
How can I find out how much memory is available? Persistent1
What's the difference between calloc() and malloc()?  2
What are the phases in s/w developed life cycle? wat is the diff b/w stack & queue...where do we use stack  5
what is the function of .h in #include<stdio.h> in c ? IBM4
Write a program to generate prime factors of a given integer?  1
YBJBU6  1
Tell about strtok & strstr functions Motorola2
Given an array of numbers, except for one number all the others occur twice. Give an algorithm to find that number which occurs only once in the array.  1
what is the different between if-else and switch statment (other than syntax) CTS9
wap in c to accept n number display the highest and lowest value  2
declare afunction pointer to int printf(char *)? HCL1
What's the best way to declare and define global variables?  2
How to add two numbers without using arithmetic operators? Sapient7
what is the differnce between AF_INET and PF_INET? Wipro1
The C language terminator is a.semicolon b.colon c.period d.exclamation mark TCS3
I have a function which accepts a pointer to an int. How can I pass a constant like 5 to it?  3
write a C code to reverse a string using a recursive function, without swapping or using an extra memory. Motorola2
main() { printf("hello%d",print("QUARK test?")); }  3
 
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