Top

Strings

31.

What will be the output of the following C code?

const char str1[]="ABCDEF1234567";
const char str2[] = "269";
len = strcspn(str1, str2);
printf("First matching character is at %d\n", len + 1);

 

Answer: A

size_t strcspn(const char *str1, const char *str2) is used to calculate the length of the initial segment of str1, which consists entirely of characters not in str2.

Enter details here

32.

Which of the given function is used to return a pointer to the located character?

Answer: D

The strchr() function is used to return a pointer to the located character if character does not occur then a null pointer is returned.

Enter details here

33.

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

Answer: A

No answer description available for this question.

Enter details here

34.

How will you print \n on the screen?

Answer: D

No answer description available for this question.

Enter details here

35.

If the two strings are identical, then strcmp() function returns

Answer:

Enter details here

36.

The______function returns a pointer to the first character of a token.

Answer: D

The strtok() function returns a pointer to the first character of a token, if there is no token then a null pointer is returned.

Enter details here

Answer: B

No answer description available for this question.

Enter details here

38.

Which of the following function compares 2 strings with case-insensitively?

Answer: C

No answer description available for this question.

Enter details here

39.

What will be the output of the program ?

#include

int main()
{
    printf(5+"IndiaBIX\n");
    return 0;
}

 

Answer: C

No answer description available for this question.

Enter details here

40.

What will be the output of the program ?

#include

int main()
{
    char str[25] = "IndiaBIX";
    printf("%s\n", &str+2);
    return 0;
}

 

Answer: A

No answer description available for this question.

Enter details here

Loading…
Tags: Strings Questions and Answers || Strings MCQ Questions and Answers || Strings GK Questions and Answers || Strings GK MCQ Questions || Strings Multiple Choice Questions and Answers || Strings GK || GK on Strings || C Programming Questions and Answers || C Programming MCQ Questions and Answers || C Programming GK Questions and Answers || GK on C Programming