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
- Non-Final state in DFA is represented by :
- A "runtime error" occurs:
- A Multilevel Feedback Queue scheduler allows a process to move between different priority queues based on its observed behaviour during execution. Which sp...
- State true or false MD5 Hashing Algorithm was invented by RSA Labs (Ronald Rivest) in 1991. MD5 was invented to replace its previous version, MD4. When Da...
- Which of the following is a non-linear data structure?
- Which of the following statements about a Mutex (Mutual Exclusion) lock is correct?
- Consider the following Java code snippet: import java.util.PriorityQueue; public class HeapQuestion5 { public static void main(Strin...
- You encounter a bug that only appears intermittently and is difficult to reproduce. What is this type of bug often called?
- In the dynamic programming solution for Matrix Chain Multiplication, the outermost loop iterates over the len (chain length). What are the correct loop bou...
- Which keyword is used in Java to indicate that a method in a subclass is intended to override a method in its superclass?
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)