计算机二级

3773考试网计算机等级考试计算机二级正文

2014计算机等级考试二级java经典试题及答案一

来源:2exam.com 2014-7-24 8:50:52

 选择题

  12.1 以下程序的输出结果是

  A) 1,6,3,1,3

  B) 1,6,3,2,3

  C) 1,6,3,6,3

  D) 1,7,3,2,3

  main()

  { int i=1,j=3;

  printf("%d,",i++);

  { int i=0;

  i+=j*2;

  printf("%d,%d,",i,j);

  }

  printf("%d,%d\\n",i,j);

  }

  答案:B

  12.2 以下程序的输出结果是

  A) 1 2 3 4

  B) 4 3 2 1

  C) 0 0 0 0

  D) 4 4 4 4

  main()

  { int a[]={1,2,3,4},i,x=0;

  for(i=0; i<4; i++) { sub(a,&x); printf("%d ",x); }

  printf("\\n");

  }

  sub(int *s,int *y)

  { static int t=3;

  *y=s[t]; t--;

  }

  答案:B

触屏版 电脑版
3773考试网 琼ICP备12003406号-1