Strings


  1. Which pre-defined function returns a pointer to the last occurence of a character in a string?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    strrchr(s, c);


  1. String operation such as strcat(s, t), strcmp(s, t), strcpy(s, t) and strlen(s) heavily rely upon.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    Presence of NULL character



  1. What type of return-type used in String operations?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    void, int and (char *) only


  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    char *s = "Interview, Mania";
    char s1[20] = "hello Interview Mania";
    strcpy(s, s1);
    printf("%s", s1);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    Segmentation fault



  1. What will be the output of the following C code?
    #include <stdio.h>
    #include <string.h>
    int main()
    {
    char *s = "hello, Interview, Mania";
    char s1[25];
    strncpy(s1, s, 25);
    printf("%s %d", s1, strlen(s1));
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    hello, Interview, Mania 23