Friday, November 25, 2016

MCQs based on String

MCQs C String Set-1


The ______ character is used to indicate end of string in C programming.
A.  ‘\0’
B.  \\
C.  “
D.  none of these

The char data type in C program occupies ______ byte of space in memory.
A. 1
B. 2
C. 4
D. none of these

The string processing related functions are stored in ____________ header file.
A. <stdio.h>
B. <conio.h>
C. <string.h>
D. none of these

The ______ in-built function can be used to find length of given string in C program.
A. strlen( )
B. strcat( )
C. strstr( )
D. none of these

The ______ in-built function can be used to concatenate given two string in C program.
A. strlen( )
B. strcat( )
C. strstr( )
D. none of these

______ C string function can be used to search string into given string.
A. strlen( )
B. strcat( )
C. strstr( )
D. none of these

_________ function can be used to read two words at a time.
A. scanf( )
B. gets( )
C. getch( )
D. none of these

Predict the output:
  #include<string.h>
  void main()
  {
    char str1[10]="abyz";
    int i;
           
            for(i=0; i<4; i++)
            {
                        printf("%c",str1[i] - 32);
            }         
  }
A. AB
B. zyba
C. abyz
D. ABYZ

Predict the output:
   #include<string.h>
   int main()
  {
            char str1[50]="abc", str2[50];

            strcpy(str2, strrev(str1));
           
            printf("Reverse string is : %s",str2);
            return 0;
   }
A. abc
B. cba
C. ABC
D. none of these



Click here to check answer of this MCQs.


More questions and quiz answers will be added soon……

* * * * *


No comments:

Post a Comment