Sie sind auf Seite 1von 3

GITAM (Deemed to be University)

GITAM SCHOOL OF TECHNOLOGY


Program: B.Tech. Branch: Mech, Civil, EEE, ECE

Subject Code: 19EID131

Subject Name: Problem Solving & Programming

SECTION – A

(UNIT – 4)

Category – 1 (Easy)

1. What are functions? Explain with the help of example?


2. What is the need for functions?
3. What is function overloading??
4. Describe the function return values with the help of example.

Category – 2 (Moderate)

1. Predict the output of the following code:


#include<stdio.h>
int function();
main()
{
int i;
i = function();
printf("%d", i);
return 0;
}
function()
{
int a;
a = 250;
return 0;
}
2. Report the error in the following code and also identify the correct code:

#include<stdio.h>
int func(int a){
return a*a;
}
int func(int a, int b=7){
return a*b;
}
void main(){
printf(“%d”, func(15));
}
3. Write a C program to compute factorial of a number recursively.
4. Deduce the output of the following code:
#include <stdio.h>
int main()
{
static int i=5;
if(--i){
main();
printf("%d ",i);
}
}
5. Compute the output of the following code:

#include <stdio.h>
int fun()
{
static int num = 16;
return num--;
}
int main()
{
for(fun(); fun(); fun())
printf("%d ", fun());
return 0;
}
Section – B

(UNIT – 4)

Typical Questions

1. Discuss the implementation of function prototyping, function definition, function call with
the help of an example.
2. Compare call by value and call by reference with the help of an example.
3. Compare and contrast the various storage classes with example.
4. Illustrate the use of function overloading with example?
5. Explain Dynamic Memory Allocation and its need.

Moderate Questions

1. Write a program to create an array for entering student information and total marks secured
by them at run time. Create function to compute and display average marks scored for the
group of students. Additional data structure/function can be created if required.
2. Write a C function that computes multiplication of two matrices passed as argument to the
function and return the resultant matrix. Write a program to utilize the created
multiplication and display the result of two user input matrices. You can create helper
functions if needed.
3. Write the recursive function to compute Fibonacci series.
4. Refer the following code:
int main()
{
int x, y;
printf("Enter the value of x and y\n");
scanf("%d%d",&x,&y);
printf("Before Swap:\nx=%d\ny=%d\n", x, y);
swap(&x, &y);
printf("After Swap:\nx=%d\ny=%d\n", x, y);
return 0;
}
void swap(int *a, int *b)
{
int t;

t = *b;
*b = *a;
*a = t;
}
Justify the usage of call by address instead of call by value.
5. How is dynamic memory allocation performed? Explain the functions used in dynamic
memory allocation & deallocation with example.
6. Create a C program for solving the Tower of Hanoi problem.

Easy Questions

1. What are actual and formal parameters in a function? Give example.


2. Explain function pointers with the help of an example.
3. Describe recursive functions. Discuss its utility with the help of example.
4. List & Explain the various storage classes and their usage.

Section – C

Typical case Studies

1. Is it always useful to modularize the code by creating functions. Defend the suggestion with
appropriate examples.
2. Relate use cases where function pointer will be useful.

Das könnte Ihnen auch gefallen