Search Header Logo

Linked List

Authored by Anisha SET

Computers

University

Used 1+ times

Linked List
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Consider a C Code fragment given below:

Assuming that m and n point to valid NULL-terminated linked lists, invocation of join will-

append list m to the end of list n for all inputs

either cause a null pointer dereference or append list m to the list n

cause a null pointer dereference for all inputs

append list n to the end of list m for all inputs

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Let P be a singly linked list, Let Q be the pointer to an intermediate node x in the list.What is the worst-case time complexity of the best known algorithm to delete the node x from the list?

O(n)

O(log n)

O(1)

O(log2n)

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

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


Prints alternate nodes of Linked List

Prints all nodes of linked list in reverse order

Prints alternate nodes in reverse order

Prints all nodes of linked lists

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

The following function reverse() is supposed to reverse a singly linked list. There is one line missing at the end of the function. 

What should be added in place of "/*ADD A STATEMENT HERE*/", so that the function correctly reverses a linked list.

*head_ref = prev;

*head_ref = current;

*head_ref = next;


*head_ref = NULL;

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What is the output of following function in which start is pointing to the first node of the following linked list 1->2->3->4->5->6 ?

1 4 6 6 4 1

1 3 5 1 3 5

1 2 3 5


1 3 5 5 3 1

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

The following C function takes a simply-linked list as input argument. It modifies the list by moving the last element to the front of the list and returns the modified list. Some part of the code is left blank. Choose the correct alternative to replace the blank line. 

q = NULL; p->next = head; head = p;

q->next = NULL; head = p; p->next = head;

head = p; p->next = q; q->next = NULL;

q->next = NULL; p->next = head; head = p;

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Consider the function f defined below:
For a given linked list p, the function f returns 1 if and only if

not all elements in the list have the same data value.

the elements in the list are sorted in non-decreasing order of data value

the elements in the list are sorted in non-increasing order of data value

None of them

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Computers