Vidyalelo
C Programming · all questions

Arrays and Strings
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

133

Questions

6/7

Page

Pick an option on a question to see the right answer and solution.

Which of the following is the right syntax to copy n characters from the object pointed to by s2 into the object pointed to by s1?

Select an option to see the answer and solution.

The isdigit function tests for any decimal-digit character.

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

void *memcpy(void *dest, const void *src, size_t n) What does the following code do?

Select an option to see the answer and solution.

What will be the output of the following C code?
errno = 0;
y = sqrt(-10);
if(errno == EDOM)
printf("Invalid value \n");
else
printf("Valid value\n");

Select an option to see the answer and solution.

This function checks whether the passed character is white-space.

Select an option to see the answer and solution.

What is the function of strcoll()?

Select an option to see the answer and solution.

isalpha() function is used to detect characters both in uppercase and lowercase.

Select an option to see the answer and solution.

Which header declares several functions useful for testing and mapping characters?

Select an option to see the answer and solution.

What will be the output of the following C code?
int i = 0;
char c;
char str[ ] = "Little Star";
while(str[i])
{
putchar (toupper(str[i]));
i++;
}

Select an option to see the answer and solution.

What occurs when a result has nowhere near the number of significant digits indicated by its type.

Select an option to see the answer and solution.

The function strsp() is the complement of strcspn().

Select an option to see the answer and solution.

NULL is the macro defined in the header string. h.

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

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);

Select an option to see the answer and solution.

What will be the output of the following C code?
char str1[15];
char str2[15];
int mat;
strcpy(str1, "abcdef");
strcpy(str2, "ABCDEF");
mat= strncmp(str1, str2, 4);
if(mat< 0)
printf("str1 is not greater than str2");
else if(mat> 0)
printf("str2 is is not greater than str1");
else
printf("both are equal");

Select an option to see the answer and solution.

The . . . . . . . . function returns a pointer to the first character of a token.

Select an option to see the answer and solution.

The mem functions are meant for . . . . . . . .

Select an option to see the answer and solution.

What will the given C code do?
int memcmp(const void *str1, const void *str2, size_t n)

Select an option to see the answer and solution.

Which code from the given option return pointer to last occurrence of c in ch or NULL if not present?

Select an option to see the answer and solution.