Structures
and unions
Data Structures 15CS33
1.
Write
a C program to represent a complex number using structure and add two complex
numbers.
(December 2007)
(8 marks)
2.
Write
short notes on: structures, Nested structures and union along with examples.
(December 2007)
(December 2009)
(June 2012)
(December 2014)
(8 marks)
3. What
is structure? how it is different from an array? Explain different types of
structure declaration with example and its initialization.
(June 2009)
(December 2012)
(June 2015)
(8 marks)
4.
Write
a appropriate structure definition and variable declarations to store following
information about 100 students.
Name,
USN, Gender, Date Of Birth, and marks in 3 subjects S1, S2, S3.
Date
of birth should be a structure containing fields day, month, and year.
(June 2010)
(5 marks)
5.
Write
a C program to represent a complex number using structure and multiply two
complex numbers.
(December 2010)
(8 marks)
6.
How
structures can be passed to function through pointers. Explain with examples.
(June 2011)
(5 marks)
7.
Develop
a structure to represent a planets in the solar system. Each planet has the
field for the planets name, its distance from the sun in miles and the number
of moon it has. Write a program to read the data for each planet and store.
Also print the name of the planet that has the highest number of moons.
(December 2011)
(December 2013)
(8 marks)
8.
Write
a C program with an appropriate structure definition and variable declaration
to store information about an employee using nested structure. Consider the following fields like Ename, Empid,
DOJ(Date, month, year) and Salary ( Basic, DA, HRA).
(June 2012)
(December 2014)
(12 marks)
9.
Give
3 different ways of defining structure and declaring variables and method of
accessing members of structures using a student structure with roll number,
name, and marks in 3 subjects as members of that structure as example.
(June 2013)
(6 marks)
10.
Define
a structure for the employee with the following fields:
Emp_id(integer)
, emp_name(string), emp_basic(float), emp_dest(string) and emp_age(integer). Write the following function to process the employee data:
1)
Function
to read the employee data
2)
Function
to print the employee record.
(June 2014)
(8 marks)