# The CDS 4 unit

:
STRUCTURES,UNIONS & BITFIELDS
Collected, Edited & typed by: Nandini Q1.Explain with an example how a structure can be organised in the 'C' language. (aug/sep-07,set 1) OR What is the use of a structure?Give an example for a structure with initialised values. (april/may-07,set 3; aug/sep-06,set-2; nov/dec-05,set 3; nov/dec-04,set 2) OR What is a structure?How is it declared?How is it initalised? (aug/sep-06,set 3;) OR What is the use of struct keyword?Explain the use of dot operator.Give an example for each. (nov/dec-05,set 1 june-05,set 3) OR

th

What is a structure?Describe the governing rules for declaring a structure .(may/june-04,set 3) Q2.Describe the nested structure.Draw diagrams to explain nested structure. (april/may-07,set 4) OR What is a structure within structure?Give an example for it. (nov/dec-04,set 4) Q3.When are array of structures used?Declare a variable as array of structures and initialize it. (april/may-07,set 4; nov/dec-05 set 2; nov/dec-04,set 3) Q4.Distinguish between an array of structures and an array within a structure.Give an example each (aug/sep-07,set 2; may/june-06,set 2; nov/dec-05,set 2; nov/dec-04,set 3) Q5.Explain the advantages of structure type over the array type variable. (aug/sep-07,set 2; april/may-07,set 1)

Q6.How to compare structure variables?Give an example. (aug/sep-07,set 3;) Q7.(a)Explain the different ways of passing structures as arguments in functions. (b)Write a C program to illustrate the method of sending an entire structure as a parameter to a function. (may/june-06,set 4; may/june-04,set 1) Q8.How are structure elements accessed using pointers?Which operator is used?Give an example Q9.Differentiate between a structure and union with respective allocation of memory by the compiler.Give an example of each. (aug/sep-07,set 4)
\\

OR List out the similarities and differences between structures and unions. (may/june-04,set 2) Q10.Consider a structure master includes the information like name,code,pay,experience.Write a program to delete and display the information contained in master variables for a given code. (aug/sep-07,set 1; aug/sep-06,set 1)

Q11.Define a structure to represent a data.Use your structures that accept two different dates in the format mmdd of the same year. And do the following:Write a c program to display the month names of both dates .(aug/sep-06,set 3;

Q12.A company markets hardware items.Create a structure "hwitem"that stores the title of the item,it's price,an array of three floats so that it can record the sale in rupees of a particular item for the last three months,category of the item and it's original equipment manufacturer .Write a short program that provides facility to read N number of items information,append new items and display all records (aug/sep-07,set 4; aug/sep-06,set 4) Q13.Write a C program using structure to create a library catalogue with the following fields:Access number,author's name,book title,year of publication,publisher's name,price (aug/sep-07,set 2; may/june-06,set 2) Q14.Define a structure type struct ABS that contains name,age,designation and salary.Using this structure,write a C program to read this information

for one person from the keyboard and print the same on the screen. Q15.Write a c program to print maximum marks in each subject along with the student name by using structures.Take 3 subjects and 3 student records. nov/dec-04,set 3) may/june-04,set 4) OR Write a C program to illustrate the concept of structure within the structure ( nov/dec-04,set 4) Q16.Write a C program to calculate student wise total for three students using array of structures .(april/may-07,set 4; nov/dec-05 set 2; nov/dec-04,set 3) Q17.Write a program to use structure within union .Display the contents of a structure elements.. (june-05,set 1; june-05,set 4) Q18.Define a structure that represent a complex number(contains two floating point members,real and imaginary). Write a c program to add,subtract and multiply two complex numbers

( aug/sep-07,set 1; aug/sep-07,set 2) Q19.Write a c program to add the given two complex numbers.Defin functions add and print with pointers as arguments. The complex number is a structure object with real and imaginary fields. ( aug/sep-07,set 1; aug/sep-06,set 1; may/june-06,set 3; may/june-06,set 4)

Q20.The annual examination is conducted for 50 students for three subjects.Write a program