CBSE - MCQ Question Banks (के. मा. शि. बो . -प्रश्नमाला )

PreviousNext

Q. 190701 Sequential search is also known as


A. binary search.

B. unary search.

C. linear search.

D. random search.

Right Answer is: C

SOLUTION

In linear search, each element of array is compared with the given Item to be searched for, one by one. This method, which traverses the array sequentially to locate the given Item, is called linear search or sequential search.


Q. 190702 Examples of Compound linear data structures are


A. structures, trees.

B. linked lists, queues, arrays.

C. arrays, stacks.

D. stacks, queues.

Right Answer is: D

SOLUTION

Simple data structures can be combined in various ways to form more complex structures called compound structures. Compound data structures are classified into following two types: Linear data structures and Non - linear data structures.


Q. 190703 If an array has elements numbered as -2, -1, 0, 1, 2, 3, 4...15, then its array length is


A. 18.

B. -18.

C. 15.

D. -15.

Right Answer is: A

SOLUTION

In the given array, the UB (upper bound) is 15 and LB (lower bound) is -2. The array length can be calculated by the formula :
Array size (length) = UB - LB + 1
                              = 15 - (-2) +1
                              = 18


Q. 190704 If an array has elements numbered as -4, -3, -2, -1, 0, 1, 2, 3, 4...10, then its UB is


A. -4.

B. 10.

C. 0.

D. 4.

Right Answer is: B

SOLUTION

In the given array, the UB (upper bound) is 10 and LB (lower bound) is -4. We can also calculate the array length by the formula :
Array size (length) = UB - LB + 1.


Q. 190705 A simple data structure is a


A. group of data made of fundamental data types.

B. group of data made of other data structures.

C. single unit made of different structures.

D. single unit made of arrays of char and int type.

Right Answer is: A

SOLUTION

Simple data structures are normally built from primitive data types like integers, reals, characters, boolean. For example, a) array b) structure.


Q. 190706 Fundamental data types in C++ are


A. char, int, float, real, double.

B. char, natural, float, real.

C. char, int, float, double, void.

D. char, int, real, double, void.

Right Answer is: C

SOLUTION

Primitive data types are those data types, which are not composed of other data types. C++ names primitive data types as standard or fundamental data types. Primitive data types are Integer, Real and Character data types.


Q. 190707 The base address of an array is the address of


A. first element.

B. second element.

C. third element.

D. last element,

Right Answer is: A

SOLUTION

The base address of an array is the address of the first element in the array and always appears in the lowest memory location. The second array element directly follows the first in memory, the third element follows the second etc.


Q. 190708 Binary search can be performed on


A. arrays sorted only in ascending order.

B. arrays sorted only in descending order.

C. sorted arrays.

D. arrays that are unsorted.

Right Answer is: C

SOLUTION

In computer science, linear search is a search algorithm, also known as sequential search, that is suitable for searching a list of data for a particular value.


Q. 190709 Linear search can be performed


A. only on arrays sorted in ascending order.

B. only on arrays sorted in descending order.

C. on any kind of array.

D. on arrays that are unsorted.

Right Answer is: C

SOLUTION

In computer science, linear search is a search algorithm, also known as sequential search, that is suitable for searching a list of data for a particular value.


Q. 190710 An array is declared as ARR[-12 .. 6]. Its length is


A. 12.

B. 6.

C. 19.

D. 18.

Right Answer is: C

SOLUTION

The array size (length) = UB - LB + 1. Here, the upper bound is 6 and lower bound is -12. Therefore, 6-(-12) = 6 + 12 = 19. Thus, length of an array will be 19 as the declaration is from -12 to 6.


Q. 190711 Each node in a singly linked list has


A. one pointer pointing to the next node.

B. two pointers, one pointing to the next and the other to the previous node.

C. one pointer pointing to the last node.

D. two pointers, one pointing to the first and the other to the last node.

Right Answer is: A

SOLUTION

A singly-linked list is the most basic of all the linked data structures. It is simply a sequence of dynamically allocated objects, each of which refers to its successor in the list.


Q. 190712 A stack is a


A. FILO list.

B. LIFO list.

C. FIFO list.

D. LILO list.

Right Answer is: B

SOLUTION

In computer science, a stack is a "last in, first out(LIFO)" abstract data type and data structure. A stack can have any abstract data type as an element, but is characterised by only two fundamental operations, the push and the pop.


Q. 190713 A queue is a


A. FILO list.

B. LIFO list.

C. FIFO list.

D. LILO list.

Right Answer is: C

SOLUTION

In a FIFO data structure, the first element added to the queue will be the first one to be removed.


Q. 190714 Bottommost nodes of the tree are called


A. flowers.

B. tips.

C. leaves.

D. roots.

Right Answer is: C

SOLUTION

Topmost node is called the root of the tree and the bottommost nodes are called leaves of the tree.


Q. 190715 The fundamental data types which are not composed of other data types are known as


A. non-primitive data types.

B. primitive data types.

C. structured data types.

D. non-structured data types.

Right Answer is: B

SOLUTION

Primitive data types are those data types which are not composed of other data types. In C++, primitive data types are known as standard or fundamental data types. Primitive data types are Integer, Real and Character data types.


Q. 190716 A simple data structure is a


A. group of data, made of fundamental data types.

B. group of data, made of other data structures.

C. single unit made of different structures.

D. single unit made of arrays of char and int type.

Right Answer is: A

SOLUTION

In computer science, a data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently.


Q. 190717 The basic operations on arrays are:


A. Editing, Traversal, Searching, Creation.

B. Creation, Printing, Modification, Traversal.

C. Creation, Printing, Traversal, Sorting.

D. Creation, Traversal, Deletion, Searching, Sorting.

Right Answer is: D

SOLUTION

An array is a systematic arrangement of objects, usually in rows and columns. Operations on arrays include: Creation, Traversal, Deletion, Searching, Sorting.


Q. 190718 The mid element is compared repeatedly with the value to search, in


A. binary search.

B. linear search.

C. quick search.

D. tree search.

Right Answer is: A

SOLUTION

Binary search searches for the given ITEM in a sorted array. The search segment reduces to half at every successive stage. To search for ITEM in a sorted array, the ITEM is compared with the middle element of the segment.


Q. 190719 Each element is compared sequentially with the value to search in


A. binary search.

B. linear search.

C. quick search.

D. tree Search.

Right Answer is: B

SOLUTION

In computer science, linear search is a search algorithm, also known as sequential search, that is suitable for searching a list of data for a particular value. It operates by checking every element of a list one at a time in sequence until a match is found.


Q. 190720 What is the prerequisite for Binary Search method?
Right Answer is:

SOLUTION

The array should be sorted for Binary Search to work.  Also, the upper and lower bounds for the array should be known, as mid point is calculated.     

 


Q. 190721 What is the length of the given array?             
ARR [ -3 .. 4]
Right Answer is:

SOLUTION

Length  = UB – LB + 1

where UB  (or  Upper Bound)  = 4

          LB  (or Lower Bound)   =  -3

         Size = 4  - ( -3) +1

                = 8      


Q. 190722 What is the difference between an array and a structure?
Right Answer is:

SOLUTION

An array is a collection of elements of the same data type.  Each array element is referenced using the index or subscript.  A structure has members of different data types.  The members in the structure are accessed using the dot  ‘.’ operator.     


Q. 190723 Each element of the array A[-10 .. 5,  5 .. 15]  takes  1 byte.  Its base address is given as 1000.  Calculate the address of   A[ -5, 8].  The array is in column major.
Right Answer is:

SOLUTION

Address of A[ i ] [ j ]  =  B + W( nr( j – LB_C) + ( i – LB_R))
Here,   B = 1000         nr = 16

           W = 1                 LB_R = -10

           i = -5                  LB_C = 5

           j = 8

Address of A[-5, 8] = 1000 + 1( 16(8 - 5)  +  ( -5 – (-10)  )

                              = 1053                                                  


Q. 190724 X is a 2D array defined as [-2 .. 4,  -3 .. 4].  Each element of the array takes up 2 bytes.  Its base address is given as 2000.  Calculate the address of   X[2,3], if the array is stored in row major  form.
Right Answer is:

SOLUTION

Address of X[ i ] [ j ]  =  B + W( nc(i – LB_R) + (j – LB_C))
Here,  B = 2000          nc = 8

 

          W = 2                 LB_R = -2

           i = 2                   LB_C = -3

           j = 3

Address of A[i , j]     = 2000 + 2( 8( 2 - (-2) ) + (3 - (-3)  )

                              =   2070                     


Q. 190725 How are two-dimensional arrays implemented in memory?
Right Answer is:

SOLUTION

An array is allocated contiguous storage in memory. For this, the 2D array is linearized. This can be  done in two ways – Row Major or Column Major. 
In Row Major form, the first row is stored followed by the second row and so on. In Column Major, the first column is stored followed by the second column and so on. The computer keeps track of the starting address of the array (base address) and accesses the element by calculating its address.  


Q. 190726 Using the array below, give the status at the end of each pass using  insertion sort method.    12   24    26    28   11   13   25    27
Right Answer is:

SOLUTION


After I -          12    24    26    28    11    13    25    27

After II -         12    24    26    28    11    13    25    27

 

After III -        12    24    26    28   11     13    25    27

 

After IV -        11    12    24    26    28    13    25    27

 

After V -         11    12    13    24    26    28    25    27

 

After VI -        11    12    13    24    25    26    28    27

 

After VII -       11    12    13    24    25    26    27    28          


Q. 190727 Using the array below, give the status at the end of each pass using bubble sort method.
2   4    16    28   11   3   25    27
Right Answer is:

SOLUTION


After I-     2          4         16          11           3          25          27          28
After II -   2          4         11           3          16          25          27          28

After III -  2          4          3          11          16          25          27          28

After IV -  2          3          4          11          16          25          27          28

After V -   2          3          4          11          16          25          27          28

After VI -  2          3          4          11          16          25          27          28

After VII - 2          3          4          11          16          25          27          28

After VIII -2          3          4          11          16          25          27          28   


Q. 190728 An array is given below.  Give the status at the end of each pass using selection sort method.             2   4    6    8   1   3   5    7
Right Answer is:

SOLUTION


After I -          1             4            6          8        2           3        5            7
After II -         1             2            6          8        4           3        5            7

After III -        1             2            3          8        4           6        5            7

After IV -        1             2            3          4        8           6        5            7

After V -         1             2            3          4        5           6        8            7

After VI -        1             2            3          4        5           6        8            7

After VII -       1             2            3          4        5           6        7            8        


Q. 190729 What is the difference between Linear and Binary Search?
Right Answer is:

SOLUTION

They are both searching techniques.  Linear Search can be used on sorted or unsorted arrays. It involves comparing each array element with the given value.

Algorithm for Linear Search
1.  SET ctr = 0                                            // 0 is the Lower Bound of the array

2.  REPEAT STEPS 3   to  4 UNTIL ctr > UB      // check each element of the array

3.  IF A[ctr] = Val  THEN                            // compare value and array element

         {  

              PRINT   Val,  “located  at “, ctr
              GO TO 6
          }
4.  ctr = ctr + 1                                                  // increment counter

5.IF  ctr > UB THEN

             PRINT    Val,  “Not in array”
6.  END


Binary Search can be used only on sorted arrays. It is considered more efficient than Linear Search as the number of comparisons are much less.   It first compares the value and the middle element of the array.  As it is a sorted array, if the value is less than the middle element, the elements in the left half should be checked otherwise if the value is greater than the middle element, the right half of the array should be checked.  This process is done repeatedly till the element is located or declared ‘not found’.

Algorithm for Binary Search with array sorted in ascending order

1.  SET low = LB, up = UB               // UB and LB are upper and lower bounds

2.  REPEAT STEPS 3   to  6 UNTIL low > up //  repeat until low  goes beyond up

3.  m = INT( low + up) / 2                               // find mid point of array

4.  IF A[ m ] = Val  THEN          // compare value and array element

         {   PRINT   Val,  “located  at “, m + 1

             GO TO 7

       }
5.  IF A [ m ] < Val THEN 

           low = m + 1

6.  IF A[ m ] > Val THEN 

           up = m - 1

7.  END               


Q. 190730 What is an array?  How are one-dimensional arrays different from two-dimensional arrays?
Right Answer is:

SOLUTION

An array is a collection of finite elements of the same data type, placed contiguously in memory. Each array element can be referenced using index or subscript numbers.

Arrays can be one-dimensional or multi-dimensional.

A one–dimensional array is declared with one size specification. Each element is accessed using the array name and index number which refers to its location.  In array  A[10], the elements can be accessed as A[0], A[1] and so on.  

 

A two–dimensional array can be regarded as an array of arrays. It requires 2 size specifiers. It is a kind of multi-dimensional array. To declare an integer array named AX with 4 rows and 8 columns, give

    int  AX[4][8];

Elements can be accessed as AX[r][c]  where r is the row and c the column number. Remember in C++, the row and column numbers start from 0.                         


Q. 190731 What will be the address of the elements ARR[2]  and ARR[-1] in an array ARR[-5 .. 9] that has the base address 4500 and element size 2?
Right Answer is:

SOLUTION

Address of ARR[i] =  B + W(i – LB)

where  B is Base Address,  W is element size and LB is Lower Bound of the array.

B = 4500                           W = 2

i = 2                                 LB = -5

Address of ARR[ i ] = 4500 + 2( 2 – (-5))

                             =  4514

           

B = 4500                           W = 2

i = -1                                LB = -5

Address of ARR[ i ] = 4500 + 2( -1 – (-5))

                              = 4508

                            


Q. 190732 Write a function binary() that accepts an integer array  and the value to search and returns the position at which it is found(if found), using the Binary Search technique.
Right Answer is:

SOLUTION

int binary(int A[ ], int n)
                
int pos, l, u, m;

pos=-1;

l=0;

u=9;

while(l <= u){

    m=(u + l)/2;

    if(A[m]==n){

         pos=m+1;

         break;

    }

    if(A[m]>n)

         u=m-1;

    else

       if(A[m] < n)

           l=m+1;

}

return pos;

      }      


Q. 190733 Write a function linear() that accepts an integer array and the value to search and returns the position at which it is found(if found), using the Linear Search technique.
Right Answer is:

SOLUTION

int linear(int A [ ],  int n){
      int i, pos = -1;
      for(i=0; i < 10 ; i++)
         if(A[ i ] == n){
            pos = i+1;
            break;
        
}
     return pos; 
}    

 

 


Q. 190734 LIFO stands for


A. long int first out.

B. long in first out.

C. last in from out.

D. last in first out.

Right Answer is: D

SOLUTION

LIFO is an acronym, which stands for last in, first out. It refers to the organization of data elements in memory in LIFO manner.


Q. 190735 The data structure, which is used to convert infix expression into postfix expression, is


A. stack.

B. queue.

C. linked list.

D. tree.

Right Answer is: A

SOLUTION

We can convert infix expression to the postfix by using stack and we can also evaluate the postfix expression using the stack.


Q. 190736 The elements stored in a sequence is called as


A. sequential elements.

B. list.

C. order.

D. memory elements.

Right Answer is: B

SOLUTION

"List" is the collection of elements stored in a sequential order.


Q. 190737 The processing of all the nodes of the linked list one by one is known as


A. execution.

B. node detection.

C. traversal.

D. reversal.

Right Answer is: C

SOLUTION

Traversal refers to the process of visiting each node in a data structure, exactly once, in a systematic way. Such traversals are classified by the order in which the nodes are visited.


Q. 190738 A part of linked list that stores information of an element is known as


A. cell.

B. heap.

C. node.

D. storage area.

Right Answer is: C

SOLUTION

A node is an abstract basic unit used to build linked data structures such as trees, linked lists, and computer-based representations of graphs. Each node contains some data and possibly links to other nodes. Pointers or references often used to implement links between nodes.


Q. 190739 Process to add released memory to the free pool is known as


A. memory creation.

B. memory collection.

C. garbage collection.

D. memory addition.

Right Answer is: C

SOLUTION

In computer science, garbage collection (GC) is a form of automatic memory management. The garbage collector attempts to reclaim garbage, or memory used by objects that will never be accessed or mutated again by the application.


Q. 190740 A list keeping account of available free memory is known as


A. free pool.

B. free spool.

C. free space.

D. free tree.

Right Answer is: A

SOLUTION

If the memory is not utilized, then it is stored in a separate area known as free pool. It is also known as AVAIL list.


Q. 190741 An expression where operators are placed in between the operands is known as


A. postfix expression.

B. infix expression.

C. prefix expression.

D. outfix expression.

Right Answer is: B

SOLUTION

Infix notation is the common arithmetic and logical formula notation, in which operators are placed in between the operands. For Example: a + b


Q. 190742 Double-ended queue where elements can be added or removed from either end is known as


A. circular queue.

B. input restricted queue.

C. output restricted queue.

D. dequeue.

Right Answer is: D

SOLUTION

Deque(double-ended queues) are the refined queues in which elements can be added or removed at either end but not in the middle.


Q. 190743 A linear structure implemented in circular form rather than a straight line, is known as


A. queue.

B. oval queue.

C. circular queue.

D. ellipse queue.

Right Answer is: C

SOLUTION

A queue implemented within an array, where the first element of the array logically follows the last element is known as circular queue.


Q. 190744 When we try to delete an element from the empty stack is called as


A. outflow.

B. overflow.

C. autoflow.

D. underflow.

Right Answer is: D

SOLUTION

When there is no element left in the stack and deletion operation is performed on it,then it is the case of underflow.


Q. 190745 An insertion in a stack is called


A. pushing.

B. popping.

C. pulling.

D. dumping.

Right Answer is: A

SOLUTION

The push operation adds an element to the list. Pushing an element in the stack involves adding of data item at the top of the list.


Q. 190746 Combination of elements of two data structures to form a new data structure is known as


A. searching.

B. union.

C. merging.

D. concatenation.

Right Answer is: C

SOLUTION

Merging is an operation performed on data structure in which elements of two similar data structure are combined to form a new data structure of the same type.


Q. 190747 When a stack, implemented as an aray, is full and no new element can be accomodated, it is called


A. outflow.

B. underflow.

C. overflow.

D. autoflow.

Right Answer is: C

SOLUTION

There is a situation in an array when we try to insert or add an element into a full array. It leads to an overflow condition.


Q. 190748 A linear structure implemented in a FIFO manner is known as


A. stack.

B. queue.

C. tree.

D. graph.

Right Answer is: B

SOLUTION

A queue is FIFO structure where insertions take place at the "rear" end and deletions at the "front" end.


Q. 190749 An example of linear data structure is a


A. tree.

B. graph.

C. stack.

D. binary search tree.

Right Answer is: C

SOLUTION

In stack the items are stored sequentially, thus forming linear data structure.


Q. 190750 The result of evaluation of a postfix expression 20,8,4,/,+ is


A. 21.

B. 22.

C. 50.

D. 51.

Right Answer is: B

SOLUTION

It will be evaluated as (20+(8/4)) = 20 + 2 = 22.


Q. 190751 The postfix form of expression a*b+c/d is


A. a*b+c/d.

B. ab*cd+/.

C. ab*cd/+.

D. ab*dc+/.

Right Answer is: C

SOLUTION

An expression is in postfix form if the operators appear after the operands.


Q. 190752 Data structure is an extension of


A. array.

B. data cells.

C. data bytes.

D. data type.

Right Answer is: D

SOLUTION

The organized collection of data is called data structure. So, a data structure is combination of organized data(having datatypes) and allowed operations.


Q. 190753 The number of bytes used to store one element is known as


A. element size.

B. element weight.

C. element capacity.

D. element store.

Right Answer is: A

SOLUTION

Element size is the space that the element needs for the storage purpose.


Q. 190754 Deletion from a stack is called


A. pushing.

B. popping.

C. dumping.

D. destroying.

Right Answer is: B

SOLUTION

The pop operation removes or deletes an item from the list. It removes the element from the top most position.


Q. 190755 A linear data structure implemented in a LIFO manner is


A. queue.

B. tree.

C. stack.

D. dequeue.

Right Answer is: C

SOLUTION

A stack is a linear structure where insertions and deletions take place only at one end, i.e., LIFO structure.


Q. 190756 The number of bytes used to store one element is known as


A. element size.

B. element weight.

C. element capacity.

D. element store.

Right Answer is: A

SOLUTION

Element size is the memory space that the element needs for the storage purpose.


Q. 190757 Data structure is an extension of


A. array.

B. data cells.

C. data bytes.

D. data type.

Right Answer is: D

SOLUTION

The organized collection of data is called data structure. So, a data structure is a combination of organized data and allowed operations.


Q. 190758 The data structure in which the elements are stored sequentially is known as


A. homogeneous data structure.

B. non-homogeneous data structure.

C. linear data structure.

D. non-linear data structure.

Right Answer is: C

SOLUTION

A linear data structure is one in which elements are stored sequencially. For Example- Linked List, Array.


Q. 190759 Combination of elements of two data structures to form a new data structure is known as


A. searching.

B. union.

C. merging.

D. concatenation.

Right Answer is: C

SOLUTION

Merging is an operation performed on data structure in which elements of two similar data structure are combined to form a new data structure of the same type.


Q. 190760 The data structure having hierarchical relationship among nodes is known as


A. array.

B. linked list.

C. tree.

D. queue.

Right Answer is: C

SOLUTION

In computer science, a tree is a widely used data structure that emulates a hierarchical tree structure with a set of linked nodes.


Q. 190761 When front = 0, the number of element in a queue


A. is one only.

B. is zero.

C. are two (one at first position, one at last).

D. can be many.

Right Answer is: B

SOLUTION

The index of first element in the queue is stored in front. If front =0 it means there is zero element in the queue.


Q. 190762 When queue becomes full then


A. one element can be added to it as last index for null is empty.

B. no more elements can be added to it.

C. two more elements can be added to it.

D. many more elements can be added to it depends on the size of queue.

Right Answer is: B

SOLUTION

It will result in an overflow, if we try to add an element to a queue, which is already full.


Q. 190763 The terms used to describe a linear list, when it is implemented as a queue is


A. PUSH and POP.

B. INSERT and DELETE.

C. PREFIX and POSTFIX.

D. FRONT and REAR.

Right Answer is: D

SOLUTION

Front stores the index of first element in the queue. Rear stores the index of last element in the queue.


Q. 190764 If front=0, and rear=5, then the number of elements in a queue is


A. 0

B. 4

C. 5

D. 6

Right Answer is: D

SOLUTION

Number of elements in a queue can be calculated using the given formula - queue = front-rear + 1 .


Q. 190765 A stack is a linear structure implemented in


A. LIFO manner.

B. FIFO manner.

C. LILO manner.

D. LIO manner.

Right Answer is: A

SOLUTION

A stack is implemented in Last In First Out manner where, insertion and deletion is restricted to only one end-stack’s top.


Q. 190766 Using a stack, the operations we can perform are


A. insertion and deletion.

B. modification and display.

C. traversal.

D. push and pop.

Right Answer is: D

SOLUTION

Push is to insert an element in the stack, whereas Pop is to delete an element from the stack.


Q. 190767 To reverse a string we can use a


A. stack.

B. array.

C. heap.

D. linked list.

Right Answer is: A

SOLUTION

As stacks are LIFO implemented data structures, so it can be used for string reversal.


Q. 190768 A list that stores data elements pointing to the next in the sequence is


A. stack.

B. queue.

C. dynamic structure.

D. static structure.

Right Answer is: C

SOLUTION

It is a linked list, which is a linear collection of data elements, called nodes. Linked lists are dynamic structures.


Q. 190769 Dense lists or static data structures are called


A. link lists.

B. arrays.

C. queues.

D. stacks.

Right Answer is: B

SOLUTION

In arrays, the memory is reserved before processing. That is why they are called dense lists or static data structures.


Q. 190770 Underflow error means there might be an attempt to


A. pop from an empty stack.

B. insert into an empty queue.

C. push into an empty stack.

D. push into a full stack.

Right Answer is: A

SOLUTION

If we try to use pop operation on an empty stack, it causes underflow as there is no element in the stack.


Q. 190771 The queues that overcome the problem of unutilized space in linear queues, implemented as arrays are


A. linked queues.

B. input restricted queue.

C. dequeue.

D. circular queues.

Right Answer is: D

SOLUTION

Circular queues are implemented in circular forms rather than in straight lines and are able to utilise the space that is not utilised linear queues.  


Q. 190772 The notation in which the operator symbol is placed before its operands is called


A. prefix notation.

B. postfix notation.

C. infix notation.

D. polish string.

Right Answer is: A

SOLUTION

Prefix is when operator is placed before operands, postfix is when operator is placed after its operands, and in infix the operator is placed between its operands.


Q. 190773 The refined queues in which elements can be added or removed at either end but not in the middle, are


A. input restricted queues.

B. output restricted queues.

C. dequeue.

D. circular queues.

Right Answer is: C

SOLUTION

Dequeue is a double ended queue where elements can be added or removed at either end but not in the middle.


Q. 190774 Describe in brief, the different operations that are performed on an array.
A. input restricted queues.
B. output restricted queues.
C. dequeue.
D. circular queues.

Right Answer is:

SOLUTION

The basic operations performed on arrays are –
Traversing  - visiting each element for some processing.

Searching – traversing the array to see if a certain given value exists in it or not.  Two commonly used methods are – Linear Search and Binary Search.  Linear search can be used on unsorted arrays.    Binary Search is done only on sorted arrays.  

Insertion – This can be done if there is space available in the array.  In an unsorted array, the new element can be placed at the end.  If the array is sorted, the element is given its proper position in the sorted sequence, by shifting other elements. 

Deletion -  If the element to be deleted exists in the array, then the element should be removed and the elements that follow shifted so that the rest of the sequence remains undisturbed.  

Sorting -  Array elements may be arranged in ascending or descending order.  Some sorting techniques are bubble sort, selection sort, insertion sort, shell sort, heap sort, quick sort. 

Merging – two arrays may be combined to form a third array.  If the two arrays are sorted, then using merge – sort technique, we can create the third array, sorted.   


Q. 190775 What do you means by data structures?  Describe different types of data structure.
A. input restricted queues.
B. output restricted queues.
C. dequeue.
D. circular queues.

Right Answer is:

SOLUTION

The fundamental data types (char, int, float, double,void) can be grouped together and treated as a unit.  This grouped unit is a data structure.  
Data structures have been classified into two categories -

Simple Data Structure – these are built using the fundamental data types i.e.  char, int, float and double.  Examples - arrays and structures 

Compound Data Structure – these  are built using simple data structures.  These are further divided into – linear and non-linear.

Linear data structures are those whose elements form a sequence.  Examples – Stacks, Queues and Linked Lists.

Non-Linear data structures  are those whose elements are at different levels.  Example  - trees.  


Q. 190776 Write a program to accept integers into a 2D array and then replace all the elements below the diagonal with 0.
A. input restricted queues.
B. output restricted queues.
C. dequeue.
D. circular queues.

Right Answer is:

SOLUTION

 // To replace elements below left diagonal with 0s
#include < iostream.h> 
#include < conio.h>
void main()
{
 
 
clrscr();
  int i, j, X[4][4];
  cout<<"nEnter integers for the array";
  for(i=0; i < 4; i++)                                  // accept 16 elements into array
  for(j=0; j < 4; j++)
       cin>>X[ i ] [ j ];
  for(i=0; i < 4; i++)                                // assign 0 if below diagonal
  for(j=0; j < 4; j++)
  {
       if ( i > j )
       {  
         X[ i ] [ j ] = 0;
         cout<< "n Final Array n";
        }
  }  
  for(i=0; i < 4; i++)
  {                                                      // display final array
  for(j=0; j < 4; j++)
  {    
    c
out << X[ i ] [ j ]<< "  ";
    cout<<"n";
   }
  }
}                          


Q. 190777 Write a program to accept integers into a 1 dimensional array and then place all the even numbers before all the odd numbers.
A. input restricted queues.
B. output restricted queues.
C. dequeue.
D. circular queues.

Right Answer is:

SOLUTION

// to shift even nos before odd
              
#include < iostream.h>

#include < conio.h>

void main(){

  clrscr();

  int i, j, A[10], B[10];

  cout<<"nEnter integers for the array";

  for(i=0; i<10; i++)                                   // accept 10 elements into array A

     cin>>A[ i ];

  j=0;

  for(i=0; i<10; i++){                                 // place even nos. in array B

    if(A[ i ]%2==0){

       B[ j ] = A[ i ];

       ++j;

    }

  }

  for(i=0; i < 10; i++){                                // place odd nos. in array B

    if(A[ i ]%2==1){

       B[ j ] = A[ i ];

       ++j;

    }

  }

  for( i=0; i<10; i++)                                  // copy array B to array A

    A[ i ] = B[ i ];

  for(i=0;i<10;i++)                                     // display array A

    cout<< A[ i ]<< ' ';

         }                                    


Q. 190778 Write a program to display the sum of elements on both the diagonals in a 2dimensional array.
A. input restricted queues.
B. output restricted queues.
C. dequeue.
D. circular queues.

Right Answer is:

SOLUTION

// To display sum of both diagonals separately 
#include < iostream.h>
#include < conio.h>
void main()
{
   clrscr();
   int i, j, X[4][4], sl = 0, sr = 0;
   cout<<"nEnter integers for the array";
   for(i=0; i < 4; i++)                                  // accept 16 nos. into array X
   for(j=0; j < 4; j++)
   {
       cin>>X[ i ] [ j ];
       cout<<"n Sum of left diagonal = ";
   }
   for(i=0; i < 4; i++)                               // add left diagonal
   {
        sl = sl + X[ i ] [ i ];
        cout<< sl;
        cout<<"n Sum of right diagonal = ";
   }
   for(i=0; i < 4; i++)                               // add right diagonal
   for(j=0; j < 4; j++)
   {
        if( i +j == 3)
        sr = sr + X[ i ] [ j ];
        cout<< sr;
   } 
}                         


Q. 190779 Write a program that deletes all occurrences of a value from an integer array A[20] and shifts the rest of the elements to the right.
A. input restricted queues.
B. output restricted queues.
C. dequeue.
D. circular queues.

Right Answer is:

SOLUTION

// to delete all occurrences from sorted array and shift right

#include < iostream.h>

#include < conio.h>

void main(){

  clrscr( );

  int i, j, k, n, pos, A[20];

  cout<<"nEnter integers for the array, in ascending order";

  for(i=0;i< 20;i++)

     cin>>A[ i ];

  cout<<"nEnter integer to delete : ";

  cin>>n;

  k = 0;

  pos = -1;

  for(i=0; i < 20; i++){

     if (A[ i ] == n){                  // if found, shift all in front, back

       pos = i;

       for(j=pos; j > 0; j--)

          A[ j ] = A[ j - 1 ];

       A[ k ] = 0;

       ++k;

     }

  }

  if (pos==-1)

    cout<<"n Not found in array n";

  for(i=0; i < 20; i++)

    cout<< A[ i ]<< ' ';

  getch();

}                       


Q. 190780 How can a value be inserted into an array?  Describe the different ways.  Give the algorithm for any one.
A. input restricted queues.
B. output restricted queues.
C. dequeue.
D. circular queues.

Right Answer is:

SOLUTION

Insertion of another value can be done if there is space available in the array.  If the array is unsorted i.e. elements are not placed in any particular sequence, the new element can be made the last element.  If the array is sorted, the element must be given its proper position in the sorted sequence. 

Algorithm for Insertion in a Sorted Array – Ascending order
1.  SET i = 0
2.  REPEAT STEP 3  AS LONG AS  A[ i ] < Val

3.  IF A[ i ] < Val THEN

        i = i + 1;
4.  SET  pos = i;
5.  SET i = UB
6.  REPEAT STEP 7 UNTIL i = pos
7.   { A[ i ] = A[ i-1 ];

           i = i – 1

    }
8.   A[ pos ] = Val;

9.  END                           


Q. 190781 What is merge-sort?  Write a program to merge-sort 2 arrays into a third one.  The two arrays are sorted in descending order and the resultant array should be in ascending order .
A. input restricted queues.
B. output restricted queues.
C. dequeue.
D. circular queues.

Right Answer is:

SOLUTION

Merge – sort is when two sorted arrays are merged to create the third array which is also sorted.   
In this technique,  the current values of the two arrays are compared and the one smaller is put into the new array.  The marker in the array used moves ahead one element.  Again the current elements of the two arrays are compared and the smaller value put into the new array.  This process continues till one of the arrays ends and then the remaining elements of the other array are placed in the new array.  

 //Merge sort ascending- with component arrays in descending order

#include < iostream.h>

void main(){

  int ia, ib, ic, A[6], B[6], C[12];

  cout<<"nEnter 6 integers, in desc order ";                           //first array

  for(ia=0; ia < 6; ia++)

     cin>>A[ ia ];

  cout<<"nEnter 6 more integers, in desc order ";                   // second array

  for(ia=0; ia < 6; ia++)

     cin>>B[ia];

  for(ia=5,ib=5,ic=0; ia>=0 && ib>=0; )                                 // creation of third array

  {

    if(A[ia] > B[ib]){

       C[ic] = B[ib];

       ++ic;

       --ib;

    }

    else{

       C[ic] = A[ia];

       ++ic;

       --ia;

    }

   }                                                           // end of for loop

  if(ia < 0)

     while(ib>=0){

     C[ic] = B[ib];

     ++ic;

     --ib;

  }

  if(ib < 0)

     while(ia >= 0){

     C[ic] = A[ia];

     ++ic;

     --ia;

  }

   cout<<"n Merged Array n";

   for(ic=0; ic<12; ic++)

      cout<< C[ic]<< ' ';

         }                                                                                              // end of main function


Q. 190782 An example of non-linear data structure is


A. array.

B. queue.

C. stack.

D. tree.

Right Answer is: D

SOLUTION

In tree data structure the elements are not stored in a sequence, therefore it is a non-linear data structure.


Q. 190783 The data structure in which the elements are stored randomly is known as


A. homogeneous data structure.

B. non-homogeneous data structure.

C. linear data structure.

D. non-linear data structure.

Right Answer is: D

SOLUTION

Data structures like trees, binary trees, graphs and heaps are non-linear data structures as the elements doesn't stored in an order.


Q. 190784 The data structure in which the elements are stored sequentially is known as


A. homogeneous data structure.

B. non-homogeneous data structure.

C. linear data structure.

D. non-linear data structure.

Right Answer is: C

SOLUTION

A linear data structure is one in which elements are stored sequentially. For Example - Liked List, Array.


Q. 190785 When all the elements of the data structure is not of same type, then it is known as


A. homogeneous data structure.

B. non- homogeneous data structure.

C. static data structure.

D. dynamic data structure.

Right Answer is: B

SOLUTION

The data structure which contains different type of data is known as non-homogeneous or heterogeneous data structure.


Q. 190786 When all the elements of the data structure are of same type, then it is known as


A. homogeneous data structure.

B. non- homogeneous data structure.

C. static data structure.

D. dynamic data structure.

Right Answer is: A

SOLUTION

When the items or entities in a group are similar, then they are said to be homogeneous. Similarly, when the elements of the data structure are of same type, then it is a homogeneous data structure.


Q. 190787 Arranging the data elements of a data structure in a specified order is called


A. traversal.

B. merging.

C. sorting.

D. search.

Right Answer is: C

SOLUTION

A sorting is a process of arranging items in some sequence and/or in different sets/order.


Q. 190788 The operation that can be performed on a data structures is


A. subtraction.

B. addition.

C. searching.

D. multiplication.

Right Answer is: C

SOLUTION

Searching is the operation that performed on data structure to search for a specified data element.


Q. 190789 The data structure having hierarchical relationship among nodes is known as


A. array.

B. linked list.

C. tree.

D. queue.

Right Answer is: C

SOLUTION

In computer science, a tree is a widely used data structure that emulates a hierarchical tree structure with a set of linked nodes.


Q. 190790 The expression, which is easier for a machine to evaluate, is


A. infix expression.

B. postfix expression.

C. prefix expression.

D. unfix expression.

Right Answer is: B

SOLUTION

A postfix expression itself determines the precedence of operators. Therefore, for the machine it is easier to carry out a postfix expression than other expressions.


Q. 190791 The technical term used for deletion operation in a stack is


A. pumping.

B. popping.

C. pulling.

D. parting.

Right Answer is: B

SOLUTION

The pop operation removes (deletes) an item from the stack, and returns this item value to the calling program.


Q. 190792 The technical term used for insertion operation in a stack is


A. pushing.

B. popping.

C. inculcation.

D. immersion.

Right Answer is: A

SOLUTION

The push operation adds(stores) elements to the Stack.


Q. 190793 FIFO stands for


A. fast in fast on.

B. first in first out.

C. fast in first out.

D. first in fast on.

Right Answer is: B

SOLUTION

FIFO is an acronym for First In, First Out, an abstraction in ways of organizing and manipulation of data relative to time and prioritization.


Q. 190794 In C++, an array is denoted as


A. [size].arrayname;

B. {arrayname}

C. Arrayname[size]

D. Arrayname[size];

Right Answer is: C

SOLUTION

Arrays refer to a named list of a finite number n of similar data elements. The array itself is given a name and its elements are referred to by their subscripts. In C++, an array is denoted as follows:
Arrayname[size]
where size specifies the number of elements in the array and the subscript (also called index) value ranges from 0 to size-1.  


Q. 190795 In C++, the lower bound is always


A. 1.

B. 0.

C. size -1.

D. size - 0.

Right Answer is: B

SOLUTION

In C++, the lower bound is always 0 and the upper bound is size -1.


Q. 190796 In C++, the upper bound is


A. 1.

B. 0.

C. size-0.

D. size-1.

Right Answer is: D

SOLUTION

In C++, the lower bound is always 0 and the upper bound is size -1.


Q. 190797 In a tree, the bottommost nodes are called


A. leaves.

B. roots.

C. levels.

D. elements.

Right Answer is: A

SOLUTION

Trees are multilevel data structures having a hierarchical relationship among its elements called nodes. Topmost node is called the root of the tree and the bottommost nodes are called leaves of the tree.


Q. 190798 Consider the array 13, 24, 5, 19, 2, 17, 4. To sort the array in ascending order, the first pass would result in


A. 2, 13, 24, 5, 19, 17, 4.

B. 13, 24, 5, 19, 2, 17, 4.

C. 5, 19, 2, 17, 4, 13, 24.

D. 13, 24, 5, 19, 2, 17, 4.

Right Answer is: B

SOLUTION

In bubble sort, we compare two adjoining values and exchange them if they are not in proper order. In this case, in first pass, when we compare the values, there will be no change i.e. it will remain 13, 24, 5, 19, 2, 17, 4. But in second pass the values 24 and 5 will be swapped. Therefore, in every pass, the heaviest element settles at its appropriate position in the bottom.


Q. 190799 Consider the following unsorted array to be sorted using selection sort.
15, 6, 13, 22, 3 52, 2.
The number of passes we require to sort the array is


A. 7.

B. 6.

C. 5.

D. 4.

Right Answer is: A

SOLUTION

The basic idea of selection sort is to repeatedly select the smallest key in the reamining unsorted array.
For the given array : 15 , 6, 13, 22, 3, 52 , 2
Step 1: Choose the smallest element from unsorted array which is 2; put this smallest element in sorted part at 1st position.
Step 2. The second pass identifies 3 as the smallest element in remaining unsorted array. Add 3 also in sorted part at 2nd position.
Step 3: In third pass, 6 is chosen as smallest and put at position 3.
Step 4: This time 13 is moved to sorted part at 4th position.
Step 5: Fifth pass adds 15 to sorted part at the next position.
Step 6: Sixth pass adds 22 and seventh pass adds 52 to sorted list.  


Q. 190800 The INFO part in linked list


A. points to the first element.

B. stores the information.

C. points to the second element.

D. stores the length of the element.

Right Answer is: B

SOLUTION

Linked lists are special lists of some data elements linked to one another. The logical ordering is represented by having each element pointing to the next element. Each element is called a node, which has two parts. The INFO part which stores the information and the POINTER part, which points to the next element.


PreviousNext