Sei sulla pagina 1di 4

Code No: R5100106 1

I B.Tech (R05) Supplementary Examinations, June 2009


C PROGRAMMING AND DATA STRUCTURES
(Common to Civil Engineering, Electrical & Electronics Engineering, Electronics &
Communication Engineering, Computer Science & Engineering, Electronics &
Instrumentation Engineering, Bio-Medical Engineering, Information Technology, Electronics
& Control Engineering, Computer Science & Systems Engineering, Electronics & Computer
Engineering and Instrumentation & Control Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
?????

1. (a) What is meant by looping? Describe any two different forms of looping with examples.
(b) Write a program to print the following outputs using for loops: [8+8]
i) 1 ii) 1
2 2 2 2
3 3 3 3 3 3
4 4 4 4 4 4 4 4
2. The annual examination is conducted for 50 students for three subjects. Write a program to read the
data and determine the following:
(a) Total marks obtained by each student.
(b) The highest marks in each subject and the Roll No. of the student who secured it.
(c) The student who obtained the highest total marks. [5+6+5]
3. Write a ‘C’ program to find number of words, blank spaces, special characters, digits and vowels of a
given text using pointers. [16]
4. (a) What are Bit fields. What are its advantages. What is its syntax.
(b) Write a C program to store the information of vehicles. Use bit fields to store the status in-
formation. Assume the vehicle object consists of type, fuel and model member fields. Assume
appropriate number of bits for each field. [8+8]
5. Write a program to read a C program file and count the following in the complete C program
(a) Total number of statements
(b) Total number of opening brackets. [8+8]
6. Write a C program to accomplish the following stack operations:
(a) push
(b) pop
(c) stack- empty
(d) stack full
(e) display [3+3+2+2+3]
7. Write an algorithm for each of the following:
(a) Inorder traversal
(b) Preorder traversal
(c) Postorder traversal [5+5+6]
8. (a) Write and explain linear search procedure with a suitable example.
(b) Formulate recursive algorithm for binary search with its timing analysis.
[4+12]

?????
Code No: R5100106 2
I B.Tech (R05) Supplementary Examinations, June 2009
C PROGRAMMING AND DATA STRUCTURES
(Common to Civil Engineering, Electrical & Electronics Engineering, Electronics &
Communication Engineering, Computer Science & Engineering, Electronics &
Instrumentation Engineering, Bio-Medical Engineering, Information Technology,
Electronics & Control Engineering, Computer Science & Systems Engineering,
Electronics & Computer Engineering and Instrumentation & Control Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
?????

1. (a) Write the various steps involved in executing a C program and illustrate it with a help of
flowchart.
(b) Candidates have to score 90 or above in the IQ test to be considered eligible for taking
further tests. All candidates who do not clear the IQ test are sent reject letters and others
are sent call letters for further tests. Represent the logic for automating this task. [8+8]

2. (a) Write a program to demonstrate passing an array argument to a function. Consider the
problem of finding largest of N numbers defined in an array.
(b) Write a recursive function power (base, exponent) that when invoked returns base expo-
nent. [8+8]

3. (a) What is a pointer? List out the reasons for using pointers.
(b) Write a C Program to illustrate the use of indirection operator “ * ” to access the value
pointed by a pointer. [8+8]

4. (a) Distinguish between an array of structures and an array within a structure. Give an
example each.
(b) Write a C program using structure to create a library catalogue with the following fields;
Access number, author’s name. Title of the book, year of publication, publisher’s name,
price. [6+10]

5. (a) What is the task performed by fseek( ) function. What is its syntax. Explain each
parameter in it.
(b) Write a C program to read the text file containing some paragraph. Use fseek() and read
the text after skipping n characters form beginning of the file. [8+8]

6. Write a program to convert a given infix expression to postfix expression using stacks. [16]

7. Write a program to insert an element at nth position and delete an element at nth position in
a doubly linked list. [16]

8. (a) Explain Quick sort with algorithm.


(b) Analyse the worst case performance of Quick sort and compare with Selection sort.
[8+8]

?????
Code No: R5100106 3
I B.Tech (R05) Supplementary Examinations, June 2009
C PROGRAMMING AND DATA STRUCTURES
(Common to Civil Engineering, Electrical & Electronics Engineering, Electronics &
Communication Engineering, Computer Science & Engineering, Electronics &
Instrumentation Engineering, Bio-Medical Engineering, Information Technology,
Electronics & Control Engineering, Computer Science & Systems Engineering,
Electronics & Computer Engineering and Instrumentation & Control Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
?????

1. Write about space requirements for variables of different data types. [16]

2. The annual examination is conducted for 50 students for three subjects. Write a program to
read the data and determine the following:

(a) Total marks obtained by each student.


(b) The highest marks in each subject and the Roll No. of the student who secured it.
(c) The student who obtained the highest total marks. [5+6+5]

3. (a) How to use pointers as arguments in a function? Explain through an example.


(b) Write a ‘C’ function using pointers to exchange the values stored in two locations in the
memory. [8+8]

4. Design a structure to store length in kilometers, meters and centimeters. Write a function
to find the addition of two measurements by passing two measurements as arguments to a
function. [16]

5. (a) List and explain various binary modes of opening a file.


(b) Write a C program to read a C program file and count the total number of statements in
the complete input C program. [6+10]

6. What is a Queue? Explain two applications of it. What are the advantages of a Circular Queue
over a linear queue? [4+6+6]

7. Write a function in ‘C’ to insert an element after the nth element of a list. [16]

8. (a) Write and explain linear search procedure with a suitable example.
(b) Formulate recursive algorithm for binary search with its timing analysis.
[4+12]

?????
Code No: R5100106 4
I B.Tech (R05) Supplementary Examinations, June 2009
C PROGRAMMING AND DATA STRUCTURES
(Common to Civil Engineering, Electrical & Electronics Engineering, Electronics &
Communication Engineering, Computer Science & Engineering, Electronics &
Instrumentation Engineering, Bio-Medical Engineering, Information Technology,
Electronics & Control Engineering, Computer Science & Systems Engineering,
Electronics & Computer Engineering and Instrumentation & Control Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
?????

1. Write about space requirements for variables of different data types. [16]

2. (a) Write a recursive C-program to calculate the product of first N natural numbers.
(b) Write a C-program to display array elements in reverse order. Use call-by-reference mech-
anism in this a program. [8+8]

3. (a) Write a C program to illustrate the use of structure pointer.


(b) Explain the effects of the following statements:
i. int a, *b = &a;
ii. int p, *p;
iii. char *s;
iv. a = (float*)&X; [8+8]

4. (a) What are Bit fields. What are its advantages. What is its syntax.
(b) Write a C program to store the information of vehicles. Use bit fields to store the status
information. Assume the vehicle object consists of type, fuel and model member fields.
Assume appropriate number of bits for each field. [8+8]

5. (a) Distinguish between text mode and binary mode operation of a file.
(b) Write a program to open a pre-existing file and add information at the end of file. Display
the contents of the file before and after appending. [4+12]

6. What is a Circular Queue? Explain the various operations on Circular Queues with suitable
algorithms. [4+12]

7. (a) Construct a binary tree for the following preorder and inorder traversals.
Preorder: ABCDEFGHIJKLMNOPQ
Inorder : DECFBHGAKMLJIORNQP
(b) Explain the tree traversal methods with suitable examples. [8+8]

8. (a) Write a C program to search for a given element in the integer array using binary search.
(b) Write a C program to sort the elements of an array using tree sort method with suitable
example. [8+8]

?????

Potrebbero piacerti anche