String MCQ In C : MCQs On String In C Language

String MCQ In C. MCQs on the topic of Strings in C Programming Language

 

String MCQ In C

 

What is the maximum number of dimensions an array in C may have ??

A. Two
B. eight
C. sixteen
D. Theoretically no limit. The only practical limits are memory size and compilers

View Answer

D. Theoretically no limit. The only practical limits are memory size and compilers

 

Which of the following function duplicates a string ??

A. strnset
B. strstr
C. strdup
D. stricmp

View Answer

C. strdup

 

Which string method helps find the length of the string ??

A. stringLength()
B. strlen
C. strdup
D. both i & ii

View Answer

B. strlen

 

What is a String in C Language ??

A. String is a new Data Type in C
B. String is an array of Characters with null characters as the last element of an array
C. String is an array of Characters with null character as the first element of the array
D. String is an array of Integers with 0 as the last element of the array

View Answer

B. String is an array of Characters with null characters as the last element of an array

 

Which of the following is format specification for printing String in printf() ??

A. %d
B. %c
C. %f
D. %s

View Answer

D. %s

 

String MCQ In C

 

A String constant in C terminated by ??

A. ‘\O’
B. ‘\\O’
C. “
D. ” “

View Answer

A. ‘\O’

 

Choose a correct statement about C String ??

char ary[]=”Hello..!”;

A. Character array, ary is a string
B. ary has no Null character at the end
C. String size is not mentioned
D. String can not contain special characters

View Answer

A. Character array, ary is a string

 

What is a string in c mcq ??

A. 1-D Array of Character
B. 2-D Array of Character
C. Any of i & ii
D. None of the above

View Answer

A. 1-D Array of Character

 

int len = strlen (“Alan Poonam) ;
printf(“%s” , len) ;

What would be value of len printed ??

A. 10
B. 11
C. depends on the compiler
D. None of the above

View Answer

B. 11

 

What is the Format specifier used to print a String or Character array in C Printf or Scanf function ??

A. %c
B. %C
C. %s
D. %w

View Answer

C. %s

 

String MCQ In C

 

What C function copies the content of one String into another ??

A. Ssrcopy()
B. stringcopy()
C. strcpy()
D. both i & iI

View Answer

C. strcpy()

 

What is the output of the C Program with Strings ??

int main()
{
char ary[]=”Discovery Channel”;
printf(“%s”,ary);
return 0;
}

A. D
B. Discovery Channel
C. Discovery
D. Compiler error

View Answer

B. Discovery Channel

 

This C function copies the content of the source string at the end of the target string ??

A. copycat()
B. strcat()
C. both
D. None of the above

View Answer

B. strcat()

 

What is the output of the C Program ??

int main()
{
char str[]={‘g’,’l’,’o’,’b’,’e’};
printf(“%s”,str);
return 0;
}

A. g
B. globe
C. globe\0
D. None of the above

View Answer

D. None of the above

 

All the characters in the string are stored in ??

A. contiguous memory location
B. discreet memory location
C. both
D. pointer to pointer

View Answer

A. contiguous memory location

 

String MCQ In C

 

What would be the output of the C Program with ??

int main()
{
char str[]={‘g’,’l’,’o’,’b’,’y’,’\0′};
printf(“%s”,str);
return 0;
}

A. g
B. globe
C. globe\0
D. Compiler error

View Answer

B. globe

 

A one-dimensional array A has indices 1….75. Each element is a string and takes up three memory words. The array is stored at location 1120 decimal. The starting address of A[49] is ??

A. 1264
B. 1164
C. 1167
D. 1267

View Answer

A. 1264

 

How do you convert this char array to string ??

char str[]={‘g’,’l’,’o’,’b’,’y’};

A. str[5] = 0;
B. str[5] = ‘\0’
C. str[]={‘g’,’l’,’o’,’b’,’y’,’\0′};
D. All the above

View Answer

D. All the above

 

The string processing-related functions are stored in which header file ??

A. <stdio.h>
B. <conio.h>
C. <string.h>
D. none of these

View Answer

C. <string.h>

 

Which in-built function can be used to concatenate given two strings in the C program ??

A. strlen( )
B. strcat( )
C. strstr( )
D. none of these

View Answer

B. strcat( )

 

(more…)

Continue ReadingString MCQ In C : MCQs On String In C Language