Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  In the above question, the correction needed ... Start Learning for Free
In the above question, the correction needed in the program to make it work properly is
  • a)
    Change line 6 to: if (Y[k] < x) i = k + 1; else j = k-1;
  • b)
    Change line 6 to: if (Y[k] < x) i = k - 1; else j = k+1;
  • c)
    Change line 6 to: if (Y[k] <= x) i = k; else j = k;
  • d)
    Change line 7 to: } while ((Y[k] == x) && (i < j));
Correct answer is option 'A'. Can you explain this answer?
Most Upvoted Answer
In the above question, the correction needed in the program to make it...
Below is the corrected function f(int Y[10], int x) { int i, j, k; i = 0; j = 9; do { k = (i + j) /2; if( Y[k] < x) i = k + 1; else j = k - 1; } while(Y[k] != x && i < j); if(Y[k] == x) printf ("x is in the array ") ; else printf (" x is not in the array ") ; }[/sourcecode] 
Free Test
Community Answer
In the above question, the correction needed in the program to make it...
A) Change line 6 to: if (Y[k] == X[i]):
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Question Description
In the above question, the correction needed in the program to make it work properly isa)Change line 6 to: if (Y[k] < x) i = k + 1; else j = k-1;b)Change line 6 to: if (Y[k] < x) i = k - 1; else j = k+1;c)Change line 6 to: if (Y[k] <= x) i = k; else j = k;d)Change line 7 to: } while ((Y[k] == x) && (i < j));Correct answer is option 'A'. Can you explain this answer? for Computer Science Engineering (CSE) 2026 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about In the above question, the correction needed in the program to make it work properly isa)Change line 6 to: if (Y[k] < x) i = k + 1; else j = k-1;b)Change line 6 to: if (Y[k] < x) i = k - 1; else j = k+1;c)Change line 6 to: if (Y[k] <= x) i = k; else j = k;d)Change line 7 to: } while ((Y[k] == x) && (i < j));Correct answer is option 'A'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2026 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for In the above question, the correction needed in the program to make it work properly isa)Change line 6 to: if (Y[k] < x) i = k + 1; else j = k-1;b)Change line 6 to: if (Y[k] < x) i = k - 1; else j = k+1;c)Change line 6 to: if (Y[k] <= x) i = k; else j = k;d)Change line 7 to: } while ((Y[k] == x) && (i < j));Correct answer is option 'A'. Can you explain this answer?.
Solutions for In the above question, the correction needed in the program to make it work properly isa)Change line 6 to: if (Y[k] < x) i = k + 1; else j = k-1;b)Change line 6 to: if (Y[k] < x) i = k - 1; else j = k+1;c)Change line 6 to: if (Y[k] <= x) i = k; else j = k;d)Change line 7 to: } while ((Y[k] == x) && (i < j));Correct answer is option 'A'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of In the above question, the correction needed in the program to make it work properly isa)Change line 6 to: if (Y[k] < x) i = k + 1; else j = k-1;b)Change line 6 to: if (Y[k] < x) i = k - 1; else j = k+1;c)Change line 6 to: if (Y[k] <= x) i = k; else j = k;d)Change line 7 to: } while ((Y[k] == x) && (i < j));Correct answer is option 'A'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of In the above question, the correction needed in the program to make it work properly isa)Change line 6 to: if (Y[k] < x) i = k + 1; else j = k-1;b)Change line 6 to: if (Y[k] < x) i = k - 1; else j = k+1;c)Change line 6 to: if (Y[k] <= x) i = k; else j = k;d)Change line 7 to: } while ((Y[k] == x) && (i < j));Correct answer is option 'A'. Can you explain this answer?, a detailed solution for In the above question, the correction needed in the program to make it work properly isa)Change line 6 to: if (Y[k] < x) i = k + 1; else j = k-1;b)Change line 6 to: if (Y[k] < x) i = k - 1; else j = k+1;c)Change line 6 to: if (Y[k] <= x) i = k; else j = k;d)Change line 7 to: } while ((Y[k] == x) && (i < j));Correct answer is option 'A'. Can you explain this answer? has been provided alongside types of In the above question, the correction needed in the program to make it work properly isa)Change line 6 to: if (Y[k] < x) i = k + 1; else j = k-1;b)Change line 6 to: if (Y[k] < x) i = k - 1; else j = k+1;c)Change line 6 to: if (Y[k] <= x) i = k; else j = k;d)Change line 7 to: } while ((Y[k] == x) && (i < j));Correct answer is option 'A'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice In the above question, the correction needed in the program to make it work properly isa)Change line 6 to: if (Y[k] < x) i = k + 1; else j = k-1;b)Change line 6 to: if (Y[k] < x) i = k - 1; else j = k+1;c)Change line 6 to: if (Y[k] <= x) i = k; else j = k;d)Change line 7 to: } while ((Y[k] == x) && (i < j));Correct answer is option 'A'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev