Unit 1 Important Questions for Data Structure
2-Marks Important Question
****************************************************Related Post
Most Frequently asked Question
Long Answer Question
***********************************************************************************
Q1: Define the
term data structure. List some linear and non-linear data structures starting
the application area where they will be used?
OR
Differentiate
between Linear and Non-Linear Data structures?
Solution:
Data Structure can define as a means or way of organizing data in memory so that it can be used efficiently. or It can be define as a mathematical model of particular organization of Data.
Data structure are broadly classified into two types
- Linear type Data Structure
- non-Linear type Data Structure
Linear Type Data Structure :
Linear Type Data Structure are the data structure which organize the data in linear manner means one after another like Array, linked list, Queue, Stack
Non Linear Type Data Structure :
Non Linear Type Data Structure are the data structure which organize the data in non linear manner means in certain relationship like parents child relation in case tree. Tree and graph are the example of non linear data structure.
Application of Data Structure
1. As it is the basic
building block of a program, it
improves the efficiency of program because
it is a time-consuming task to find any data form
a large set of unorganized data than a large set of organized data.
2.
Second application
of data structure is to organize the data in a systematic manner.
****************
Q2: Name few
terminologies used in data structure?
Solution:
Here is the list of terminology used in data structure
1. Data:
Data is raw, facts and figure like Name, Roll number, Phone Number etc.
2. Information:
Meaning full or Processed data is called Information. we can say like that individually data not have any meaning they a just like any value but when we process it or organize it in meaning full sentence or set then it become Information.
3. Record:
Record is the collection of different type of data item organized in certain sequence like structure in C. like student record contain all the data related to student in certain sequence like first Roll no, Name, Father Name, Mother Name, contact no etc.
4. File:
File is the collection similar type of records.
5. Data Structure:
Data Structure is a means or way of organizing data in memory so that it can be used efficiently.
*****************
Q3: What are the
data types used in C?
There are lot of data type used in C some of them is as following
Integer, Float, Char
Q4: Name some
primitive and non-primitive data types?
Primitive data types are data types which already exist in the programming language like Int , Float, Char, Double etc.
Non Primitive data type are the data type which are derived from primitive data type like Array, Stack, Queue, Structure etc.
Q5: Define an
algorithm?
Q6: Give the
criteria that an algorithm must satisfy?
Note that In this question examiner is tiring to ask same Characteristics of Algorithm
An algorithm must satisfy the following criteria
1. It should have finite number of steps
2. The statement of algorithm must be unambiguous
3. It should have clearly specify Input and Output.
4. the algorithm should be efficient in term of Space and Time.
characteristics of an algorithm?
Q8: What are the
different ways of analyzing an algorithm? Sol. Analyzing an algorithm means finding the complexity of an algorithm. The
complexity of algorithm is a function f(n) which measures the time and space
used by an algorithm in terms of input size ‘n’.
So we can analyze the algorithm by finding the time and space complexity of algorithm.
**********************
complexity?
Sol. The complexity of algorithm is a function f(n) which measures the time and space used by an algorithm in terms of input size ‘n’.
- Time complexity
- Space complexity
**********************
Q10: What is
space and time complexity of an algorithm?
Sol. Space
complexity refers to the space
used by an algorithm to solve any particular problem.
Time
complexity refers to the time required
by an algorithm to solve any particular problem.
Q11: What are
the various asymptotic notations? Explain the Big Oh notation?
Q12: Define
time-space tradeoff?
Sol. Space time tradeoff is a way of solving problems
or calculation in less time by using more storage space (on memory), or by
solving a problem in very small space by spending a long time. A space trade
can be used with the problem of data storage.
For example Suppose you want to reverse a String there are two procedure to do this
1.You can make use of Stack, Simply place all the elements in stack and print it by Appling Pop operation one by one.
2.You can perform this by applying simple comparing the element.
In approach one there is a need of extra storage in term of stack but time require to perform this is very less, in comparison to second approach but in second approach there is no need of extra storage.
Q13: Write down
the properties of abstract data types (ADT)?
Q14: What do you
mean by an array?
Q15: What are
the merits and demerits of array data types?
Q16: Define
Pointer?
Sol. Pointer is a variable which contain the address of another variables.
Syntax: – data type *ptr;
Q17: Differentiate
between array and pointers?
1. Array is a collection of similar type of data elements. It is a pointer variable the hold base address of array and pointing to the large set of similar type of elements.
but Pointer is a variable which contains the address of another variables.
2. Syntex for declaring array is
data type name_of_ array[size of array]
Syntax for declaring pointer variable
data type *ptr;
3. Array is used to store elements of same data type. but
Pointers are used to store address of variable.
************************
Q18:
Differentiate between overflow and underflow condition of a linked list?
Q19: Write a
function to reverse the list?
Q20: Given a 2-D
array A {-100: 100, -5: 50}. Find the address of element A {99,49} considering
the base address 10 and each element requires 4 bytes for storage. Follow row
major order ?
Sol. Given, a 2-D array A {-100:100, -5:50}.
Base address, b = 10
Size of element, w = 4
A {99,49} =?
Number of rows = Upper Bound – Lower Bound + 1
= 100-(-100) +1 = 201
Number of columns = Upper Bound – Lower Bound + 1
=50-(-50) +1 = 56
Row Major: –
A {99,49} =10+ [(99-(-100))56 + (49 – (-5))]4
=10+ [(99+100)56 + (49+5)]4
=10+ [(199)56 + (54)]4
=10+ [11144+54]4
=10+ [11198]4
=10+ 44792
=44802
*************************
Q21: What is
Sparse matrix? Explain the application of sparse matrix?
Sol. A matrix contains more number of zero elements than non-zero elements such matrix is called Sparse matrix.
**********************
Q22: How can you
represent a sparse matrix in memory?
Sol. There are
two ways to represent a sparse matrix:
1. Array
representation
2. Linked
List representation
************************
Q23: List some
operations on linked list?
Sol. Following are some of the operations on linked list:
Traversal, Insertion, Deletion, Searching, Sorting, Merging, Updating