26. 

What will be the output of the program ?

#include<stdio.h>
void swap(char *, char *);

int main()
{
    char *pstr[2] = {"Hello", "IndiaMax"};
    swap(pstr[0], pstr[1]);
    printf("%s\n%s", pstr[0], pstr[1]);
    return 0;
}
void swap(char *t1, char *t2)
{
    char *t;
    t=t1;
    t1=t2;
    t2=t;
}

A. IndiaMax
Hello
B. Address of "Hello" and "IndiaMax"
C. Hello
IndiaMax
D. Iello
HndiaMax

27. 

What will be the output of the program (Turbo C in 16 bit platform DOS) ?

#include<stdio.h>
#include<string.h>

int main()
{
    char *str1 = "India";
    char *str2 = "Max";
    char *str3;
    str3 = strcat(str1, str2);
    printf("%s %s\n", str3, str1);
    return 0;
}

A. IndiaMax India
B. IndiaMax IndiaMax
C. India India
D. Error

28. 

If the size of pointer is 4 bytes then What will be the output of the program ?

#include<stdio.h>

int main()
{
    char *str[] = {"Frogs", "Do", "Not", "Die", "They", "Croak!"};
    printf("%d, %d", sizeof(str), strlen(str[0]));
    return 0;
}

A. 22, 4
B. 25, 5
C. 24, 5
D. 20, 2

29. 

What will be the output of the program ?

#include<stdio.h>

int main()
{
    int i;
    char a[] = "\0";
    if(printf("%s", a))
        printf("The string is not empty\n");
    else
        printf("The string is empty\n");
    return 0;
}

A. The string is not empty
B. The string is empty
C. No output
D. 0

30. 

What will be the output of the program ?

#include<stdio.h>
#include<string.h>

int main()
{
    char str1[5], str2[5];
    int i;
    gets(str1);
    gets(str2);
    i = strcmp(str1, str2);
    printf("%d\n", i);
    return 0;
}

A. Unpredictable integer value
B. 0
C. -1
D. Error