Arrays and Strings – Multiple Choice Questions (MCQs)
-
-
38. What is pointer arithmetic in the context of arrays in C?
-
39. If `int arr[5];` and `int *ptr = arr;`, what does `ptr + 2` point to?
-
40. What is a string literal in C?
-
41. Are string literals modifiable in C?
-
42. What happens if you try to modify a string literal directly in C?
-
43. What is the difference between `char str[] = \Hello\";` and `char *str = \""Hello\"";`?"""
-
44. Which of the following is a valid way to access the character at index 3 of the string \World\"?"""
-
45. What is the purpose of the `<string.h>` header file?
-
46. Which function can be used to find the first occurrence of a string within another string (case-insensitive)?
-
47. What is the purpose of the `sprintf()` function?
-
48. What is the purpose of the `sscanf()` function?