Note 1

Take Note:

Take a note while surfing.





Note With Ink

Give your Note a Colorful Tag.




Easy to Access

Stay on same information and in Sync wherever you are.

Note 2

Take Note:

Organize your information,It may take Shape.





Think With Ink

Differ your Content by Color.




Easy to Access

Easy to pull up your content from anywhere anytime.

Note 3

Take Note:

Don't Let information to miss,Because it take shape





Note With Ink

Simple an Easy Way to take a note.




Easy to Access

Get the same in next visit.


Please wait...

Programs Questions and Answers



    Question :: 341
    Write a program to remove duplicates from a given string

    Input : qqq44inttttervvviiewwww


    Output : q4intervw

    View Answer View Answer |  Strings |  Discuss in Forum | Add to Reading List To Reading List | Tag to companies Asked In |  Experience, Fresher
    Answer In: C  
     
    #include <stdio.h>
    #include <string.h>
    int main()
    {
        char str[] = "qqq44inttttervvviieewwww......commm";
        removeDuplicate(str);
        printf("%s",str);
        return 0;
    }
    void removeDuplicate (char *str)
    {
        char hash[256] = {0};
        int x=0, y = 0;
        char temp;
        while (*(str+y) != '\0')
        {
            temp = *(str+y);
            if (hash[temp] == 0)
            {
                hash[temp]=1;
                *(str+x) = *(str+y);
                x++;
            }
            y++;
        }
        *(str+x)='\0';
    }

    Tags:No Tags on this question yet!

    Question :: 342
    Write an efficient program to remove characters from the first string which are present in the second string

    Input : str1 = q4interview.com mask = iewc


    Output : q4ntrv.om

    View Answer View Answer |  Strings |  Discuss in Forum | Add to Reading List To Reading List | Tag to companies Asked In |  Experience, Fresher
    Answer In: C  
     
    #include <stdio.h>
    char *removeChar(char *str, char *mask);
    int main()
    {
    char str[] = "q4interview.com";
    char *mask = "iewc";
    char *output = removeChar(str, mask);
    printf("%s",output);
    }

    char *removeChar(char *str, char *mask)
    {
        char arr[256] = {0}, temp;
        int i = 0,j=0, k=0;
        while (*(mask+i))
        {
            arr[mask[i]]++;
            i++;
        }
        while (*(str+k))
        {
            temp = *(str+k);
            if (arr[temp] == 0)
            {
                *(str+j) = *(str+k);
                j++;
            }
            k++;
        }
        *(str+j)='\0';
        return str;
    }

    Tags:No Tags on this question yet!

    Question :: 343
    Write an efficient program to toggle all the bits of a number except k-th bit.

    Input : n = 4294967295, k = 0


    Output : 1

    View Answer View Answer |  Bitwise Operator |  Discuss in Forum | Add to Reading List To Reading List | Tag to companies Asked In |  Experience, Fresher
    Answer In: C  
     
    #include <stdio.h>
    int main()
    {
    unsigned int n = 4294967295, k = 0;
    printf("%d",~(n^(1<<0)));
    }

    Tags:No Tags on this question yet!

    Question :: 344
    Write an efficient program to set the rightmost unset bit.

    Input : 10


    Output : 11

    View Answer View Answer |  Bitwise Operator |  Discuss in Forum | Add to Reading List To Reading List | Tag to companies Asked In |  Experience, Fresher
    Answer In: C  
     
    #include <stdio.h>
    
    int main()
    {
    int z = 21;
    setUnsitBit(z);
    }

    void setUnsitBit(int y)
    {
    int p=y,x = 0;

    if (y == 0)
    return;
    if ((y&(y+1)) == 0)
    return;

    while (p > 0)
    {
    if (((y>>x) & 1) == 0)
    break;
    x++;
    p = p/2;
    }
    printf("%d",(y |=1<<x));
    }

    Tags:No Tags on this question yet!

    Question :: 345
    Write an efficient program to toggle the bits in the given range

    Input : Number n = 17 range l = 2, r = 5


    Output : 23

    View Answer View Answer |  Bitwise Operator |  Discuss in Forum | Add to Reading List To Reading List | Tag to companies Asked In |  Experience, Fresher
    Answer In: C  
     
    #include <stdio.h>
    
    int main()
    {
    int z = 50;
    setUnsitBit(z, 2,4);
    }

    void setUnsitBit(int y,int l, int m)
    {
        int i;
       i=(l>m)?m-1:l-1;
       m = (m>l) ?m:l;
    for (;i <=m;i++)
    y^=(1<<i);

    printf ("%d",y);
    }

    Tags:No Tags on this question yet!