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

5/7

Page

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

What will be the output of the following C code?
const char str1[10]="Helloworld";
const char str2[10] = "world";
char *mat;
mat = strstr(str1, str2);
printf("The substring is:%s\n", mat);

Select an option to see the answer and solution.

What will be the output of the following C code?
char ch[ ] = "0xC";
if(isxdigit(ch[ ]))
printf("ch = %s is hexadecimal character \n",ch);
else
printf("ch = %s is not hexadecimal character \n",ch);

Select an option to see the answer and solution.

What will strcmp() function do?

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

What is the function of void *memset(s, c, n)?

Select an option to see the answer and solution.

Which among the given options compares atmost n characters of string ch to string s?

Select an option to see the answer and solution.

Is there any function declared as strstr()?

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

fgetc, getc, getchar are all declared in . . . . . . . .

Select an option to see the answer and solution.

What will be the output of the following C code?
void *memset(void *c, int c, size-t n) 
unsigned char ch = c;
unsigned char *su;
for (su = s; 0 < n; ++su, --n)
<br>
*su = ch;
<br>

Select an option to see the answer and solution.

What will be the output of the following C code?
int ch= ' ';
if(isgraph(ch))
printf("ch = %c can be printed \n",ch);
else
printf("ch=%c cannot be printed \n",ch);

Select an option to see the answer and solution.

The C library function checks whether the passed character is printable.

Select an option to see the answer and solution.

What will be the output of the following C code?
int ch = '\t';
if(isprint(ch))
printf("ch = |%c| printable  \n", ch);
else
printf("ch= |%c| not printable \n",ch);

Select an option to see the answer and solution.

What will be the output of the following C code?
const char pla[] = "string1";
const char src[] = "string2";
printf("Before memmove place= %s, src = %s\n", pla, src);
memmove(pla, src, 7);
printf("After memmove place = %s, src = %s\n", pla, src);

Select an option to see the answer and solution.

Which of the following is the variable type defined in header string. h?

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

Which among the given options is the right explanation for the statement size_t strcspn(c, s)?

Select an option to see the answer and solution.

The standard white-space characters are the following: space (' '), form feed (' \ f '),
newline (' \n') , horizontal tab (' \tr), and vertlcal tab (' \v') can be tested with function.

Select an option to see the answer and solution.

. . . . . . . . occurs when a result is too large in magnitude to represent errors as a floating-point value of the required type.

Select an option to see the answer and solution.

. . . . . . . . tells the compiler that this data is de?ned somewhere and will be connected with the linker.

Select an option to see the answer and solution.