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-3 MCQs

C Arrays and Strings-3


1. Choose a correct statement about C String.

a) A string is a group of characters enclosed by double quotes
b) If a string is defined with double quotes, NULL is automatically added at the end
c) Size of a string is without counting NULL character at the end
d) All the above



2. A C string elements are always stored in?

a) Random memory locations
b) Alternate memory locations
c) Sequential memory locations
d) None of the above



3. An array elements are always stored in ______ memory locations.

a) Random
b) Sequential
c) Sequential and Random
d) None of the above



4. Let x be an array. Which of the following operations are illegal?
I. ++x
II. x+1
III. x++
IV. x*2

a) I and II
b) I, II and III
c) II and III
d) I, III and IV



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

a) 2
b) 3
c) 12
d) No Limit



6. Is there any function declared as strstr()?

a) true
b) False



7. The______ function returns a pointer to the first character of a token.

a) strstr()
b) strcpy()
c) strspn()
d) strtok()



8. Which of the given function is used to return a pointer to the located character?

a) strrchr()
b) strxfrm()
c) memchar()
d) strchar()



9. The______ function returns the number of characters that are present before the terminating null character.

a) strlength()
b) strlen()
c) strlent()
d) strchr()



10. What will be the output of the program if the array begins at 1000 and each integer occupies 2 bytes?
void main() {
int arr[2][2] = { 1, 2, 3, 4};
printf("%u, %u", arr+1, &arr+1);
}

a) 1004 1008
b) 1002 1008
c) 1002 1002
d) 1008 1002



- Related Topics