Arrays and Strings – Multiple Choice Questions (MCQs)
-
-
14. What happens if you try to access an array element with an index out of bounds in C?
-
15. Can you initialize an array without specifying its size if you provide the initial values?
-
16. What is a multi-dimensional array in C?
-
17. What is an array of strings in C?
-
18. How do you declare an array of 5 strings, each with a maximum length of 20, in C?
-
19. What is the purpose of the `gets()` function in C?
-
20. Why is `gets()` considered unsafe to use?
-
21. Which safer alternative is often used instead of `gets()` to read a string in C?
-
22. What does the `sizeof()` operator return when used with an array?
-
23. What does the `sizeof()` operator return when used with a string literal (e.g., `sizeof(\Hello\")`)?"""
-
24. Can you compare two strings directly using the '==' operator in C?