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 >> Code Snippets >> Programming Code >> C++ Code
 
 


 

 
 C Code interview questions  C Code Interview Questions (401)
 C++ Code interview questions  C++ Code Interview Questions (121)
 VC++ Code interview questions  VC++ Code Interview Questions (2)
 Java Code interview questions  Java Code Interview Questions (58)
 Dot Net Code interview questions  Dot Net Code Interview Questions (113)
 Visual Basic Code interview questions  Visual Basic Code Interview Questions (8)
 Programming Code AllOther interview questions  Programming Code AllOther Interview Questions (37)
Question
Write a program using one dimensional array that searches a
number and display the number of times it occurs on the list
of 12 input values.
	Sample input/output dialogue:
	Enter 12 values:
	13  15  20  13  30  35  40  16  18  20 18  20
   Enter number to search: 20
    Occurences: 3
 Question Submitted By :: C++-Code
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
#include<stdio.h>
#include<conio.h>
void main()
{
int i,flag=0;
float s,a[4];
clrscr();
printf("Enter Twelve numbers:");
for(i=0;i<12;i++)
scanf("%f",&a[i]);

printf("Enter a number to search:");
scanf("%f",&s);

for(i=0;i<12;i++)
if(a[i]==s)
flag++;


printf("\nOccurances:%d",flag);

getch();
}
 
Is This Answer Correct ?    15 Yes 19 No
Sreejesh1987
 
Answer
# 2
change the sizeof array a[12] instead of a[4] 
Is This Answer Correct ?    6 Yes 10 No
Naveen Kumar
 
 
 

 
 
 
Other C++ Code Interview Questions
 
  Question Asked @ Answers
 
How reader and writer problem was implemented and come up with effective solution for reader and writer problem in case we have n readers and 1 writer. NetApp 5
A string of charaters were given. Find the highest occurance of a character and display that character. eg.: INPUT: AEGBCNAVNEETGUPTAEDAGPE OUTPUT: E   1
what is the diffrence between ++x , x++ pleaaaaase ???   7
void main() { int i,j=2; for(i=0;i<3;i++) if(j=i) cout<<"Lotus "; else cout<<"Rose "; } Its result is Rose Lotus Lotus.. How? Explain it?   2
Min-Max Write an algorithm that finds both the smallest and largest numbers in a list of n numbers and with complexity T(n) is at most about (1.5)n comparisons. Qatar-University 10
1.program to add any two objects using operator overloading 2.program to add any two objects using constructors 3.program to add any two objects using binary operator 4.program to add any two objects using unary operator IBM 2
Perform the functionality of 2-D array through 1-D array and in it the functions to be performed were: (1) Display the array in 2-D format (2) Display a particular element (3) Display a particular row (4) Display a particular column Nagarro 1
Given 1 to n random number, find top 10 maximum numbers and explain the time complexity of the algorithm. NetApp 1
hello friends, given an expression we have to remove the unwanted brackets in that expression. Eg : (a+b) ---> a+b (a+b)*(c)-----> (a+b)*c. Please mail me if you know the logic. My mail id is : saravana6m@gmail.com. Thank you in advance :-) Microsoft 1
write a function oriented program that calculates the sum of the squares from 1 to n. thus, if the input is 3, the output is 14   3
Wrie a function which returns the most frequent number in a list of integers. Handle the case of more than one number which meets this criterion. public static int[] GetFrequency(int[] list) Nagarro 3
Show by induction that 2n > n2, for all n > 4. Qatar-University 2
 
For more C++ Code 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