• 2022-06-04
    score是一个整数数组,有五个元素,已经正确初始化并赋值,仔细阅读下面代码,程序运行结果是()temp=score[0];for(intindex=1;index<5;index++){if(score[index]temp=score[index];}}
    A: 求最大数
    B: 求最小数
    C: 找到数组最后一个元素
    D: 编译出错
  • B

    内容

    • 0

      当输入为 ‘cbabc’ 时,下列程序的输出结果为?s1 = raw_input() index = 0 s2 = '' while index &#91; len(s1) - 1: if s1&#91;index&#93; &#93; s1&#91;index + 1&#93;: s2 += s1&#91;index&#93; else: s2 = s2 * 2 index += 1 print s2

    • 1

      下面代码的运行结果是( )。 var arr=&#91;1,2,3,4,5,6&#93;; var index=arr.indexOf(3,6); console.log(index); A: 2 B: -1 C: 5 D: 0

    • 2

      冒泡排序算法描述如下: 它的时间复杂度为:;空间复杂度为def bubble(score):n = len(score)for i in range(n-1):for j in range(n-1-i):if(score&#91;j&#93;>;score&#91;j+1&#93;):score&#91;j&#93;,score&#91;j+1&#93; = score&#91;j+1&#93;,score&#91;j&#93;

    • 3

      对于如下C程序:#include &#91;stdio.h&#93; void Func (char *); int main() { char str&#91;20&#93;; scanf ("%s", str); Func(str); printf ("%s\n", str);} void Func(char *str) { int i = 0; int index = 0; char temp; while (str&#91;index&#93; != '\0'){ index++; } for (i = 0; i < index/2 ; i++){ temp = str[i]; str[i] = str&#91;index - 1 - i&#93;; str&#91;index - 1 - i&#93; = temp; }}如果输入为“abcd”,则输出为:[/i][/i] A: abcd B: dcba C: dcdc D: abab

    • 4

      int index = 1;  int &#91;&#93; foo = new int &#91;3&#93;;  int bar = foo &#91;index&#93;;  int baz = bar + index;   What is the result?() A:  Baz has the value of 0 B:  Baz has the value of 1 C:  Baz has the value of 2 D:  An exception is thrown. E:  The code will not compile.