Loading...

C Multiple Choice Questions

Our C questions and answers focuses on all areas of C programming language covering 100+ topics in C

C Arrays and Strings-2 MCQs

C Arrays and Strings-2


1. What is the prototype of strcoll() function?

a) int strcoll(const char *s1,const char *s2)
b) int strcoll(const char *s1)
c) int strcoll(const *s1,const *s2)
d) int strcoll(const *s1)



2. What is the function of strcoll()?

a) copies the string, result is dependent on the LC_COLLATE
b) compares the string, result is not dependent on the LC_COLLATE
c) compares the string, result is dependent on the LC_COLLATE
d) copies the string, result is not dependent on the LC_COLLATE



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

a) sizet
b) size
c) size_t
d) size-t



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

a) True
b) False



5. What is the maximum length of a C String?

a) 32 characters
b) 64 characters
c) 256 characters
d) None of the above



6. How do you accept a Multi Word Input in C Language?

a) SCANF
b) GETS
c) GETC
d) FINDS



7. Choose a correct C Statement about Strings.

a) PRINTF is capable of printing a multi word string
b) PUTS is capable of printing a multi word string
c) GETS is capable of accepting a multi word string from console or command prompt
d) All the above



8. What will be the output of the following piece of code?
int main() {
  char p[] = "GODZILLA";
  int i = 0;
  while(p[i] != '\0') {
    printf("%c", *(p+i));
    i++;
  }
  return 0;
}

a) G
b) GODZILLA
c) Compiler error
d) None of the above



9. What is the ASCII value of NULL or \0?
int main() {
  char str[] = {'g', 'l', 'o', 'b', 'a', 'l'};
  printf("%s", str);
  return 0;
}

a) 12
b) 0
c) 56
d) None of these



10. A character constant is enclosed by?

a) Left Single Quotes
b) Right Single Quotes
c) Double Quotes
d) None of the above



- Related Topics