0% found this document useful (0 votes)
32 views7 pages

Ii Cia Qp-Cse101

Uploaded by

nishakrajan1347
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views7 pages

Ii Cia Qp-Cse101

Uploaded by

nishakrajan1347
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

1.

Given an integer matrix with size M x N with odd and even numbers, separate the even
and odd numbers and store in two 1D arrays (Odd & Even). After separation sort two 1D arrays
in ascending order. (

Sample input:

Sample output:

Odd[] = 5 7 9 15 25

Even[] = 2 12 16 24

2. Write a C program to get N number of students names using pointer array and print in
descending order.

3. Createa Structure called BankMgmt with AccNumber, CustName, AvlBalance,AccType


as members. Implement a Bank management Application as menu driven program for the above
said Structure scenario.

Menu Option:

1.Withdrawal

2.Deposit

3.Display Balance

4.Exit

If option

1 is chosen-

Amount can be withdrawn from the account(Withdrawn amount should be given as input). For
withdrawal the condition is- the AvlBalance must be greater than withdrawn amount).

2 is chosen-
Amount can be deposited to the account (the deposited amount should be given as input). The
deposited amount should be reflected in AvlBalance of the account.

3 is chosen Current available balance(AvlBalance) of the AccNumber should be

Displayed with other details

4 is chosen

Exit from the application

Sample Input:

SB100 VenkatKrishna 4500.00 SB

4. Create an Employee Structure with members empid, empname, basicpay, allowance,


deductions and netpay Calculate netpay from the structure member data. The calculation for

netpay = basicpay + allowance – deductions

Create an array of structure for 5 employee and print the netpay for every employee.

5. Write a program in C for the following: Get two matrices of varying dimensions. Check
the dimensions satisfy the matrix multiplication criteria. Print the input matrices in matrix form.
Implement a separate user defined function for multiplying matrices and this function should
have recursive call feature to get the results. Print the output matrix in matrix form.

6. Write a program in C for the following: Get an integer value in main function.Find
whether the given number is odd or even using two different user defined functions. First user
defined function should identify whether the argument passed is odd or not, and return result to
main function. Second user defined function should identify whether the argument passed is even
or not and return result to main function. Print the result in main function. Apply mutual
recursion between the user defined functions.
7. Write a program to create two arrays with minimum five elements each. Merge the arrays
to a new array in such a way that first array may be copied as it is and reverse only the second
array and merge it. Perform sorting in the new array and print it. Implement the same by passing
appropriate arrays to functions. Below is the sample output.

Sample I/P and O/P

Enter the number of elements for First Array : 4

Enter the elements for First Array :

13

12

Enter the number of elements for Second Array : 4

Enter the elements for Second Array :

Elements After Merging 4 13 12 1 9 8 7 6

The sorted elements are 1 4 6 7 8 9 12 13

8. Write a program to create a two dimensional array with elements of your wish. Pass the
array to the function and find the sum of each row and store to an array(say array1) and find the
sum of each column and store to another array(say array2 ) and print both the arrays(array1 and
array2).
9. Write a C program to multiply two matrices using dynamic memory allocation. Each two
dimensional array should be processed as array of pointers to a set of 1- dimensional integer
arrays. Read, access and display the matrix elements using pointers instead of subscript notation.
Use three functions i) To read input matrix ii) To compute the product and iii) To display the
resultant matrix.

10. Write a C program to hold two integer pointers as structure members. Allocate space for
the structure and its data members during runtime. Get one array as input. In the second array
copy the elements of the first array and replace the odd positioned elements by the product of its
adjacent elements. Access the array elements and structures using pointers instead of subscript
notation.

First array (Input):

123456

Second array (Output):

1 3 3 15 5 6

11. Write a c program to find the length of two given strings without using string functions.
Also, concatenate the shorter string at the end of longer string and print the new string.

12. Write a program that will accept a string and character to search. The program will call a
function, which will search for the occurrence position of the character in the string and return its
position. Function should return –1 if the character is not found in the input string.

13. Create a "Family" structure containing members such as the family head's name(head_
name), the total number of members (tot_mem), the family total income (tot_income), and the
family total expenditure (tot_exp). Create an array of structures of type “Family”.Then create an
array of pointers to point each structure.
Perform the following action:

(i) Display the details of the family that earns the maximum income

(ii) Sort the family based on money spent.

[To access the members of the structure, use pointers] .

14. Create a two dimensional matrix of order M x M. Create an array of pointers to point

each row. Find

(i) whether given matrix is symmetric or not

(ii) sum of diagonal elements.

Demonstrate the program using the concept of an array of pointers. (10marks)

15. A statistician reads two sets of data for his research work. Set A = {women’s height in
centimeters}. Set B = {men’s height in centimeters}. Each set contains five data. He is passing
both the set of data to a function using the base address of the dataset A & B. Inside the function
he merges all people heights and producing the result in increasing order. The ordered height
should be displayed in main. Use pointer notation to access the data.

Eg. A = {34,12,56,7,25} and B = {112,23,4,77,89}

Output C = {4,7,12,23,25,34,56,77,89,112}

16.

Develop a c program in which the user enters running text of finite length with space.
Accommodate the data in a character array and pass it as reference to a function called extractor.
Extractor function copies ‘n’ characters from mthposition of the given text. Store the extracted
text and display it in the main.

Eg. Input: hello how are you?

From 3rd position (not index) onwards extract 7 characters

Output: llo how


17. Create an array of structure with the following details Register Number, Vehicle Type
(can be two wheeler or four wheeler), Vehicle Make, Owner Contact Number, Service Cost.
Create a function to add vehicle. Create another function to calculate the service cost and display
the vehicle details along with service cost.

18. Write a program to create an array of structure for maintaining the details of 20 cricket
player which includes player name, age, number of matches, total run, and average runs by the
player. Create a main function for reading the details of 5 cricket player, find the average run
scored by the player and display all details of the player.

19. Write an interactive C program that will accept a positive integer quantity to perform any

one operation at a time, list of operations:

“odd or even”,

“factorial”,

” investigating the digits” based on the user choice.

The program will execute repeatedly, until a value „n /N‟read in from the keyboard.

20. Write a C program for the following data:

Get Loan amount from the user, Loan should be completed in 10 months‟ period of time, 10% of
the loan amount will be collected as monthly fixed principal, 3% interest can be calculated from
closing month balance. Print the data as follows:

For eg:

If Loan amount =4000

You might also like