Unit3 - Subjective Questions

CSE101 • Practice Questions with Detailed Answers

1

Define a user-defined function in C. Explain the general syntax and the components of a function definition.

2

What is a Function Prototype? Why is it necessary in C programming?

3

Differentiate between Call by Value and Call by Reference with appropriate examples.

4

Write a C program to swap two numbers using a user-defined function and the Call by Reference method.

5

Explain the difference between Formal Parameters and Actual Arguments.

6

List and explain any five mathematical library functions defined in the <math.h> header file.

7

What is Recursion? Explain the two essential conditions required for a recursive function to work correctly.

8

Write a recursive function in C to calculate the Factorial of a number . Show the mathematical logic used.

9

Compare Recursion and Iteration (Loops).

10

Write a recursive C function to generate the term of the Fibonacci series.

11

Explain the concept of Scope in C. Differentiate between Global Scope and Local Scope.

12

What are Storage Classes in C? List the four storage classes available.

13

Explain the auto storage class with respect to scope, lifetime, and default value.

14

Discuss the extern storage class. How is it used to share variables between multiple files?

15

Explain the static storage class. How does a static local variable differ from a standard local variable?

16

What is the purpose of the register storage class? What are its limitations?

17

Create a comparative table of the four Storage Classes (Auto, Register, Static, Extern) based on Storage, Initial Value, Scope, and Lifetime.

18

Write a recursive function to calculate (Power of a number).

19

Predict the output of the following code snippet and explain why.

c

include <stdio.h>

void fun() {
static int x = 1;
int y = 1;
x++;
y++;
printf("%d %d\n", x, y);
}
int main() {
fun();
fun();
return 0;
}

20

Explain the mechanism of parameter passing in a function. What is a 'Stack Frame' or 'Activation Record'?