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

    内容

    • 0

      若有定义int score&#91;10&#93;;,则对score数组中的元素的正确引用是( ) A: score[10] B: score[6.0] C: score[0] D: score(7)

    • 1

      对于如下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

    • 2

      下面代码的运行结果是( )。 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

    • 3

      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.

    • 4

      #include<stdio.h> main() {int i,index,n: int a&#91;10&#93;; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&a[i]); index=0; for(i=1;i<n;i++) {if(a[i]<a&#91;index&#93;)index=i;} printf("min=%d,index=%d\n",a&#91;index&#93;,index); } 程序运行时输入5 7 9 5<回车>,则程序运行结果是:______[/i][/i]