×
FOCUS ON THE DESTINATION NOT THE DIFFICULTIES

• Note
• uttar pradesh technical university - uptu
• Computer Science Engineering
• 1231 Views
Page-2

Topic: / 116

0 User(s)

#### Text from page-2

Q.1 What is data type? Ans. A Data type refers to a named group of data which share similar properties or characteristics and which have common behavior among them. Three fundamental data types used in C programming are int for integer values, float for floating-point numbers and char for character values. Q.2 What is data structure? Ans. A Data structure is a named group of data of different data types which can be processed as a single unit. or Data structure is representation of the logical relationship existing between individual elements of data. In other words, a Data structure is a way of organizing all data items that considers not only the elements stored but also their relationship to each other. or Data structures are the building blocks of a program. And hence the selection of particular data structure stresses on the following two things : 1. The data structures must be rich enough in structure to reflect the relationship existing between the data. 2. And the structure should be simple so that we can process data effectively whenever required. Q.3 What is an algorithm? Ans. An algorithm is a step-by-step procedure to solve a particular function i.e., it is a set of instructions written to carry out certain tasks and the data structure is the way of organizing the data with their logical relationship maintained. Q.4 Give the classification of data structure in brief. Ans. Data structures are normally divided into two broad categories.  Primitive Data Structures(built-in)  Non-Primitive Data Structures(user defined) Q.5 What is primitive data structure? Ans. These are basic structures and are directly operated upon by the machine instructions. These, in general, have different representations on different computers. Integers, floating-point numbers, character constants, string constants, pointers etc. fall in this category. By:Ruchi khetan (Assistant Professor) ruchi.khetan10@gmail.com 2

#### Text from page-3

Q.6 What is non primitive data structure? Ans.  These are more complicated data structures. These are derived from the primitive data structures. The non-primitive data structures emphasize on structuring of a group of homogeneous (same type) or heterogeneous (different type) data items. Arrays, structures, lists and files are examples.  The data appearing in our data structures are processed by means of certain operations. In fact, the particular data structure that one chooses for a given situation depends largely on the frequency with which specific operations are performed. Q. 7 Draw the block diagram for the classification of data structure. Ans. Q.8 Write down the different operation of data structure. Ans. The basic operations that are performed on data structures are as follows : 1. Traversing : Accessing each record exactly once so that certain items in the record may be processed. (This accessing and processing is sometimes called “visiting” the record). 2. Searching : Searching operation finds the presence of the desired data item in the list of data item. It may also find the locations of all elements that satisfy certain conditions. 3. Inserting : Inserting means addition of a new data element in a data structure. 4. Deleting : Deleting means removal of a data element from a data structure. The following two operations, which are used in special situations, will also be considered : (1) Sorting : Sorting is the process of arranging all data items in a data structure in a particular order say for example, either in ascending order or in descending order. (2) Merging : Combining the records of two different sorted files into a single sorted file. By:Ruchi khetan (Assistant Professor) ruchi.khetan10@gmail.com 3

#### Text from page-4

Q.9 State the difference between array and link list . Ans. Array  Size of any array is fixed  It is necessary to specify the number of elements during declaration  It occupies less memory than a linked list. Link List  Size of list is variable  It is not necessary to specify the number of elements during declaration.  Q.10 Explain time and space complexity? Ans. Complexity of algorithm is a function of size of input of a given problem instance which determines how much running time/memory space is needed by the algorithm in order to run to completion. Time Complexity: Time complexity of an algorithm is the amount of time it needs in order to run to completion. Space Complexity: Space Complexity of an algorithm is the amount of space it needs in order to run to completion. There are two points which we should consider about computer programming:5. An appropriate data structure and 6. An appropriate algorithm. Q.11 Explain Asymptotic Big- Oh notation? Ans. Big-Oh Notation (O): It provides possibly asymptotically tight upper bound for f(n) and it does not give best case complexity but can give worst case complexity. Let f be a nonnegative function. Then we define the three most common asymptotic bounds as follows. We say that f(n) is Big-O of g(n), written as f(n) = O(g(n)), iff there are positive constants c and n0 such that 0 ≤ f(n) ≤ c g(n) for all n ≥ n0 If f(n) = O(g(n)), we say that g(n) is an upper bound on f(n). By:Ruchi khetan (Assistant Professor) ruchi.khetan10@gmail.com 4

#### Text from page-5

Q.13 Explain Asymptotic Big- Omega notation? Ans. Big-Omega Notation (Ω): It provides possibly asymptotically tight lower bound for f(n) and it does not give worst case complexity but can give best case complexity f(n) is said to be Big-Omega of g(n), written as f(n) = Ω(g(n)), iff there are positive constants c and n0 such that 0 ≤ c g(n) ≤ f(n) for all n ≥ n0 If f(n) = Ω(g(n)), we say that g(n) is a lower bound on f(n). Q.14 Explain Asymptotic Big- Theta notation? Ans. We say that f(n) is Big-Theta of g(n), written as f(n) = Θ(g(n)), iff there are positive constants c1, c2 and n0 such that 0 ≤ c1 g(n) ≤ f(n) ≤ c2 g(n) for all n ≥ n0 Equivalently, f(n) = Θ(g(n)) if and only if f(n) = O(g(n)) and f(n) = Ω(g(n)). If f(n) = Θ(g(n)), we say that g(n) is a tight bound on f(n). By:Ruchi khetan (Assistant Professor) ruchi.khetan10@gmail.com 5