Job Saarnee

# 2 Marks Important Questions of Data Structure (Unit 1)

### 2 Marks Important Questions of Data StructureÂ Important Question

This blog cover 2 Marks Important Questions of Data Structure from Unit 1 for more you read over blog from the link provided below at the end of this blog that cover all the data structures important questions alone with the program related to the data structure for more data structures important questions and answers please visit over complete blog link provided below.

In this blog post, we’ll delve into two-mark questions, a succinct yet insightful approach to grasp fundamental aspects of data structures. These questions, often encountered in examinations and technical interviews, distill complex concepts into concise points, demanding clarity of thought and a firm grasp of the underlying principles.

### 2 Marks Important Questions of Data Structure

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

1. Â Linear type Data StructureÂ
2. 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?

Solution: 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?
Solution:

1. Primitive data types are data types which already exist in the programming language like Int , Float, Char, Double etc.
2. 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?

Solution:
Algorithm is a step by step procedure to solve any problem.
Example: Algorithm of Making Tea
ProblemÂ Statement: How to Make a Tea.
Step1: Take cup of water in a bowl.
Step2: then place the bowl on to gas and switch on the gas.
Step3: Then after 2 min add two spoon of tea and sugarÂ  according to yours tasteÂ
Step4: Then After when tea get boiled, add some amount of milkÂ
Step5: Then fill the tea in the cup and serve it to friend
Note:Â  There can be more than one algorithm for single problem.

Q6: Give the criteria that an algorithm must satisfy?

Solution:

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.

Q7: What are the characteristics of an algorithm?
Solution:
Algorithm is a step by step procedure to solve any problem.
An Algorithm have following Characteristics:-
1. Input:Â An algorithm take an input so there need to specifies the input of an algorithm. an algorithm can have zero or more well define inputs.
2. Output:Â An algorithm provides output after processing the input. an algorithm can have 1 or more outputs.
3. Finite: An algorithm should have finite number of steps mean an algorithm must terminate after finite number of steps.Â Â
4. Ambiguous:Â An Algorithm should have clear and unambiguous statement means statement of algorithm must have single meaning.Â Â
5. Efficiency: Efficiency is the another characteristics of algorithm mean the algorithm must be efficient in term of space and time.
6. Feasibility: An Algorithm should be feasible mean that it is possible to implement in any language.Â  Â  Â Â

Q8: What are the different ways of analyzing an algorithm?

Solution:

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.Â

Q9: Define complexity?

# 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’.

There are two type of ComplexityÂ
1. Time complexityÂ
2. Space complexity

Q10: What is space and time complexity of an algorithm?

# Solution:

#### 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?

# Solution:

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?
Solution:

Pointer is a variable which contain the address of another variables.
Syntax: – data typeÂ  Â *ptr;

Q17: Differentiate between array and pointers?

Solution:
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Â ?
Solution:

Given, a 2-D array A {-100:100, -5:50}.
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?Â  Â  Â Â
Solution: 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?
Solution: There are two ways to represent a sparse matrix:
1.Â Array 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