Data structure/Data Structure Questions and Answers Singly Linked Sample Test,Sample questions

Question:
 What would be the asymptotic time complexity to insert an element at the front of the linked list (head is known)?

1.O(1)

2.O(n)

3.O(n2)

4.O(n3)


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.Unordered list


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));


Question:
 Which of the following points is/are not true about Linked List data structure when it is compared with an array?

1.Arrays have better cache locality that can make them better in terms of performance

2.It is easy to insert and delete elements in Linked List

3.Random access is not allowed in a typical implementation of Linked Lists

4.Access of elements in linked list takes less time than compared to arrays


Question:
 You are given pointers to first and last nodes of a singly linked list, which of the following operations are dependent on the length of the linked list?

1.Delete the first element

2. Insert a new element as a first element

3. Delete the last element of the list

4. Add a new element at the end of the list


Question:
Consider an implementation of unsorted singly linked list. Suppose it has its representation with a head pointer only. 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 list

1.I and II

2.I and III

3.I, II and III

4.I, II and IV


Question:
Given pointer to a node X in a singly linked list. Only one pointer is given, pointer to head node is not given, can we delete the node X from given linked list?

1.Possible if X is not last node

2. Possible if size of linked list is eve

3. Possible if size of linked list is odd

4. Possible if X is not first node


Question:
In Linked List implementation, a node carries information regarding ___________

1.Data

2. Link

3.Data and Link

4.Node


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

1.log 2 n

2.n?2

3.log 2 n � 1

4.n


Question:
Linked list data structure offers considerable saving in _____________

1.Computational Time

2.Space Utilization

3.Space Utilization and Computational Time

4.Speed Utilization


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

1.Singly linked list

2.Doubly linked list

3.Circular doubly linked list

4.Array implementation of list


Question:
What does the following function do for a given Linked List with first node as head?

void fun1(struct node* head)
{
    if(head == NULL)
    return;
    fun1(head->next);
    printf("%d  ", head->data);
}

1.Prints all nodes of linked lists

2.Prints all nodes of linked list in reverse order

3.Prints alternate nodes of Linked List

4.Prints alternate nodes in reverse order


Question:
What is the space complexity for deleting a linked list?

1.O(1)

2.O(n)

3.Either O(1) or O(n)

4.O(logn)


Question:
What is the time complexity of inserting at the end in dynamic arrays?

1.O(1)

2.O(n)

3.O(logn)

4.Either O(1) or O(n)


Question:
What is the time complexity to count the number of elements in the linked list?

1.O(1)

2.O(n)

3.O(logn)

4.O(n2)


Question:
What kind of linked list is best to answer questions 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


Question:
What would be the asymptotic time complexity to add a node at the end of singly linked list, if the pointer is initially pointing to the head of the list?

1.O(1)

2.O(n)

3.?(n)

4.?(1)


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

1.O(1)

2.O(n)

3.O(n2)

4.O(n4)


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.O(n3)


Question:
Which of the following is not a disadvantage to the usage of array?

1.Fixed size

2. There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size

3. Insertion based on position

4. Accessing elements at specified positions


Question:
Which of these is not an application of a linked list?

1.To implement file systems

2.For separate chaining in hash-tables

3.To implement non-binary trees

4.Random Access of elements


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
  14. Data Structure MCQ questions and answer
  15. Data Structure MCQ questions and answer
Search
Olete Team
Online Exam TestTop Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on Online Exam Testwebsite 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!