Visvesvaraya Technological University (VTU) 2010-3rd Sem B.E Computer Science and Engineering emr - Question Paper
USN ! | | 'II I I t 06CS35
Third Semester B.E. Degree Examination, December 2010 Data Struct sires with G
Time: 3 hrs. Max. Marks: 100
Note: Answer any FIVE full questions, selecting at least TWO questions from each part
Important Note : I. On completing your answers, compulsorily draw diagonal cross lines on the remaining blank pages.
2. Any revealing of identification, appeal to evaluator and /or equations written eg, 42+8 = 50, will be treated as malpractice.
PART-A
1 a. What is a pointer? How do you declare and initialize the pointers? How do you access the
vahie pointed to by a pointer? (OS Marks)
b. What is static and dynamic memory allocation? Explain with examples, the dynamic memory allocation functions. (10 Marks)
c. What is the output of the following code?
int num[5] .{ 3,4,6,2,1 }; int *p = num; int *q - num + 2;
int *r = &num[l];
Printf(%d %d, num[2], *(num + 2));
Printf(%d %d> *(p + 1));
PrmtfCc%d %d\*q, *(q+l));
Printf(%d %dY*r, *(r+ 1)); (OSMarks)
2 a. Explain the following sing functions, with examples:
i) STRTOK ii) STRCMF iii) STRTOL iv) STRSTR (12 Marks)
b. Write a C program to represent a complex number, using structure and multiply 2 complex numbers. (08 Marks)
3 a. Define stack. List the operations on stack. Write the C implementation of these operations.
(12 Marks)
b. Implement reversing a string, using a stack in C. (OS Marks)
4 a. Write an algorithm for evaluating a valid postfix expression. Trace the same on
1 23 + *321-+* (10 Marks)
b. What is the advantage of circular queue over linear queue? Write C routines for inserting and deleting an element from the circular queue. (10 Marks)
:PART-B
5 a. What is recursion? Write recursion function for finding maximum of n numbers. (08 Marks)
b. Briefly explain the structures of different types of linked lists. Write a C function to count number of elements present in a singly linked list. (12 Marks)
6 a. How can an ordinary queue be represented, using a singly linked list? Write C functions for
linked implementation of ordinary queue insertion and deletion, (10 Marks)
b. Write a C program to perform the following operations on doubly linked list:
i) Insert a node
ii) Delete a node. (10 Marks)
7 a. What are binary trees? Mention different types of binary trees and explain briefly. (06 Marks)
b. Write C functions for the following tree traversals:
i) Inorder
ii) Preorder
iii) Postorder. (06 Marks)
c. Write an algorithm to construct a binary tree for the inputs
14,15,4, 9, 7,18, 3, 5,16,4, 20,17, 9,14, 5 indicating a message for duplicate members. Draw the tree constructed by the above program. (OSMarks)
8 Write short notes on:
a. Unions
b. Circular lists
c. Threaded binary tree
d. Types of files. (20 Marks)
2 of 2
Attachment: |
Earning: Approval pending. |