1.Course File Index - Theory
1.Course File Index - Theory
Faculty Timetable
1 2 3 4 5 6 7 8
Period 10.45 to 12:30 –
& 11.00 1:05
8:30 –
Day 9:15 – 10:00 – A.M 11:00 – 11:45 – P.M 1:05 – 1:50 – 2:35 2:35 – 3:20
9:15
10:00 A.M 10:45 A.M 11:45 A.M 12.30 P.M 1:50 P.M P.M P.M
A.M
MON
TUE CS3353
B L
R U
WED E N CS3353
A C
K H
THU CS3353 CS3353
FRI CS3353
TEXT BOOKS:
1. Mark Allen Weiss, “Data Structures and Algorithm Analysis in C”, Second Edition, Pearson
Education, 1997.
2. ReemaThareja, “Programming in C”, Second Edition, Oxford University Press, 2016.
REFERENCES:
1. Brian W. Kernighan, Rob Pike, “The Practice of Programming”, Pearson Education, 1999.
2. Paul J. Deitel, Harvey Deitel, “C How to Program”, Seventh Edition, Pearson Education,
2013.
3. Alfred V. Aho, John E. Hopcroft, Jeffrey D. Ullman, “Data Structures and Algorithms”,
Pearson Education,1983.
4. Ellis Horowitz, SartajSahni and Susan Anderson, “Fundamentals of Data Structures”,
Galgotia, 2008.
ANAND INSTITUTE OF HIGHER TECHNOLOGY
Approved by AICTE, New Delhi. Affiliated to Anna University, Chennai
An ISO 9001:2008 Certified Institution & Accredited by NBA
DEPARTMENT OF ECE
CS3353 C Programming and Data Structures
UNIT- I
1. List the different data types available in C?
Floating-point, integer, double, character. Union, structure, array, etc. The
basic data types are also known as the primary data types in C programming.
2. What do you mean by variables in ‘C’?
Variables are containers for storing data values. In C, there are different
types of variables (defined with different keywords), for example: int - stores
integers (whole numbers), without decimals, such as 123 or -123. float - stores
floating point numbers, with decimals, such as 19.99 or -19.99.
18. What is the difference between while loop and do while loop?
while do while
In the while loop the condition is first In the do…while loop first the
executed. statement is executed and then the
condition is checked.
If the condition is true, then it The do…while loop will execute at
executes the body of the loop. When least one time even though the
the condition is false it comes of the condition is false at the very first
loop. time.
33. What is the main difference between the Compiler and the Interpreter?
Interpreter Compiler
Translates program one statement at a Scans the entire program and translates it as a
time. whole into machine code.
Interpreters usually take less amount of Compilers usually take a large amount of time to
time to analyze the source code. analyze the source code. However, the overall
However, the overall execution time is execution time is comparatively faster than
comparatively slower than compilers. interpreters.
No Object Code is generated, hence are Generates Object Code which further requires
memory efficient. linking, hence requires more memory.
Programming languages like JavaScript, Programming languages like C, C++, Java use
Python, Ruby use interpreters. compilers.
PART-B
1. Explain the different types of operators with neat examples.
ANAND INSTITUTE OF HIGHER TECHNOLOGY
Approved by AICTE, New Delhi. Affiliated to Anna University, Chennai
An ISO 9001:2008 Certified Institution & Accredited by NBA
DEPARTMENT OF ECE
2. Illustrate the different conditional statements available in C with syntax and examples
3. Explain the looping statements with neat examples.
4. What is an Array? Explain Single and Multi-Dimensional arrays with neat examples.
5. Write a C program for Matrix Multiplication with a 3*3 matrix.
6. Create a C program for Matrix Addition.
7. Write a C program to calculate the total, average and grade for 50 Students.
8. Write a C program to calculate the factorial of a given number.
9. Write a C program to check whether a given number is odd or even.
10. Write a C program to check whether a given number is prime or not.
11. Write a C program to check whether a given number is a palindrome or not.
12. Write a C program to check whether a given number is a Armstrong number or not.
UNIT -II
1. What is a pointer? give examples
A pointer is a variable that stores the address of another variable. Example, an integer variable holds (or
you can say stores) an integer value, however an integer pointer holds the address of a integer variable.
2. List the advantages of using pointers
(i) Pointers make the programs simple and reduce their length.
(ii) Pointers are helpful in allocation and de-allocation of memory during the execution of the
program. Thus, pointers are the instruments of dynamic memory management.
(iii) Pointers enhance the execution speed of a program.
(iv) Pointers are helpful in traversing through arrays and character strings. The strings are also
arrays of characters terminated by the null character (‘\O’).
(v) Storage of strings through pointers saves memory space.
3. Outline the use of the function in C?
A function is a block of code which only runs when it is called. You can pass data, known as
parameters, into a function. Functions are used to perform certain actions, and they are important for
reusing code: Define the code once, and use it many times.
4. Demonstrate what is meant by recursion with example
Recursion is the process of repeating items in a self-similar way. In programming languages, if a
program allows you to call a function inside the same function, then it is called a recursive call of the
function.
5. What is meant by structure
Structure in c is a user-defined data type that enables us to store the collection of
different data types. Each element of a structure is called a member.
8. What is Union
Union is a user-defined data type, just like a structure. Union combines objects of different
types and sizes together. The union variable allocates the memory space equal to the space to
hold the largest variable of union. It allows varying types of objects to share the same location
to his/her requirement.
User can only use the function but User can use this type of function.
cannot change (or) modify this User can also modify this function.
function.
PART-B
1. Explain Structure in C with neat program.
2. Write short notes on Union with example program.
3. What is a function? Explain with neat program.
4. Explain call by value and call by reference with example programs.
5. Explain the file handling mechanism in C with programs.
6. Explain preprocessor directives with its types and examples.
7. Explain the concept of pointers with neat programs.
8. Write shorts notes on Arrays.
9. How to write Data into a text file and Read Data from the file? Discuss.
10. How to read and write data to the binary file in a program? Explain.
UNIT - III
1. Define Data Structures
Data Structures is defined as the way of organizing all data items that consider not only the
elements stored but also stores the relationship between the elements.
7. Define a stack
Stack is an ordered collection of elements in which insertions and deletions are
restricted to one end. The end from which elements are added and/or removed is referred to as
top of the stack. Stacks are also referred as piles, push- down lists and last-in-first out (LIFO)
lists.
12. List the various operations that can be performed on data structure.
➢ Various operations that can be performed on the data structure are
• Create
• Insertion of element
• Deletion of element
• Searching for the desired element
• Sorting the elements in the data structure
• Reversing the list of elements.
22. State the properties of LIST abstract data type with suitable example.
➢ It is linear data structure in which the elements are arranged adjacent to each other.
➢ It allows to store single variable polynomial.
➢ If the LIST is implemented using dynamic memory, then it is called linked list.
Example of LIST are- stacks, queues, linked list.
23. State the advantages of circular lists over doubly linked list.
➢ In circular list the next pointer of last node points to head node, whereas in doubly linked
list each node has two pointers: one previous pointer and another is next pointer.
➢ The main advantage of circular list over doubly linked list is that with the help of single
pointer field we can access head node quickly. Hence some amount of memory get saved
because in circular list only one pointer is reserved.
24. What are the advantages of doubly linked list over singly linked list?
➢ The doubly linked list has two pointer fields. One field is previous link field, and another is
next link field. Because of these two pointer fields we can access any node efficiently whereas
in singly linked list only one pointer field is there which stores forward pointer.
ANAND INSTITUTE OF HIGHER TECHNOLOGY
Approved by AICTE, New Delhi. Affiliated to Anna University, Chennai
An ISO 9001:2008 Certified Institution & Accredited by NBA
DEPARTMENT OF ECE
25. Why is the linked list used for polynomial arithmetic?
➢ We can have separate coefficient and exponent fields for representing each term of
polynomial. Hence there is no limit for exponent. We can have any number as an exponent.
PART B
1. Explain Singly Link List with algorithm and examples.
2. How insertion and deletion are performed on a singly linked list? Explain with pseudocode
and examples
3. Explain Doubly Linked List with examples and algorithms.
4. Explain Array based implementation of List ADT with examples and pseudocode.
5. Explain Array based implementation of Stack ADT with examples.
6. Demonstrate the implementation of circular linked list with examples.
7. Explain the applications of stack with examples.
8. Write short notes on queue ADT.
9. How are insertion and deletion operations performed in a queue? Explain with examples and
pseudocode.
10. Explain the implementation of priority queue with examples and pseudocode.
11. Explain queue implementation using linked list with pseudocode and examples.
12. Explain queue implementation using stack with pseudocode and examples.
UNIT -IV
1. Define a tree
A tree is a collection of nodes. The collection can be empty; otherwise, a tree consists
of a distinguished node r, called the root, and zero or more nonempty (sub) trees T1, T2,…,Tk,
each of whose roots are connected by a directed edge from r.
2. Define root
This is the unique node in the tree to which further sub-trees are attached.
B
ANAND INSTITUTE OF HIGHER TECHNOLOGY
Approved by AICTE, New Delhi. Affiliated to Anna University, Chennai
An ISO 9001:2008 Certified Institution & Accredited by NBA
DEPARTMENT OF ECE
Here, A is the root.
19. List out the steps involved in deleting a node from a binary search tree.
➢ Deleting a node is a leaf node (ie) No children
➢ Deleting a node with one child.
➢ Deleting a node with two Childs.
PART-B
1. Explain the tree traversal techniques with an example.
2. Construct an expression tree for the expression (a+b*c) + ((d*e+f)*g). Give the outputs when
you apply inorder, preorder and postorder traversals.
3. How to insert and delete an element into a binary search tree and write down the code for the
insertion routine with an example.
4. Create a binary search tree for the following numbers start from an empty binary search tree.
45,26,10,60,70,30,40 Delete keys 10, 60 and 45 one after the other and show the trees at each
stage.
5. Explain Open Addressing techniques in detail.
UNIT -V
1. Define sorting
Sorting arranges the numerical and alphabetical data present in a list in a specific order or
sequence. There are a number of sorting techniques available. The algorithms can be chosen based
on the following factors – Size of the data structure – Algorithm efficiency – Programmer’s
knowledge of the technique.
6. Define searching
Searching refers to determining whether an element is present in a given list of elements or not. If
the element is present, the search is considered as successful, otherwise it is considered as an
unsuccessful search. The choice of a searching technique is based on the following factors
a. Order of elements in the list i.e., random or sorted
b. Size of the list
11.What is sorting?
➢ Sorting refers to arranging data in a particular format. Sorting algorithm specifies the way to
arrange data in a particular order.
21. Why quick sort is preferred for arrays and merge sort for linked lists?
➢ Quick sort is an in-place sorting algorithm, i.e. which means it does not require any additional
space, whereas Merge sort does, which can be rather costly. In merge sort, the allocation and
deallocation of the excess space increase the execution time of the algorithm.
➢ Unlike arrays, in linked lists, we can insert elements in the middle in O(1) extra space and O(1)
time complexities if we are given a reference/pointer to the previous node. As a result, we can
implement the merge operation in the merge sort without using any additional space.
PART - B
1. Explain Insertion sort with algorithm and examples.
2. Sort the sequence 13,11,74,37,85,39,22,56,25 using insertion sort.
3. Explain the operation and implementation of merge sort.
4. Write quick sort algorithm and explain with an example.
5. Trace the quick sort algorithm for the following list of numbers. 90,77,60,99,55,88,66
6. Explain linear search algorithm with an example.
7. Explain Binary search algorithm with an example.
8. Write down the merge sort algorithm and give its worst case, best case and average case
analysis.
9. Explain Heap Sort algorithm with an example