Wednesday 3 February 2021

Questions on Structures Concept

Design a structure Account to store the name, account number and balance of customer. Use array of structures and develop the appropriate C functions for the following operations a. Store Customer information, b. Add $100 in the balance of all the customers having more than $1000 in their balance and then print the incremented value of the updated record. 

A college library has many books. A librarian gives the task of automating the following activities. Define the structure for book with the following fields: ISBN, book title, author, year of publishing, price and number of copies. The task is to write a C program

to store the details of 10 books. Write a menu driven program and implement the following functions: a) Display() – displays the data of all available books b) Search() – searches for a given book based on ISBN number and prints the data of the book if available. Otherwise, print “No such book available” c) Sort() – sorts the data based on ISBN number.


Define structure date containing three members day, month and year. Use this structure to update the given date by one day. If day is the last day of the month, the month field must be incremented by one. If month is 12, the value of the year field must be changed when the day is 31. Also check for leap year. Write a program to update the date by using structure for above mentioned conditions.

Define 2 structures to store the student details and marks. student structure should contain members like name, age, height, address (consisting of street name, city, state, pin code) and marks structure should contain members like three subject marks, cgpa, grade and branch. Define whatever data types are needed. How many bytes are needed to store the student and marks structures


Create a structure to specify data of students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 20 students enrolled in the course and read data for 15 students. (a) print () function to print names of all students who joined in a particular year. (b) search () function to print the data of a student whose roll number is given as

argument. (c) count () function to count the number of students who joined on or before a specified year. (d) append () function to insert the data of new student.


Define a structure data type named date containing three integer members day, month and year. Write a function to read 10 different dates into structure members and print the date in the following format. January 09,2001


Define user defined data type Book. A Book structure contains its title, author name, ISDN number and price. Implement a program to read N number of books information and then arrange those records in sorted order based on its price.


Define a structure student with fields name, id, branch, total_marks. Read the data for 10 students and print the data of students who secured more than 40 marks.


Define a structure named point with two fields representing x and y coordinates of a point. Implement c program that takes the coordinates of 10 points as input and count how many points belong to quadrants 1,2,3 and 4.


Define a structure for an inventory item consisting of 5 fields: part number, part name, description, number of items currently on hand (integer), and price per unit. Allocate memory for 1 item using DMA function. Read the data through keyboard and print the data.


11.  Define a user defined data type student. A student structure contains his/her id number, Name and total marks obtained. Develop a program to read and display data for 10 students in class. Also display the details of topper of the class.

 Define 2 structures to store the following student and class schedule data as : cgpa, major, address (consisting of street address, city, state, zip), and class schedule (consisting of up to six class records, each of which has description, time, and days components).Define whatever data types are needed.

How many bytes are needed to store the above student & class schedule structures, by assuming 2-Bytes for integer and 1-Byte for a Character?

Q) There are 100 records present in a file with the following structure:

Struct date{ int d,m,y;};

Struct employee

{

int empcode[6];

char empname[20];

struct date join_date;

float salary;

};

Write a program to read these records, arrange them in ascending order of join_date and print them.


Define a structure type called subscriber that contains the components as name, street, address and bill amount (i.e. the amount the subscriber needs to pay). Implement a C program to

a. read the above inputs for each of 10 subscribers.

b. sort the subscriber records in ascending order based on the bill amount and print each subscriber record after sorting.

c. count the number of subscribers who have minimal due (i.e. <1000).


Write a C program to create a structure for a patient with the following fields: name, age, gender, height, weight. The program should read data for 10 patients and print the details of patients with age >=60.

No comments:

Post a Comment