My Report

C String Test – 2


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement

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

2. The______ function returns the number of characters that are present before the terminating null character.

3. The C library function _________ breaks string s1 into a series of tokens using the delimiter s2.

4. What will be the output of the following C code?

const char str1[] = "abcdef";
const char str2[] = "fgha";
char *mat;
mat= strpbrk(str1, str2);
if(mat)
printf("First matching character: %c\n", *mat);
else
printf("Character not found");

5. which of the following function returns a pointer to the located string or a null pointer if string is not found.

6. The strpbrk() function is used to return a pointer to the character, or a null pointer if no character from s2 occurs in s1.

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

8. What will be the output of the following C code?

char str1[] = "Helloworld ";
char str2[] = "Hello";
len = strspn(str1, str2);
printf("Length of initial segment matching %d\n", len );

9. Is there any function declared as strstr()?

10. What is the return value of strxfrm()?


 

Start practicing “1000 MCQs on C”, and once you are ready, you can take tests on all topics by attempting our “C Test Series”.

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.