Home / MCQ Bank / Computer
Computer Methods In Ruby Difficulty: Medium

In Ruby, what does the `yield` keyword do in a method?

Select the correct option to test your answer:

More Computer Questions

What is the best case for linear search? The . . . . . . . . can also be used to distribute both jars and native libraries for use in the map and/or reduce tasks. Which of the following is not true about documentation? What is the scope of typedef defined data types? What is the space complexity of the following dynamic programming implementation of the minimum number of insertions to form a palindrome problem? #include<stdio.h> #include<string.h> int max(int a, int b) { if(a > b) return a; return b; } int min_ins(char *s) { int len = strlen(s), i, j; int arr[len + 1][len + 1]; char rev[len + 1]; strcpy(rev, s); strrev(rev); for(i = 0;i <= len; i++) arr[i][0] = 0; for(i = 0; i <= len; i++) arr[0][i] = 0; for(i = 1; i <= len; i++) { for(j = 1; j <= len; j++) { if(s[i - 1] == rev[j - 1]) arr[i][j] = arr[i - 1][j - 1] + 1; else arr[i][j] = max(arr[i - 1][j], arr[i][j - 1]); } } return len - arr[len][len]; } int main() { char s[] = "abcda"; int ans = min_ins(s); printf("%d",ans); return 0; }