Sie sind auf Seite 1von 3




1. Define data structure and two dimensional array. Give examples.

Data Structure: Data structure is a particular way of storing and organizing data in a computer.
So that can be used efficiently. Different kinds of data structure are suited to different kinds of
application and same are highly specialized to specific tasks.
For Example: Array, Linked list, Stuck, Queue, Tree, Graph, Hash Table etc.

2. How a two-dimensional array can be represented in computer’s memory? Explain with example.
Ans: The memory of a computer is linear and not a matrix like a 2D array. So, the elements of the array are stored either
by row, called "row-major", or by column, called "column-major". Row-major order is used most notably in C and C++
during static declaration of arrays.
In C, since the length of each row is always known, the memory can be filled row one row at a time, one after the other.
Example: a[i][j] = 1 2 3 4 5 6 7 8 9
Representation in the memory:
In row-major: 1 2 3 4 5 6 7 8 9
In column-major: 1 4 7 2 5 8 3 6 9

1. a) What is two-dimensional array?

Two-dimentional Array: Two-dimentional array is an array that has two dimentions, such as row and column.
It is simplest example of multi-dimentional array.
#define size_row 5
#define size_collumn 5
int array[size_row] [size_column]

b) What is the difference between an array and a record (structure)?

Factor Array Record
i Defination An Array is a finite set of same type data items. A Record is a set of different types of data items.

ii Type It is a collection of Homogenous set. It is a collection of Non- Homogenous set.

iii Elements Each item of a array is called a index. Each item of a record is called a field or attribute.

iv Example For integer Array : int array[20]; Stuct

For float Array : float array[20]; {
For charecter Array : char array[20]; int roll_no;
char *name;
Data Type Arrray Name Array Size int marks;
iii Process The elements of Array are stored in successive
memory location.
2. a) Define linear linked list with example.
Linear Linked List: In computer science, a linked list (or more clearly, "singly-linked list") is a data stucture that consists of
a sequence of nodes each of which contains a referance (i.e., a link) to the next node in the sequence.

A linked list whose nodes contain two fields: an integer value and a link to the next node

b) What is the difference between a program and an algorithm?

An algorithm is an effective method for solving a problem using a finite sequence of instructions. Algorithms are used for
calculation, data processing, and many other fields.

Each algorithm is a list of well-defined instructions for completing a task. Starting from an initial state, the instructions
describe a computation that proceeds through a well-defined series of successive states, eventually terminating in a final
ending state.

A program is a specific set of ordered operations for a computer to perform. In the modern computer that John von
Neumann outlined in 1945, the program contains a one-at-a-time sequence of instructions that the computer follows.
Typically, the program is put into a storage area accessible to the computer. The computer gets one instruction and
performs it and then gets the next instruction. The storage area or memory can also contain the data that the instruction
operates on. (Note that a program is also a special kind of "data" that tells how to operate on "application or user data."

3. a) What is doubly linked list?

Doubly Linked List: A double
linkede is a list that each node contains, besides the next-
node link, a second link field pointing to the previous node in the sequence. The two links
may be called forward(s) and backwards, ornext and prev(ious).

A doubly-linked list whose nodes contain three fields: an integer value, the link forward to the next node, and the link backward to the previous node
b) How a two-dimensional array can be represented in computer’s memory? Explain with example.

3. a) Define circular linked list with example.

Circular Linked List: In the last node of a Linear linked list, the link field often contains a null reference, a special value that is
interpreted by programs as meaning "there is no such node". A less common convention is to make it point to the first node of the list; in

that case the list is said to be circular or circularly linked.

A circular linked list

4. a) Queue is a FIFO structure. Explain with example.

Queue is a linear list where all additions are made at one end , called rear, and all delettions (accesses) are made
from another end called front of the list. So, in a queue there must be two indecators or pointers. One is rear used
to add elements and another is front used to delete (access) the elements from the queue.
Queue is a FIFO (First In and First Out) stucture. That means the elements that is added first will be delete
(accessed) first. As stuck, Queue can be implemented usig array and linked list.