Questions
Practice questions with model answers, filterable by type.
- long · 10 marksExplain dynamic memory allocation in C. Differentiate between `malloc()` and `calloc()`. Write a C program to dynamically allocate memory for N integers, sort them in ascending order, and free the memory.
- objective · 1 marksWhich of the following is an invalid variable name in C? (a) _salary (b) 1st_rank (c) total_sum (d) age2
- objective · 1 marksWhat is the return type of the `malloc()` function in C? (a) `int*` (b) `char*` (c) `void*` (d) `float*`
- short · 5 marksExplain the difference between call by value and call by reference in C with suitable code snippets.
- short · 5 marksWhat is recursion? Write a recursive function in C to calculate the factorial of a positive integer.