Infosys Pseudocode Questions Infosys Pseudocode Questions Please wait while the activity loads. If this activity does not load, try refreshing your browser. Also, this page requires javascript. Please visit using a browser with javascript enabled. If loading fails, click here to try again Question 1 Given the pseudocode for performing Binary search in an array of elements sorted in ascending order. What operation must be implemented in the 3rd so that the execution of binary search is successful? Middle element should be compared with x.If x and the middle element match, we return the middle index._ _ _ _ _ _ _ _ _ _ _Else ( x is smaller than the middle element) recur for the left half Else if x is greater than the middle element, then x can only lie in the right half subarray after the middle element. So we recursively search for the right Else if x is greater than the middle element, then x can only lie in the left half subarray after the middle element. So we recursively search for left None of the above Else if x is less than the middle element, then x can only lie in the right half subarray after the middle element. So we recursively search for the right Infosys Pseudocode Questions Discuss itQuestion 2 Predict the output of the given pseudo code if the value of the number is 6: Read number k = 2 i = 2 while i <= number: k = k * i i = i +1 end while write k 1440.0 1340.0 1700.0 1560.0 Infosys Pseudocode Questions Discuss itQuestion 3 What will happen for the below pseudocode: Set Integer res = 0 do --res display res res++ While(res >= 0) End do-while The program will not enter the loop. Code will run infinite number of times. Code will execute and the value of res will be displayed once. Code will execute and the value of res will be displayed twice. Infosys Pseudocode Questions Discuss itQuestion 4 What is the output of the below pseudocode? Set value = ' ' * 10;print value 100 320 10 200 Infosys Pseudocode Questions Discuss itQuestion 4-Explanation: As the ASCII code for a blank space is the decimal number 32, thus 32 * 10 = 320 Question 5 What happens when the below pseudocode is executed? Set Integer value = 10 Set Integer salary= 0 While (value = 10) salary = salary + 100 display salaryEND While Code executes successfully and the value of salary is displayed once. Code executes successfully and nothing is displayed. Code executes successfully the value of salary is displayed infinite times. Compilation error. Infosys Pseudocode Questions Discuss itQuestion 5-Explanation: As the value of the variable "value" is not changing throughout the while loop so while loop will not hit false condition also it will never break Hence Option (C) is correct. Question 6 Count the number of " * " printed by the given pseudo code when the input is 25. Write "Please enter a number" Read input Repeat while input > 0 if( input > 0 and input <=12 ) Write * else if ( input >12 and input <=24 ) Write ** else if ( input >24 and input< = 30 ) Write *** input -- end if End while 39.0 57.0 35.0 29.0 Infosys Pseudocode Questions Discuss itQuestion 7 Count the number of " # " printed. For m = 0 to 14 do For n = 0 to 14 do display '#' End-for if(m = 5) then do break End-ifEnd-for 13 84 28 63 Infosys Pseudocode Questions Discuss itQuestion 8 Count the number of " # " printed. For x = 0 to 8 do For y = 0 to 6 do display '#' End-for If(x = 2) then do break End-if End-for 14 13 21 20 Infosys Pseudocode Questions Discuss itQuestion 9 What will be the output of the following pseudocode? Integer x, y, z Set x = 4, y = 3, z = 1 if (x >> (z - 1) && y << (z + 1)) x = x + c else y = x << z End if Print x - y + z 5 3 8 None of these 2 Infosys Pseudocode Questions Discuss itQuestion 10 What will be the output of the given pseudo code if n = 10? Read nInitialize i to 5, sum to 0while i < n do increase sum by i increment iend whileWrite sum 35.0 25.0 45.0 55.0 Infosys Pseudocode Questions Discuss it 12 There are 20 questions to complete. You have completed questions question Your accuracy is Correct Wrong Partial-Credit You have not finished your quiz. If you leave this page, your progress will be lost. Correct Answer You Selected Not Attempted Final Score on Quiz Attempted Questions Correct Attempted Questions Wrong Questions Not Attempted Total Questions on Quiz Question Details Results Date Score Hint Time allowed minutes seconds Time used Answer Choice(s) Selected Question Text Need more practice! Keep trying! Not bad! Good work! Perfect! Last Updated : 27 Sep, 2023 Share your thoughts in the comments Add Your Comment Please Login to comment...