Question
A C function attempts to find a substring. #include #include char* find_substring(char* haystack, char* needle) { if (haystack == NULL || needle == NUL
- L { return NULL; } return strstr(haystack, needle); } int main() { char* text = "Hello World"; char* pattern = NULL; // Potential bug here char* result = find_substring(text, pattern); if (result != NUL
- L { printf("Found: %s ", result); } else { printf("Not found or invalid input. "); } return 0; } What will be the output of this C program?
More IT Operating System Questions
- Which of the following statements accurately describes the use of the SQL CREATE statement?
- What is the time complexity of the KMP algorithm for searching a pattern of length 'M' in a text of length 'N'?
- What is the output of the following Java code? class A { int x = 10; void show() { System.out.println("A: " + x); } } cl...
- In a language like C++, if a member variable is declared protected, it means:
- What is the primary purpose of a Service Level Agreement (SLA) in a business context?
- What does the term "context switching" refer to in an operating system?
- In dimensional modeling, what is a fact table?
- Consider the following C code snippet for calculating base raised to the power of exp: #include double power(double base, int exp) { ...
- What is the output for the below code MyList = ["New York", "London", "Paris", "New Delhi"] MyFile=open('output.txt','w') for element in MyList: prin...
- In a doubly linked list with n nodes, what is the time complexity to delete a node given only a pointer to that node (not the head), and why does this diff...
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)