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: avdate — October 6, 2006
    -3 votes
      + -

    #include<stdio.h>
    #include<string.h>
    main() {
    char str1[5] = “abcd”;
    char str2[3] = “bc”;
    int len = strlen(str1);
    int i =0;
    char newstr[len];
    int cntr = 0;
    for ( i = 0; i<len; i++ ) {
    if ( strchr(str2,str1[i]) == NULL ) {
    newstr[cntr++] = str1[i];
    }
    }
    newstr[cntr] = ‘’;
    printf(”%s%s%s”, ” the new str is “, newstr, “n”);
    }

  2. Submitted By: harshsha — October 6, 2006
    -1 votes
      + -

    char* ClearString (char* s1, char* s2)
    {
    unsigned int count;
    unsigned char* str;
    unsigned chat* insert;
    unsigned char map[32];
    if(s1==NULL

  3. Submitted By: aa — October 15, 2006
    +13 votes
      + -

    - in first iteration, insert all the values of s1 to a hash table say T.
    - in second iteration, for s2 hash every character to T, if found make this location NULL and if found move this character to adjacent location if adjacent locaton is NULL

  4. Submitted By: Vivek — December 13, 2006
    -7 votes
      + -

    A linear solution without using a hash table.

    void substring_remove(string &str, string &substr)
    {
    int i=0;
    int len=str.length();
    while(i=0)
    {
    i=str.find_first_of(substr,i);
    if(i>=0)
    str.erase(i,1);
    }
    }

  5. Submitted By: Swati Sarda — December 18, 2006
    +0 votes
      + -

    int len = strlen(a);
    int index = 0;
    void ClearString(char *a,char *b)
    {
    int len = strlen(a);
    int index = 0;
    for(int i=0;i

  6. Submitted By: Ravi — January 14, 2007
    -1 votes
      + -

    int deleteChars(char* s1,char* s2)
    {
    int arr[256];
    for(int i=0;i

  7. Submitted By: guru — August 17, 2007
    +0 votes
      + -

    char* s1minuss2(char *s1, char* s2)
    {
    static char res[20]= “”;
    int i = 0, j = 0;

    while ( s2[i] != ” )
    {
    if ( !strchr(s1, s2[i]) )
    { res[j] = s2[i]; j++; }
    i++;

    }
    res[j] = ”;
    return res;
    }

  8. Submitted By: scratchingmonkeyanditchingtiger — January 10, 2008
    +1 votes
      + -

    O(n) approach. will remove any occurance of the characters.

    # include
    # include
    # include

    int table [ 128 ] ;

    void main()
    {
    char *str=”this is a test”;
    char *str1=”is “;
    clrscr();
    while(*str1!=”)
    {
    table[toupper(*str1)]++;
    str1++;
    }

    while(*str!=”)
    {
    if(table[toupper(*str)]==0)
    {
    printf(”%c”,*str);
    }
    str++;
    }

    getch();
    }

  9. Submitted By: Anurag — August 24, 2008
    not yet rated
      + -

    void Delete(char* string1, char* string2)
    {
    char* s1 = string1, s2 = string2;
    int index, destIndex = 0;
    int* lookUp = ((int *)(calloc(255, sizeOf(int)));
    while(” != *s2)
    {
    int index = *s2;
    lookUp[index]++;
    s2++;
    }

    while(” != *s1)
    {
    index = *s1;
    if(0

  10. 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.