Question
Complete the Java code to replace all occurrences of a specific word (case-insensitive) in a string. public class RegexReplacer { public String replaceWord(String text, String wordToReplace, String replacement) { // Example: text="Hello World", wordToReplace="world", replacement="Java" // Expected: "Hello Java" String regex = "(?i)\\b" + Pattern.quote(wordToReplace) + "\\b"; _________ // Line to complete } }
More IT Operating System Questions
- Complete the Java method to extract a substring from text starting at startIndex and having length characters. public class StringUtil { public Strin...
- What is the primary goal of the Matrix Chain Multiplication problem in dynamic programming?
- Which algorithm is a greedy algorithm used to find the Minimum Spanning Tree (MST) of a graph by repeatedly adding the smallest weight edge that connects t...
- Which CPU scheduling algorithm is best suited for time-sharing systems where each user needs a fair share of the CPU and response time is critical?
- Which cloud service model requires the customer to manage only the application code and its data configuration, while the provider takes full operational r...
- In pandas, what does df.groupby('A').agg({'B': 'sum', 'C': 'mean'}) return?
- Which component is responsible for managing virtualization in a cloud environment?
- What is the output of the following code? public class Test { public static void main(String[] args) { int[] arr = new int[5]; ...
- Which of the following is a necessary condition for Mutual Exclusion in a critical section?
- What happens if a subclass does not explicitly call a superclass constructor?
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)