Common Data for Questions 50 and 51: The procedure given below is required to find and replace certain characters inside an input character string supplied in array A . The characters to be replaced are supplied in array oldc , while their respective replacement characters are supplied in array newc . Array A has a fixed length of five characters, while arrays oldc and newc contain three characters each. However, the procedure is flawed. void findandreplace (char *A, char *oldc, char *newc) for (int i=0; i The procedure is tested with the following four test cases. (1) oldc = "abc", newc = "dab" (2) oldc = "cde", newc = "bcd" (3) oldc = "bca", newc = "cda" (4) oldc = "abc", newc = "bac" If array A is made to hold the string "abcde", which of the above four test cases will be successful in exposing the flaw in this procedure?
Topic-wise GATE CS PYQs with verified steps
