UNIT I & II
16 or 8 marks
1. Write the use of looping? Explain about the loops available in ‘C’ with appropriate C
programs.
2. Write a C Program to print all the calculator operations using switch statements.
3. Define an array? List the various types of arrays, Elaborate on Two-Dimensional
array with an example.
4. Write a program to sort the numbers stored in an array in descending order using
function. Pass the array as argument to a sort function.
5. Write a C Program to execute the payroll application with the data given using
Structure.
HRA = 18% of basic pay, DA = 15% of basic pay, PF = 10% of
basic pay, LIC = 7% of basic pay, Exclusion = PF LIC,
Total Salary = Basic Pay+HRA+DA+PF+LIC
Net Salary = Total Salary - Subtraction.
6. Illustrate the various modes of operations in a File and write a C program to copy the
content of one file to another file.
7. Write a C code to swap two numbers using only arithmetic operations (no temporary
variable).
8. Implement a recursive function to compute the sum of the digits of a number.
9. Write a C program to create a union that stores different data types and demonstrate
how to access the data.
10. Write a C function that reads integers from a file and prints them in reverse order.
Two-marks
1. Define a variable in C.
2. What are the primary data types in C?
3. Write a C program to get a paragraph of text as input.
4. Distinguish between for and while statement?
5. Write the procedure for multiplication of matrices?
6. Compare structure and a union?
7. Explain the usage of pointers in C.
8. How do you open a file in C? Write the syntax.
9. Find the output?
#include <stdio.h>
struct Point {
int x, y;
};
int main() {
struct Point p = {10, 20};
printf("x = %d, y = %d\n", p.x, p.y);
return 0;
}
10. How does the #define directive in C work? Write an example where you use it to
define a macro for a mathematical operation.