c Quiz

1. What is the primary purpose of the stdio.h header file in C?

2. Which data type is used to store a single character in C?

3. What is the purpose of the & operator in C?

4. Which keyword is used to define a constant in C?

5. What is the output of printf("%d", sizeof(int)); on a typical 32-bit system?

6. Which function is used to dynamically allocate memory in C?

7. What does the -> operator do in C?

8. Which loop in C is guaranteed to execute at least once?

9. What is the purpose of the static keyword when used with a local variable in a function?

10. Which header file is required for using strlen() function in C?

11. What is the purpose of the typedef keyword in C?

12. What is the output of the following code?

#include <stdio.h>
        int main() {
            int arr[] = {1, 2, 3};
            printf("%d", *(arr + 1));
            return 0;
        }

13. What is the purpose of the extern keyword in C?

14. Which function is used to read a string from standard input in C?

15. What is the purpose of the volatile keyword in C?

16. What is the correct way to declare a function pointer in C?

17. What is the purpose of the #include preprocessor directive in C?

18. Which function is used to release dynamically allocated memory in C?

19. What is the output of the following code?

#include <stdio.h>
        int main() {
            int x = 5;
            printf("%d", x++);
            return 0;
        }

20. What is the purpose of the enum keyword in C?