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
 
typedef struct error{int warning, error, exception;}error; main() { error g1; g1.error =1; printf("%d",g1.error); }  1
Given a list of numbers ( fixed list) Now given any other list, how can you efficiently find out if there is any element in the second list that is an element of the first list (fixed list) Disney3
void main() { unsigned giveit=-1; int gotit; printf("%u ",++giveit); printf("%u \n",gotit=--giveit); }  1
write a program to Insert in a sorted list Microsoft4
#include<stdio.h> main() { int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} }; int *p,*q; p=&a[2][2][2]; *q=***a; printf("%d----%d",*p,*q); }  1
void main() { int const * p=5; printf("%d",++(*p)); }  1
main() { int i; clrscr(); printf("%d", &i)+1; scanf("%d", i)-1; } a. Runtime error. b. Runtime error. Access violation. c. Compile error. Illegal syntax d. None of the above HCL1
void main() { char a[]="12345\0"; int i=strlen(a); printf("here in 3 %d\n",++i); }  1
Write a prog to accept a given string in any order and flash error if any of the character is different. For example : If abc is the input then abc, bca, cba, cab bac are acceptable, but aac or bcd are unacceptable. Microsoft5
main() { while (strcmp(“some”,”some\0”)) printf(“Strings are not equal\n”); }  1
#define int char main() { int i=65; printf("sizeof(i)=%d",sizeof(i)); }  1
main() { int i=3; switch(i) { default:printf("zero"); case 1: printf("one"); break; case 2:printf("two"); break; case 3: printf("three"); break; } }  1
main( ) { char *q; int j; for (j=0; j<3; j++) scanf(“%s” ,(q+j)); for (j=0; j<3; j++) printf(“%c” ,*(q+j)); for (j=0; j<3; j++) printf(“%s” ,(q+j)); }  1
What is "far" and "near" pointers in "c"...?  3
void main() { if(~0 == (unsigned int)-1) printf(“You can answer this if you know how values are represented in memory”); }  1
main( ) { void *vp; char ch = ‘g’, *cp = “goofy”; int j = 20; vp = &ch; printf(“%c”, *(char *)vp); vp = &j; printf(“%d”,*(int *)vp); vp = cp; printf(“%s”,(char *)vp + 3); }  1
program to Reverse a linked list Ness-Technologies4
main() { int i=5,j=10; i=i&=j&&10; printf("%d %d",i,j); }  1
main() { int i=-1; +i; printf("i = %d, +i = %d \n",i,+i); }  1
main() { static int a[3][3]={1,2,3,4,5,6,7,8,9}; int i,j; static *p[]={a,a+1,a+2}; for(i=0;i<3;i++) { for(j=0;j<3;j++) printf("%d\t%d\t%d\t%d\n",*(*(p+i)+j), *(*(j+p)+i),*(*(i+p)+j),*(*(p+j)+i)); } }  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