II-168 Programming Concepts
43. Which of the following are string functions?
(a) strcat() (b) strstr()
(c) strcpy() (d) strupr()
(e) All of these
44. Which of the following is not a string function?
(a) strchr() (b) strset()
(c) strrev() (d) strvcat()
(e) strcmpi()
45. The characters in a string are
(a) of 1 byte each (b) stored in contiguous memory locations
(c) Both a and b (d) None
Answers
1. (a) 2. (a) 3. (a) 4. (a) 5. (a) 6. (c) 7. (b) 8. (a) 9. (a) 10. (b)
11. (a) 12. (b) 13. (a) 14. (a) 15. (b) 16. (a) 17. (b) 18. (a) 19. (c) 20. (a)
21. (b) 22. (a) 23. (b) 24. (a) 25. (b) 26. (a) 27. (a) 28. (b) 29. (c) 30. (b)
31. (a) 32. (a) 33. (a) 34. (a) 35. (a) 36. (d) 37. (b) 38. (a) 39. (b) 40. (b)
41. (d) 42. (d) 43. (e) 44. (d) 45. (c)
True or False
1. A string is defined as an array of characters.
2. Every string ends with a NULL character.
3. The declaration char name[ ] ="India"; is invalid.
4. The strlen() function returns the length of the given string.
5. The strdup() is used to copy the string.
6. The sricmp() and strncmp() are exactly same.
7. While reversing the string, address in memory also get changed.
8. If pre-existing string is replaced with new, memory addresses remain same.
9. If the string is reversed, the NULL character appears first.
10. The length of the string includes NULL character.
11. "12345" is a valid string.
12. 'A' is a valid string.
13. If two strings are merged, the string contains two NULL characters.
14. The string is declared as character array.
15. The string is not stored in successive memory locations.
16. The char constant 'C' ends with NULL character.
M08_ITL-ESL4791_02_SE_C08.indd 168 12/22/2012 5:03:30 PM