
Single Linked List Concepts
Quiz
•
Other
•
University
•
Practice Problem
•
Hard
Shoba LK
FREE Resource
Enhance your content in a minute
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the basic structure of a node in a single linked list?
A node in a singly linked list consists of multiple data fields without any pointers.
A node in a singly linked list contains only a data field.
A node in a singly linked list has a data field and a pointer to the next node.
A node in a singly linked list has two pointers, one for the next node and one for the previous node.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Write pseudocode to insert a node at the beginning of a single linked list.
function addNodeToEnd(head, newData) { newNode = new Node(newData); if (head == null) { head = newNode; } else { current = head; while (current.next != null) { current = current.next; } current.next = newNode; } return head; }
function insertAtPosition(head, newData, position) { newNode = new Node(newData); if (position == 0) { newNode.next = head; head = newNode; return head; } current = head; for (i = 0; i < position - 1 && current != null; i++) { current = current.next; } newNode.next = current.next; current.next = newNode; return head; }
function insertAtBeginning(head, newData) { newNode = new Node(newData); newNode.next = head; head = newNode; return head; }
function deleteFromBeginning(head) { if (head == null) return null; head = head.next; return head; }
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Describe the pseudocode for inserting a node at the end of a single linked list.
1. Create a new node. 2. If head is null, set head to new node. 3. Else, set current to head. 4. While current.next is not null, set current to current.next. 5. Set current.next to new node.
1. Create a new node. 2. If head is not null, set head to new node. 3. Set current to head. 4. While current.next is null, set current to current.next. 5. Set current.next to new node.
1. Create a new node. 2. Set head to null. 3. Set current to tail. 4. While current is not null, set current to current.previous. 5. Set current.previous to new node.
1. Create a new node. 2. Set head to new node. 3. Set current to head. 4. While current.next is null, set current to current.next. 5. Set current.next to null.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the pseudocode for deleting a node from a single linked list?
Set head.next = head to delete the node.
1. If head is null, return. 2. If head is the node to delete, set head = head.next. 3. Initialize current = head. 4. While current.next is not null: 5. If current.next is the node to delete: 6. Set current.next = current.next.next. 7. Return.
If head is null, set head to the node to delete.
Traverse the list and print each node's value.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Explain how to traverse a single linked list and write the pseudocode for it.
Print currentNode.next.value
Pseudocode: 1. Set currentNode = head 2. While currentNode is not null: a. Print currentNode.value b. Set currentNode = currentNode.next
While currentNode is null:
Set currentNode = tail
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the time complexity of traversing a single linked list?
O(1)
O(n^2)
O(n)
O(log n)
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Write pseudocode to search for a value in a single linked list.
function locateValue(head, target) { current = head; if (current.value == target) { return current; } return null; }
function searchList(head, target) { for (let node of head) { if (node.value == target) { return node; } } return null; }
function findInList(head, value) { while (head != null) { if (head.value != value) { head = head.next; } } return head; }
function searchLinkedList(head, target) { current = head; while (current != null) { if (current.value == target) { return current; } current = current.next; } return null; }
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
12 questions
Kuis SKS #2
Quiz
•
University
13 questions
International Trade Law Quiz 1
Quiz
•
University
10 questions
FunWithCSW
Quiz
•
University
10 questions
Multimedia and Text in multimedia
Quiz
•
University
10 questions
Capital Budgeting and Capital Ratioining Quiz
Quiz
•
University
12 questions
Nursing Inquiry BN5.001
Quiz
•
University
10 questions
Google Docs
Quiz
•
8th Grade - Professio...
15 questions
UAS AKUNTANSI MANAJEMEN
Quiz
•
University
Popular Resources on Wayground
7 questions
History of Valentine's Day
Interactive video
•
4th Grade
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
15 questions
Valentine's Day Trivia
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
Discover more resources for Other
18 questions
Valentines Day Trivia
Quiz
•
3rd Grade - University
12 questions
IREAD Week 4 - Review
Quiz
•
3rd Grade - University
23 questions
Subject Verb Agreement
Quiz
•
9th Grade - University
5 questions
What is Presidents' Day?
Interactive video
•
10th Grade - University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
20 questions
Mardi Gras History
Quiz
•
6th Grade - University
10 questions
The Roaring 20's Crash Course US History
Interactive video
•
11th Grade - University
17 questions
Review9_TEACHER
Quiz
•
University
