What Is The Functionality Of The Following Piece Of Code Select #95
What is the functionality of the following piece of code? Select the most appropriate.</p> <pre><code class="language-java"> public void function(int data) { int flag = 0; if( head != null) { Node temp = head.getNext(); while((temp != head) && (!(temp.getItem() == data))) { temp = temp.getNext(); flag = 1; break; } } if(flag) System.out.println("success"); else System.out.println("fail"); }</code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs121 Data Structures and Algorithms. It can also be found in gs gs121 Abstract Data Types - Circular Linked Lists - Quiz No.1.
What is the functionality of the following piece of code? Select the most appropriate.
public void function(int data) { int flag = 0; if( head != null) { Node temp = head.getNext(); while((temp != head) && (!(temp.getItem() == data))) { temp = temp.getNext(); flag = 1; break; } } if(flag) System.out.println("success"); else System.out.println("fail"); }
Print success if a particular element is not found
Print fail if a particular element is not found
Print success if a particular element is equal to 1
Print fail if the list is empty
Similar question(s) are as followings:
Online Quizzes of gs121 Data Structures and Algorithms
Binary Trees - Binary Search Tree - Quiz No.1
gs gs121 Data Structures and Algorithms
Online Quizzes
Binary Trees - Binary Search Tree - Quiz No.2
gs gs121 Data Structures and Algorithms
Online Quizzes
Binary Trees - Preorder Traversal - Quiz No.1
gs gs121 Data Structures and Algorithms
Online Quizzes