Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Lab – DA2 -1

SCHOOL OF COMPUTER SCIENCE ENGINEERING AND INFORMATION SYSTEMS

WINTER SEMESTER - 2023-24

Programme Name & Branch: M.TECH - SE


Course Code: ICSE102L Structured and Object-Oriented Programming
Faculty Name(s): MAREESWARI V
Maximum Marks: 10

Q.NO. Questions

1. Write a program in C to swap elements using call by reference.

2. Write a C program to find the sum of two numbers. Use the following function signature:
int* sum(int *n1, int *n2)
3. Write a program in C to store n elements in an age array and print the number of senior citizen
using a pointer. Note: You must pass the array to the function and process it using pointer.
4. Write a program in C to sort an array using a pointer.
Input the number of elements to store in the array : 5
Input 5 number of elements in the array :
element - 1 : 25
element - 2 : 45
element - 3 : 89
element - 4 : 15
element - 5 : 82
Output :
The elements in the array after sorting :
element - 1 : 15
element - 2 : 25
element - 3 : 45
element - 4 : 82
element - 5 : 89
5. Write a program in C to calculate the length of a string using a pointer.

6. Write a program in C to count the number of vowels and consonants in a string using a pointer.
Enter a string: string
Output :
Number of vowels : 1
Number of constant : 5
7. Write a program in C to print a string in reverse using a pointer.
Enter a string : Mareeswari
Output :irawseeraM
8. Write a program in C to find the largest element using Dynamic Memory Allocation. Test Data :
Input total number of elements(1 to 100): 5
Number 1: 5
Number 2: 7
Number 3: 2
Number 4: 9
Number 5: 8
Expected Output :
The Largest element is : 9.00
9. Write a program in C to concatenate two strings using a pointer.
Enter a string1 : Mareeswari
Enter a string1 : VIT University
Output : Mareeswari VIT University
10. Write a C program to demonstrate the all dynamic memory allocation methods
(malloc(),calloc(),realloc(),free()).
11 Write C program to read the details of two workers and calculate total payment of workers using
structure. The workers structure has name, salary per day, and number of days working. Find the
salary for a worker.
12 Write C program to accept batting information of cricket team using structure. It contains player
name and runs scored by player. Calculate total runs scored by cricket team.

13 Create the structure ‘Complex’ with the members of real and imaginary parts. Write a C program to
display the addition of two complex numbers by using structure and function.
Input:
Enter the value for complex number 1 real and imaginary parts: 2 6
Enter the value for complex number 2 real and imaginary parts: 3 3
Output:
Complex Number1: 2+6i
Complex Numberr2: 3+3i
Result of Addition: 5+9i
14 Details of employees (emp ID, name, joining date and mobile number) of a company is stored and
maintained by the company’s IT department. On his birthday, the GM of the company wants to
give a surprise gift of Rs.5000 for his employees who joined before 01/01/2010 and whose
employee id is divisible by 5. Develop the C program using nested structures to display the name of
the employees who are eligible to receive the gift and their mobile number.
15 Write a 'C' program using array of structure to accept customer details such as: Account_no, Name,
Balance using structure. Assume n number of customers in the bank. Write a function to print the
account no. and name of each customer whose balance < 100 Rs.
Write a menu driven program in 'C' which shows the working of library. The menu option should
be
16 i)Add book details.
ii)Display book details.
17
18 iii)List all books of given author.
19
iv)List the count of books in the library.
v) Exit.
Output-1
Output-2

Output-3
Output-4

20 In railway reservation system, identity of the person is got by either aardhar card number or voter
id. Given Aardhar card number as a number and voter id as a string. Write a C program to store and
display the details of ‘n’ number of people. It is important to store such that less memory is wasted.

You might also like