You are on page 1of 1

Indian Institute of Technology Mandi

MA 514: Computer Programming

Odd Semester 2020-21, Quiz-II

Time: 60minuts Full Marks: 20

1. a. Why we need Functions in C-language? How many types of Functions exist in C-language? [1+1]
b. Explain the concept of “call by value” and “call by reference” for a function in C-language? [2]

b. Convert the following C- code into “call by reference” of the function: [2]
#include <stdio.h>
void increment(int var)
{
var = var+1;
}
int main()
{
int num=20;
increment(num);
printf("Value of num is: %d", num);
return 0;
}

3. a. Compare the use of the inbuilt functions strcpy() and strcat() in C-language (explain with examples)? [2]
b. What is recursion function? Write the syntax of the recursion function in C-language? [1+1]

4. Write a basic C-program to print the sentence “Welcome to C-Programming” in a file. [3]

5. What is Dynamic memory Allocation in C-language? Compare malloc() and calloc() functions in C. [1+2]

6. Write a C-program using Structure to print Name, roll number and obtained marks in five different subjects
in your class students. [4]

--The End--

You might also like