Data structure/Data Structure and Algorithms (DSA) set 5 Sample Test,Sample questions

Question:
 A function which calls itself is called as

1.library function

2.directive

3.recursive function

4.None of the above

Posted Date:-2022-07-11 05:15:05


Question:
 A variant of the linked list in which none of the node contains NULL pointer is?

1.singly linked list

2.doubly linked list

3. circular linked list

4.none

Posted Date:-2022-07-11 04:02:42


Question:
 A variation of linked list is circular linked list, in which the last node in the list points to first node of the list. One problem with this type of list is?

1.it waste memory space since the pointer head already points to the first node and thus the list node does not need to point to the first node.

2.it is not possible to add a node at the end of the list.

3.. it is difficult to traverse the list as the pointer of the last node is now not null

4.all of above

Posted Date:-2022-07-11 04:01:17


Question:
 Consider the following definition in c programming language

struct node
{
int data;
struct node * next;
}
typedef struct node NODE;
NODE *ptr;

Which of the following c code is used to create new node?

1. ptr=(node*)malloc(sizeof(node));

2.ptr=(node*)malloc(node);

3. ptr=(node*)malloc(sizeof(node*));

4.ptr=(node)malloc(sizeof(node));

Posted Date:-2022-07-11 03:57:22


Question:
 consider the function f defined here:

struct item
{
int data;
struct item * next;
};
int f (struct item *p)
{
return((p==NULL) ||((p->next==NULL)||(p->data<=p->next->data) && (p->next)));
}

For a given linked list p, the function f returns 1 if and only if

1. the list is empty or has exactly one element

2.the element in the list are sorted in non-decreasing order of data value

3. the element in the list are sorted in non-increasing order of data value

4.not all element in the list have the same data value

Posted Date:-2022-07-11 04:22:20


Question:
 Deletion in a linked list requeries modification of______pointers

1.1

2.2

3.3

4.4

Posted Date:-2022-07-08 13:08:07


Question:
 Finite sequence S of Zero or more chatacters is called_____

1.array

2.list

3.string

4.block

Posted Date:-2022-07-11 04:24:19


Question:
 If every node u in G is adjacent to every other node v in G, A graph is said to be

1.Isolated

2.Complete

3.Finite

4. Strongly connected

Posted Date:-2022-07-11 05:35:13


Question:
 If string1=john,and string2=Rivers are merged,the process is called

1.insertion

2.deletion

3.concatenation

4.replacement

Posted Date:-2022-07-11 04:53:34


Question:
 In a circular linked list

1.components are all linked together in some sequential manner.

2.there is no beginning and no end.

3. components are arranged hierarchically.

4.forward and backward traversal within the list is permitted.

Posted Date:-2022-07-11 02:45:35


Question:
 In a circularly linked list organisation ,insertion of a record involves the modifications of

1. no pointer

2.1 pointer

3.2 pointer

4.3 pointer

Posted Date:-2022-07-08 13:03:26


Question:
 In a graph if e=(u, v) means

1.e begins at u and ends at v

2. u is processor and v is successor

3. both B and C are true

4. none is true

Posted Date:-2022-07-11 05:34:01


Question:
 In circular linked list, insertion of node requires modification of?

1. one pointer

2.two pointer

3.three pointer

4.xnone

Posted Date:-2022-07-11 04:03:39


Question:
 In linked list each node contain minimum of two fields. One field is data field to store the data second field is?

1. pointer to character

2.pointer to integer

3. pointer to node

4.node

Posted Date:-2022-07-11 03:52:02


Question:
 In worst case, the number of comparison need to search a singly linked list of length n for a given element is

1. log n .

2.n/2

3.log2n-1

4.n

Posted Date:-2022-07-11 04:19:41


Question:
 Linked lists are not suitable to for the implementation of?

1.insertion sort

2.radix sort

3.polynomial manipulation

4.binary search

Posted Date:-2022-07-11 04:18:10


Question:
 Literal means

1.string

2.string constant

3.character

4.alphabet

Posted Date:-2022-07-11 05:20:11


Question:
 NULL link is not present in…

1.singly linked list

2.doubly linked list

3.circular linked list

4.None of these

Posted Date:-2022-07-11 02:43:25


Question:
 The advantages of linked list over an array for representing a list is________

1.space used is less

2.deletion is easier

3. insertion is easier

4.both (a) and (b)

Posted Date:-2022-07-11 02:18:34


Question:
 The complexity of Binary search algorithm is

1. O(n)

2.O(log )

3.O(n log n)

4. None of the above

Posted Date:-2022-07-11 05:54:58


Question:
 The constructed datatype in C is known as

1. string

2.array

3.structure

4.pointer

Posted Date:-2022-07-11 05:05:30


Question:
 The following data structure allows deleting data elements from front and inserting at rear

1.Stacks

2.Queues

3.Deques

4.Binary search tree

Posted Date:-2022-07-11 05:46:06


Question:
 When new data are to be inserted into a data structure, but there is no available space; this situation is usually called

1.Housefull

2.Saturated

3.Underflow

4.Overflow

Posted Date:-2022-07-11 05:25:32


Question:
 While incrementing a pointer, its value gets increased by the length of the data type to which it points. This length is called

1.scale factor

2.length factor

3.pointer factor

4. increment factor

Posted Date:-2022-07-11 05:12:17


Question:
 _____operation of word processing invovles replacing one string in the text by another.

1.insertion

2.deletion is easier

3.searching

4.replacement

Posted Date:-2022-07-11 04:51:31


Question:
. a->b is systematically correct if_____

1. a is a pointer to a structure in which b is a field

2.a and b are structure

3.a is a structure and b is a pointer to a structure

4. a is a pointer to a structure and b is a structure

Posted Date:-2022-07-11 05:19:31


Question:
A binary tree whose every node has either zero or two children is called

1. Complete binary tree

2.Binary search tree

3.Extended binary tree

4.None of the above

Posted Date:-2022-07-11 05:52:58


Question:
A global variable is a variable

1.declared in the main ( ) function

2.declared in any function other than the main ( ) function

3.declared outside the body of every function.

4.declared any where in the c program.

Posted Date:-2022-07-11 05:10:55


Question:
A linear collection of data elements where the linear node is given by means of pointer is called?

1. linked list

2.node list

3.primitive list

4.none

Posted Date:-2022-07-11 02:46:25


Question:
A node of doubly linked contains

1. pointer to predecessor

2.pointer to sucessor

3.both (a)and(b)

4.only(a)

Posted Date:-2022-07-11 02:37:50


Question:
A node of linked list contains_______

1.data field

2.a self referential pointer

3. both (a)and(b)

4. only b

Posted Date:-2022-07-08 13:05:52


Question:
A polynominal in single variable should be handled using__

1.an array of structure

2.singly linked list

3.gll

4.both (a) and (b)

Posted Date:-2022-07-11 02:36:28


Question:
A structure definition is called as

1.template

2.member

3. both 1 & 2

4.None of these

Posted Date:-2022-07-11 05:07:37


Question:
A variant of linked list in which last node of the list points to the first node of the list is?

1. A. singly linked list

2.doubly linked list

3.circular linked list

4.multiply linked list

Posted Date:-2022-07-11 03:58:14


Question:
a->b is systematically correct if_____

1.a is a npointer to a structure in which b is a field

2.a and b are structure

3. a is a structure and b is a pointer to a structure

4. a is a pointer to a structure and b is a structure

Posted Date:-2022-07-11 05:13:16


Question:
Accessing time of nth node in a linked list is______

1. 0(n)

2.0(1)

3. 0(n2)

4.0(log n)

Posted Date:-2022-07-08 12:52:41


Question:
An array is referenced by its name.Similarly,a linked list is referenced by____

1. address of the first node

2.address of the last node

3.both (a)and(b)

4.none of these

Posted Date:-2022-07-08 12:53:37


Question:
Because of linear structure of linked list having linear ordering,there is similarity between linked list and array in

1.insertion of a node

2.deletion of a node

3.traversal of elements of list

4.none of the above

Posted Date:-2022-07-08 12:59:19


Question:
Binary search algorithm cannot be applied to

1.Sorted binary trees

2.Sorted linear array

3.Pointer array

4.Sorted linked list

Posted Date:-2022-07-11 05:24:29


Question:
Consider an implementation of unsorted doubly linked list. Suppose it has its representation with a head pointer and tail pointer. Given the representation, which of the following operation can be implemented in O(1) time?

i) Insertion at the front of the linked list
ii) Insertion at the end of the linked list
iii) Deletion of the front node of the linked list
iv) Deletion of the end node of the linked list

1. i and ii

2.i and iii

3. i,ii and iii

4.i,ii,iii and iv

Posted Date:-2022-07-11 03:51:07


Question:
Consider an implementation of unsorted singly linked list. Suppose it has its representation with a head and tail pointer. Given the representation, which of the following operation can be implemented in O(1) time? i) Insertion at the front of the linked list
ii) Insertion at the end of the linked list
iii) Deletion of the front node of the linked list
iv) Deletion of the last node of the linked lis

1.i and ii

2. i and iii

3. i,ii and iii

4.i,ii and iv

Posted Date:-2022-07-11 03:42:54


Question:
Each data item in a record may be a groupitem composed of sub-items; those items which are indecomposable are called

1.Elementary items

2.Atoms

3.Scalars

4.All of the above

Posted Date:-2022-07-11 05:23:04


Question:
Each node in a linear list contains an item called____which points to the next node in the list.

1. node

2.link

3.variable

4. null

Posted Date:-2022-07-11 02:38:55


Question:
Groups of consecutive element in a string.Such as words,phrase and sentences are called___

1.main string

2.substring

3.index

4.block

Posted Date:-2022-07-11 04:48:03


Question:
he following data structure is linear type

1. Strings

2.Lists

3.Queues

4.All of the above

Posted Date:-2022-07-11 05:48:38


Question:
If a function is declared as void fn(int *p), then which of the following statements is valid to call function fn?

1.fn(x) where x is defined as int x;

2. fn(x) where x is defined as int *x;

3.fn(&x) where x is defined as int *x;

4. fn(*x) where x is defined as int *x;

Posted Date:-2022-07-11 04:58:41


Question:
If a, b and c are integer variables with the values a=8, b=3 and c=-5. Then what is the value of the arithmetic expression: 2 * b + 3 * (a-c)

1.15

2.6

3.-16

4.-1

Posted Date:-2022-07-11 05:08:46


Question:
If address of the 8th element in a linked list of integers is1022,then address of the 9th element is

1.1024

2.1026

3.1023

4.unknown

Posted Date:-2022-07-11 02:17:44


Question:
In a binary tree, certain null entries are re-placed by special pointers which point to nodes higher in tree for efficiency. These special pointers are called

1.Leaf

2.Branch

3.Path

4.Thread

Posted Date:-2022-07-11 05:31:27


Question:
In doubly linked lists, traversal can be performed?

1.only in forward direction

2.only in reverse direction

3.in both directions

4.None of These

Posted Date:-2022-07-11 03:58:58


Question:
In selection sort of n elements,how many times is the swap function called in the complete execution of the algorithm?

1.1

2. n-1

3.n(n-1)/2

4.none of these

Posted Date:-2022-07-11 05:17:32


Question:
main ( ) is an example of

1. library function

2.user defined function

3.header

4.statement

Posted Date:-2022-07-11 05:11:41


Question:
NurseryLand.Nursery.Students = 10;

1.the structure students is nested within the structure nursery

2.the structure nurseryland is nested within the structure nursery.

3.the structure nursery is nested within the structure nurseryland.

4.the structure nursery is nested within the structure students

Posted Date:-2022-07-11 04:56:37


Question:
Select the correct looping condition for positioning apointer p on the second last in a linked list.Assume p=head,initially.

1. p->next->next!=null

2. p->next=null

3.p!=null

4.None of These

Posted Date:-2022-07-11 02:16:54


Question:
Select the correct statement

1.free is used to release memory allocated by malloc

2. free is used to release memory allocated by calloc

3.both (a)and(b)

4.only(a)but not(b)

Posted Date:-2022-07-11 02:24:12


Question:
Select the set of instructions to insert a node pointed by q after a node pointed by p

1.q->next=p->next; p->next=q;

2. p->next=q; q->next=p->next

3. both (a)and(b)

4.none of these

Posted Date:-2022-07-08 13:12:06


Question:
Select the set of operations to delete the first node from a linked list

1. p=head;head=head->next;free(p);

2.free(head)

3.head=head->next;p=head;free(p)

4.None of These

Posted Date:-2022-07-11 02:15:53


Question:
select the set of operations to insert a node pointed by q at the beginning of the linked list

1.q->next=head; head=q; B. C.

2.head=q;q ->next=head;

3.both (a)and(b)

4.None of these

Posted Date:-2022-07-08 13:14:10


Question:
String with zero characters is called____string

1.null

2.binary

3.totalled

4.list

Posted Date:-2022-07-11 04:25:09


Question:
The address returned by malloc()is type casted because

1.malloc returns integers pointer

2.malloc returns void pointer

3. malloc returns an integer value

4.None of These

Posted Date:-2022-07-11 02:19:21


Question:
The Average case occur in linear search al- gorithm

1. When Item is somewhere in the middle of the array

2.When Item is not in the array at all

3.When Item is the last element in the ar- ray

4.All the above

Posted Date:-2022-07-11 05:39:29


Question:
The complexity of Bubble sort algorithm is

1. O(n)

2.O (n2)

3. O(n log n)

4.None of the above

Posted Date:-2022-07-11 05:55:48


Question:
The complexity of the average case of analgorithm is

1.Much more complicated to analyze than that of worst case

2. Much more simpler to analyze than that of worst case

3.Sometimes more complicated and some other times simpler than that of worst case

4.None of the above

Posted Date:-2022-07-11 05:41:22


Question:
The concatenation of two list can performed in O(1) time. Which of the following variation of linked list can be used?

1.singly linked list

2. doubly linked list

3. circular doubly linked list

4.array implementation of list

Posted Date:-2022-07-11 03:56:21


Question:
The following data structure is non-linear type

1.Strings

2.Lists

3.Stacks

4.None of the above

Posted Date:-2022-07-11 05:47:53


Question:
The following is two-way list

1.Grounded header list

2.Circular header list

3.Linked list with header and trailer nodes

4.None of above

Posted Date:-2022-07-11 05:27:30


Question:
The function that allocates requested size of bytes and returns a pointer to the first byte of the allocated space is

1. realloc

2.malloc

3.free

4.None of these

Posted Date:-2022-07-11 02:40:57


Question:
The Worst case occur in linear search algo- rithm when

1.Item is not in the array at all

2.Item is the last element in the array

3.Item is the last element in the array or is not there at all

4. None of above

Posted Date:-2022-07-11 05:38:19


Question:
The____linked list can be processed in either direction.

1.singly

2.singly circular

3.doublyly

4.None of these

Posted Date:-2022-07-11 02:33:56


Question:
This data structure allows deletions at both ends of the list but insertion at only one end.

1. Input-restricted deque

2.Output-restricted deque

3.Priority queues

4.None of the above

Posted Date:-2022-07-11 05:47:13


Question:
Time required to search an element in a linked list is____

1.0(n)

2.0(log n)

3.0(n2)

4. 0(n log n)

Posted Date:-2022-07-08 12:54:59


Question:
To declare an array S that holds a 5-character string, you would write

1.char s[5]

2.char s[6]

3.string s[5]

4.stringchar s[5]

Posted Date:-2022-07-11 05:00:13


Question:
To represent hierarchical relationship be- tween elements, the following data structure is not suitable

1. Deque

2.Priority

3.Tree

4.All of above

Posted Date:-2022-07-11 05:49:11


Question:
What is true about linked kist?

1. it is a linked structure, where each data gives the address of the next data

2.it is a dynamic data structure

3. it is a static data structure

4. both (a) and (b)

Posted Date:-2022-07-08 13:04:42


Question:
What kind of linked list is best to answer question like “What is the item at position n?”

1. singly linked list

2.doubly linked list

3.circular linked list

4.array implementation of linked list

Posted Date:-2022-07-11 04:00:01


Question:
What would be the asymptotic time complexity to add an element in the linked list?

1.o(1)

2.o(n)

3. o(n2)

4.None of these

Posted Date:-2022-07-11 03:53:06


Question:
What would be the asymptotic time complexity to insert an element at the second position in the linked list?

1. o(1)

2. o(n)

3.o(n2)

4.None of these

Posted Date:-2022-07-11 03:55:03


Question:
Where do we use the operator -> ?

1.to access a member of structure

2.to access member of union

3. to access an array

4.both(a) and(b).

Posted Date:-2022-07-11 05:16:35


Question:
Which function returns a void pointers?

1.malloc returns integers pointer

2.calloc

3.both (a)and(b)

4.None of these

Posted Date:-2022-07-11 02:22:38


Question:
Which is not dynamic memory allocation function?

1.malloc returns integers pointer

2.calloc

3.alloc

4.free

Posted Date:-2022-07-11 02:40:08


Question:
Which of the following best describes sorting ?

1.accessing and processing each record exactly once

2.finding the location of the record with a given key

3. arranging the data (record) in some given order

4.adding a new record to the data structure

Posted Date:-2022-07-11 05:14:06


Question:
Which of the following operations is performed more efficiently by doubly linked list than by singly linked list?

1.deleting a node whose location in given

2.searching of an unsorted list for a given item

3. inverting a node after the node with given location

4.traversing a list to process each node

Posted Date:-2022-07-11 02:50:14


Question:
Which of the following statements about linked list data structure is/are TRUE?

1.addition and deletion of an item to/ from the linked list require modification of the existing pointers

2.the linked list pointers do not provide an efficient way to search an item in the linked list

3.linked list pointers always maintain the list in ascending order

4.None of these

Posted Date:-2022-07-11 04:05:14


Question:
__is a variable whose length may vary during the execution of a program.

1.dynamic

2.static

3.semistatistic

4.global

Posted Date:-2022-07-11 04:54:26


Question:
___is the problem of deciding whether or not a given string problem p appears in a text T.

1.pattern matching

2.searching

3.sorting

4.deletion

Posted Date:-2022-07-11 04:52:33


More MCQS

  1. Data Structures and algorithms MCQ Questions
  2. Data Structure -Abstract Data Types
  3. Data Structure Questions and Answers Singly Linked
  4. Data Structures &algorithms MCQ Questions
  5. Data Structure Multiple Choice Questions and Answers
  6. Data Structure (DS) MCQ Set 1
  7. Data Structure (DS) MCQ Set 2
  8. Data Structure and Algorithms (DSA) set 1
  9. Data Structure and Algorithms (DSA) set 2
  10. Data Structure and Algorithms (DSA) set 3
  11. Data Structure and Algorithms (DSA) set 4
  12. Data Structure and Algorithms (DSA) set 5
  13. Linear Data Structures - List
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!