【单选题】
有以下程序,程序执行后的输出结果是( ) #include int fun(int x [ ],int n) { static int sum=0,i; for(i=0; i{ sum+=x[i]; } return sum; } void main( ) { int a[ ]={1,2,3,4,5}; int b[ ]={6,7,8,9},s=0; s=fun(a,5)+fun(b,4); printf(%d\n,s); }
【单选题】
执行下面程序后,运行结果是
#includevoid main( )
{ int x=41,y=1;
if (x%3==0 x%7==0)
{ y+=x;printf(y=%d\n}
else
{y=x;printf(y=%d}
}
【单选题】
以下程序段运行后s的值是()。 int a[3][3]={1, 2, 3, 4, 5, 1, 2, 3, 4} ; int i, j, s=1; for(i=0; i for(j=i+1; j s+=a[i][j];
【单选题】
以下程序的输出结果是_______? f(int b[],int m,int n) { int i,s=0; for(i=m;in;i=i+2) s=s+b[i]; return s; } int main() { int x,a[]={1,2,3,4,5,6,7,8,9}; x=f(a,3,7); printf(%d\n,x); }
【单选题】
下述程序的运行结果( )。
#includevoid main()
{
int x=1,a=0,b=0;
switch(x)
{
case 0:b++;
case 1:a++;
case 2:a++;b++;
}
printf(a=%d,b=%d\n,a,b);
}
【单选题】
执行下面程序段后,输出字符B的个数是( )x=0;while(x=5){printf("B");x+=2;}
【简答题】
以下程序输出的结果是[填空1]。#include stdio.hvoid main(){ int x, i;for(i=1; i i++){ x=i;if(++x%2==0)if(++x%3==0)if(++x%7==0)printf(%d\n,x);}printf(“\n”);}
【简答题】
以下程序输出的结果是[填空1]。#include stdio.hvoid main(){ int x, i;for(i=1; i i++){ x=i;if(++x%2==0)if(++x%3==0)if(++x%7==0)printf(%d\n,x);}printf(“\n”);}
【简答题】
以下程序输出的结果是[填空1]。#include stdio.hvoid main(){int x, i;for(i=1; i i++){ x=i;if(++x%2==0)if(++x%3==0)if(++x%7==0)printf(%d\n,x);}printf(“\n”);}
【单选题】
运行下面程序时,会产生什么异常?( ) public class X7_1_4 {
public static void main(String[] args) {
int x = 0; int y = 5/x; int[] z = {
1,2,3,4
}
; int p = z[4];
}
}
③
ArrayIndexOutOfBoundsException