
Linked List Traversal
Authored by Madras Institute of Technology
Computers
Professional Development

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
ptr = head
while (ptr!=NULL)
ptr = ptr -> next
Consider the above operation to be performed over the linked list 1->2->3->4->5.What will be the output?
1 2 3 4 5
1 2 3
1 3 5
1 1 1 1 1
Answer explanation
Linked list is traversed entirely
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the time complexity to count the number of elements in the linked list?
O(1)
O(n logn)
O(n)
None of the above
Answer explanation
To count the number of elements, you have to traverse through the entire list, hence complexity is O(n)
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the time complexity to search ith element in the linked list?
O(1)
O(n logn)
O(n)
None of the above
Answer explanation
Searching an ith element in the linked list takes time complexity of O(n)
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
The operation of processing each element in the list is known as
sorting
merging
inserting
traversal
Answer explanation
The operation of processing each element in the list is known as traversal
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the following linked list 12->15->18->21->24
What will be the output of search(3) and search(15) respectively?
-1 and -1
1 and 1
1 and -1
-1 and 1
Answer explanation
Since the element 3 is not the function returns -1 and element 15 is found at position 1 so it returns 1
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following points is/are not true about Linked List data structure when it is compared with an array?
Arrays have better cache locality that can make them better in terms of performance
Access of elements in linked list takes less time than compared to arrays
It is easy to insert and delete elements in Linked List
Random access is not allowed in a typical implementation of Linked Lists
Answer explanation
To access an element in a linked list, we need to traverse every element until we reach the desired element. This will take more time than arrays as arrays provide random access to its elements.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of following function for start pointing to first node of following linked list?
1 4 6 6 4 1
1 3 5 1 3 5
1 3 5 5 3 1
1 2 3 5
Answer explanation
fun() prints alternate nodes of the given Linked List, first from head to end, and then from end to head.If Linked List has even number of nodes, then skips the last node.
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
10 questions
QUIZ Fun bersama Batch 5 Data Analtyc
Quiz
•
Professional Development
13 questions
Guess the Video Game Pets 1
Quiz
•
KG - Professional Dev...
11 questions
Wealth Showcases - VII
Quiz
•
Professional Development
10 questions
Snapdragon Academy
Quiz
•
Professional Development
10 questions
Khám phá máy tính lớp 5
Quiz
•
10th Grade - Professi...
13 questions
Five Nights At Freddy's: Security Breach Quiz
Quiz
•
KG - Professional Dev...
10 questions
Hàm
Quiz
•
Professional Development
15 questions
4.6.4 Logic Gates
Quiz
•
10th Grade - Professi...
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 Computers
44 questions
Would you rather...
Quiz
•
Professional Development
20 questions
Black History Month Trivia Game #1
Quiz
•
Professional Development
12 questions
Mardi Gras Trivia
Quiz
•
Professional Development
14 questions
Valentine's Day Trivia!
Quiz
•
Professional Development
7 questions
Copy of G5_U5_L14_22-23
Lesson
•
KG - Professional Dev...
16 questions
Parallel, Perpendicular, and Intersecting Lines
Quiz
•
KG - Professional Dev...
11 questions
NFL Football logos
Quiz
•
KG - Professional Dev...
12 questions
Valentines Day Trivia
Quiz
•
Professional Development