• 2021-04-14
    智慧职教: 现有段js代码:```function+findmax(a,b)+{if(a>b){++++return+b}else{++++return+a}}```
  • 其他答案都不对

    内容

    • 0

      下列正确利用表达式定义JavaScript函数的是?( ) A: x = function (a, b) {return a * b}; B: var x = function {return a * b} C: var x = function (a, b) {return a * b}; D: var x = function (a, b) {a * b}

    • 1

      主调函数 n=21 flag=oddeven(n) if flag=0 then output even else output odd endif 被调函数: function oddeven(x) if x mod 2 !=0 return 1 else return 0 endif endfunction 请问上述伪代码运行的结果是_____________。

    • 2

      下列求最大值函数代码正确的是( ) A: max(a,b) { int c; if(a>b) c=a; else c=b; return c; } B: max(int a,int b) { int c; if(a>b) c=a; else c=b; return c; } C: void max(int a,int b) { int c; if(a>b) c=a; else c=b; return c; } D: int max(int a,int b) { int c; if(a>b) c=a; else c=b; return c; }

    • 3

      关于数组的排序,以下说法是正确的是:( ) A: arr.sort(function(a,b){return a-b}); //这是升序排列。 B: arr.sort(function(a,b){return b-a}); //这是升序排列。 C: arr.sort(function(a,b){return a-b}); //这是降序排列。 D: arr.sort(function(a,b){return b-a}); //这是降序排列。

    • 4

      代码填空【使用递归实现二分查找】 int binarySearch(int a[], int key, int low, int high) { if (low > high) return -1; int mid; mid = (low + high) / 2; if (key == a[mid]) return mid; else if (key < a[mid]) return ________(1)__________; else return ________(2)______________; }