You are on page 1of 1

Code No: C1CS10-C1203 NR

I B.Tech (CCC) Regular Examinations, December 2006


C AND DATA STRUCTURES
(Electrical & Electronic Engineering)
Time: 3 hours Max Marks:100
Answer any FIVE Questions
All Questions carry equal marks
?????

1. Write a program that calculates the value of money at the end of each year of
investment assuming an interest rate of 12 percent and prints the year & corre-
sponding amount in two columns for a period of 10 years with an intial investment
of 5 years.
Formula: Value at end of year = value at start of year (1+interest rate) [20]
2. (a) Describe in detail the execution of while statement with example.
(b) Given a number, write a program using while loop to reverse the digits of the
number. For e.g. 12345 should be written as 54321.
(c) Write a program to compute the sum of the digits of a given integer number.
[5+8+7]
3. (a) Write a program to compute Fibonacci numbers which are defined by the
recurrence relation.
f ibn+1 = f ibn + f ibn−1 for n > 0
(b) What is the scope of variables of type: auto, register and static. [12+8]
4. (a) Describe nested structures. Draw diagrams to explain nested structure.
(b) Write a program to declare pointer as members of structure and display the
contents of the structure. Define a structure object, boy with three fields:
name, age and height. [8+12]
5. Write a C program to replace every 5th character of the data file, using fseek( )
command. [20]
6. Show how to implement a stack of integers in C by using an array int s[STACKSIZE],
where s[0] is used to contain the index of the top element of the stack, and where
s[1] through s[STACKSIZE-1] contain elements on the stack. Write a declaration
and routines push, pop, and empty for this implementation [20]
7. Write in detail about the following with a suitable example for each:
(a) Adjacency matrix
(b) linked adjacency lists. [10+10]
8. (a) Write a C program to search for a given element in the integer array using
binary search.
(b) Derive the time complexity of binary search. [12+8]

?????

1 of 1

You might also like