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  >>  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
You are given any character string. Find the number of sets
of vowels that come in the order of aeiou in the given
string. For eg., let the given string be DIPLOMATIC. The
answer returned must be "The number of sets is 2" and "The
sets are "IO and AI". Vowels that form a singleton set must
be neglected. Try to post the program executable in gcc or
g++ or in java.
 Question Submitted By :: Vadivel152
I also faced this Question!!     Rank Answer Posted By  
 
  Re: You are given any character string. Find the number of sets of vowels that come in the order of aeiou in the given string. For eg., let the given string be DIPLOMATIC. The answer returned must be "The number of sets is 2" and "The sets are "IO and AI". Vowels that form a singleton set must be neglected. Try to post the program executable in gcc or g++ or in java.
Answer
# 1
str="DIPLOMATIC"
str=lcase(str)
strlen=len(str)

vowelcnt=0

For  pos=1 to strlen
	charofstr=mid(str,pos,1)
	If (charofstr="a") or (charofstr="e") or (charofstr="i") or
(charofstr="o") or (charofstr="u")  Then
		vowelcnt=vowelcnt+1
	End If
Next
  
msgbox "no of vowels are:"& vowelcnt
 
Is This Answer Correct ?    2 Yes 3 No
Rohini
 
  Re: You are given any character string. Find the number of sets of vowels that come in the order of aeiou in the given string. For eg., let the given string be DIPLOMATIC. The answer returned must be "The number of sets is 2" and "The sets are "IO and AI". Vowels that form a singleton set must be neglected. Try to post the program executable in gcc or g++ or in java.
Answer
# 2
str="DIPLOMATIC"
str=lcase(str)
strlen=len(str)

vowelcnt=0

For  pos=1 to strlen
	charofstr=mid(str,pos,1)
	If (charofstr="a") or (charofstr="e") or 
(charofstr="i") or
(charofstr="o") or (charofstr="u")  Then
		vowelcnt=vowelcnt+1
	End If
Next
  
msgbox "no of vowels are:"& vowelcnt
 
Is This Answer Correct ?    3 Yes 1 No
Sumedha Sk
 
 
 
  Re: You are given any character string. Find the number of sets of vowels that come in the order of aeiou in the given string. For eg., let the given string be DIPLOMATIC. The answer returned must be "The number of sets is 2" and "The sets are "IO and AI". Vowels that form a singleton set must be neglected. Try to post the program executable in gcc or g++ or in java.
Answer
# 3
#include<stdio.h>
#include<string.h>

int vowelsubset();
void separate();

char vowel[] = {'a','e','i','o','u'};
char str[100],res[50];
int main()
{
	scanf("%s",str);
	separate();
	printf("The No. of sets are: %d\n",vowelsubset());
	return 0;
}
void separate()
{
	int i,j,x=0;
	for(i = 0;i<strlen(str);i++)
		for(j = 0;j<5;j++)
			if(str[i] == vowel[j])
				res[x++] = str[i];
	res[x] = ''\0;
}
int vowelsubset()
{
	if( (strlen(res)==0 )|| (strlen(res)==1) )
		return 0;
	int cnt = 0,i,j,x,k,flag;
	for(i = 0;i<strlen(res);i++)
	{
		for(j = 0;j<5;j++)
			if( (res[i] == vowel[j]) && (vowel[j]!='u'))
			{
				flag = 0;
				for(k = i+1;k<strlen(res);k++)	
				{
					if(res[k]<=vowel[j])
					{
						i = k-1;
						goto label;
					}
					for(x = j+1;x<5;x++)
						if(res[k] == vowel[x])
							flag = 1;

				}
				label:
				if(flag == 1)
					cnt++;
			}
	}
	return cnt;
}
 
Is This Answer Correct ?    4 Yes 1 No
Vadivel_152
 

 
 
 
Other C Code Interview Questions
 
  Question Asked @ Answers
 
main() { printf("%d, %d", sizeof('c'), sizeof(100)); } a. 2, 2 b. 2, 100 c. 4, 100 d. 4, 4 HCL3
What is the output for the program given below typedef enum errorType{warning, error, exception,}error; main() { error g1; g1=1; printf("%d",g1); }  1
Write a program that find and print how many odd numbers in a binary tree  1
What is the main difference between STRUCTURE and UNION?  6
What is the problem with the following code segment? while ((fgets(receiving array,50,file_ptr)) != EOF) ;  1
How will you print % character? a. printf(“\%”) b. printf(“\\%”) c. printf(“%%”) d. printf(“\%%”) HCL1
To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. Synergy2
void main() { int i; char a[]="\0"; if(printf("%s\n",a)) printf("Ok here \n"); else printf("Forget it\n"); }  1
void main() { unsigned giveit=-1; int gotit; printf("%u ",++giveit); printf("%u \n",gotit=--giveit); }  1
main() { int i=400,j=300; printf("%d..%d"); }  1
void main() { char a[]="12345\0"; int i=strlen(a); printf("here in 3 %d\n",++i); }  1
void main() { void *v; int integer=2; int *i=&integer; v=i; printf("%d",(int*)*v); }  1
What is the hidden bug with the following statement? assert(val++ != 0);  1
Extend the sutherland-hodgman clipping algorithm to clip three-dimensional planes against a regular paralleiepiped IBM1
How to return multiple values from a function?  4
Which version do you prefer of the following two, 1) printf(“%s”,str); // or the more curt one 2) printf(str);  1
Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it. Wipro2
enum colors {BLACK,BLUE,GREEN} main() { printf("%d..%d..%d",BLACK,BLUE,GREEN); return(1); }  1
how to return a multiple value from a function? Wipro5
Is the following statement a declaration/definition. Find what does it mean? int (*x)[10];  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