Question
Consider a Java method printList(Node head) for a singly linked list. class Node { int data; Node next; Node(int
Consider a Java method printList(Node head) for a singly linked list. class Node { int data; Node next; Node(int
d) { data = d; next = null; } } public void printList(Node head) { Node current = head; while (current != null) { System.out.print(current.data + " "); current = current.next; } // Bug: What if the list is empty? System.out.println(current.data); // Line X } If printList(null) is called (an empty list), what will happen at Line X?
More IT Operating System Questions
- A system uses 4 KB pages and a 32-bit virtual address. How many address bits identify the page offset?
- Router is responsible for packet forwarding, including routing. Router works at which layer?
- What is the primary function of the 'operating system' in a computer?
- Which of the following is a characteristic of "tight coupling" between software modules?
- Which type of polymorphism in Java is achieved through method overloading?
- Linux uses a time-sharing algorithm ___________
- Fill in the correct option for 27 blank space.
- Maximum Power transfer occurs when the_____
- Which of the following data structures follows the Last-In, First-Out (LIFO) principle?
- In a language like C++, if a member variable is declared protected, it means:
Hey! Ask a query
Please enter email id
The email must be a valid email address.
Please enter Mobile Number
Please enter valid Mobile Number
Please enter your Doubt
Think You're Ready for RBI Grade B?
RBI Grade B 2026 Phase 1 Memory Based Paper
- 200 Questions with Detailed Solutions
- Section-wise Coverage (GA, English, Quant & Reasoning)