Pages

Friday, November 25, 2016

Answer of MCQs based on String

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

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

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

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
ANSWER: A

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
ANSWER: B

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

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

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
ANSWER: D

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

ANSWER: B

* * * * *



No comments:

Post a Comment