AceTheInterview
Jobs in Pune | Work better in teams | Socialize with friends | Submit Q&A | Tell a friend
Search site for 

Top 100 Interview Questions & Answers in a convenient and easy to read book!

“I bought this guide a few days ago to prepare for my interview with Oracle. Many of the questions they asked me were from this guide. I found this book absolutely great!”

– Ravi, California

Read more comments...

Interview Questions And Answers RSS Feed

Answers »

  1. Submitted By: ontojava — October 6, 2006
    -7 votes
      + -

    int lex-a-star-b(char *s)
    {
    int i=0;
    while(s[i]==’a')i++;
    if((s[i]==’b')&&(s[i+1]==’'))
    return 1;
    else
    return 0;
    }

  2. Submitted By: rdakka — October 6, 2006
    -7 votes
      + -

    #include <iostream.h>

    bool is_astarb(char* s)
    {
    if (*s++ != ‘a’) return false;
    while(*s++);
    if (*—-s != ‘b’) return false;
    return true;
    }

    void main()
    {
    char s1[] = “”;
    char s2[] = “a”;
    char s3[] = “b”;
    char s4[] = “ba”;
    char s5[] = “ab”;
    char s6[] = “aajksdasb”;
    cout << “s1 = ” << is_astarb(s1) << ‘n’;
    cout << “s2 = ” << is_astarb(s2) << ‘n’;
    cout << “s3 = ” << is_astarb(s3) << ‘n’;
    cout << “s4 = ” << is_astarb(s4) << ‘n’;
    cout << “s5 = ” << is_astarb(s5) << ‘n’;
    cout << “s6 = ” << is_astarb(s6) << ‘n’;
    }

  3. Submitted By: SATHYA — March 11, 2007
    +1 votes
      + -

    I have programmed a lexical analyser(scanner).

    I think it will work but there is some problems with the output.

    /*
    Implementation Of SCANNER
    Grammar Ref: Appendix 4 ULLMAN

    This program needs an input file named as ‘input.txt’ which contains the expressions(only)
    This generates an output file named ‘output.txt’ & displays the output also in execution screen
    */
    #include
    #include
    #include
    #include
    void main()
    {
    FILE *fp1,*fp2;
    char str[100],sca[1000]=”";
    int i,j,k,l,len,as,nscan;
    clrscr();
    fp1=fopen(”input.txt”,”r”);
    fp2=fopen(”output.txt”,”w”);
    if(fp1==NULL||fp2==NULL)
    {
    printf(”File or files could not be opened!\n”);
    exit(0);
    }
    // printf(”Enter a string of expression:”);
    // scanf(”%[^\n]s”,str);
    // len=strlen(str);
    // printf(”length=%d\n”,len);
    do{
    strcpy(str,”);
    // printf(”str=%s”,str);
    fscanf(fp1,”%s”,str);
    len=strlen(str);
    //printf(”Length=%d\t”,len);
    k=0;
    i=0;
    nscan=0;
    // printf(”String:%s\t”,str);
    // getch();
    do
    {
    as=toascii(str[i]);
    if(isalpha(str[i]) && nscan!=1)
    {
    sca[k]=”;
    }

    else if(isdigit(str[i]))
    {
    sca[k++]=”;
    }
    else if(str[i]==’/’ && str[i+1]==’*')
    {
    // printf(” I am in comment segment”);
    sca[k++]=’{';
    i+=2;
    // strcat(sca,”‘;
    }
    else if(str[i]==’('||str[i]==’)')
    {
    sca[k++]=”;
    }
    else if(str[i]==’;')
    {
    sca[k++]=”;
    i++;
    }
    else if(nscan)
    {
    //strcpy(sca,”");
    fprintf(fp2,”%s\n”,”Syntax error! Digits ending with Alphabet\n”
    );
    }
    else
    {
    // printf(”Error occured!\nchar=%c%c%c”,str[i],str[i+1],str[i+2]);
    // exit(0);
    break;

    }
    sca[k++]=’ ‘;
    // printf(”sca=%s\n”,sca);
    }while(i

  4. Leave an Answer/Comment

    To prove you're a person (not a spam script), type the security text shown in the picture. Click here to regenerate some new text.
    Click to hear an audio file of the anti-spam word

Our Sponsors
Our Sponsors
Contact Us | FAQ | Sitemap | Terms of Use | Privacy Policy | Tell a Friend

Copyright © 1999-2006 Jeeve Technologies LLC. All rights reserved.