下列程序的运行结果为【 】。 main () { int a=5,b=5, y, z; y=b-->++a?++
下列程序的运行结果为【 】。 main () { int a=5,b=5, y, z; y=b-->++a?++b: a; z=++a>b?a: y; printf ("%d, %d, %d, %d", a, b, y, z); }
下列程序的运行结果为【 】。 main () { int a=5,b=5, y, z; y=b-->++a?++b: a; z=++a>b?a: y; printf ("%d, %d, %d, %d", a, b, y, z); }
第1题
下列程序的运行结果为【 】。 void average(); main() { float score[3][4]={{65,67,70,60},{80,87,90,81},{90,99,100,99}}; average(*score,12); } void average(p,n) int n; float*p; { int i; float sum=0; for(i=0;i<n;i++,p++) sum+=(*p); printf("%.2f\n",sum/n); }
第2题
若输入tear、test、arj,则下列程序的运行结果为【 】。 main() { char*strl[20],*str2[20],*str3[20]; char swap(); scanf("%s",str1); scanf("%s",str2); scanf("%s",str3); if (strcmp(str1,str2)>0)swap(str1,str2); if (strcmp(str1,str3)>0)swap(str1,str3); if (strcmp(str2,str3)>0)swap(str2,str3); printf("%s %s %s\n",str1,str2,str3); } char swap(p1,p2) char*p1,*p2; { char*p[20]; strcpy(p,p1);strcpy(p1,p2);strcpy(p2,p); }
第3题
以下程序的运行结果为【 】。 include <stdio.h> main() { static int b[2][3]={{1,2,3},{4,5,6}}; static int *pb[]={b[0],b[1]}; int i,j; i=0; for (j=0;j<3;j++) printf("b[%d][%d]=%d ",i,j,*(pb[i]+j)); printf("\n"); }
第4题
若输入5、9,以下程序的运行结果为【 】。 main() { int a,b,*pt1,*pt2; printf("input a,b:"); scanf("%d%d",&a,&b); pt1=&a; pt2=&b; if(a<b) swap(pt1,pt2); printf("\n%d,%d\n",*pt1,*pt2); } swap(p1,p2) int *p1,*p2; { int *p; p=p1; p1=p2; p2=p; }
第5题
当输入1、3、2时,程序运行的结果为【 】。 include <math.h> main() { float a,b,c,disc,x1,x2,p,q; do { scanf("%f,%f,%f",&a,&b,&c); disc=b*b-4*a*c; }while(disc<=0); p=-b/(2*a);q=sqrt(disc)/(2*a); x1=p+q;x2=p-q; printf("\nx1=%6.2f;x2=%6.2f\n",x1,x2); }
第6题
A.length=20 charAt=t
B.length=20 charAt=s
C.length=4 charAt=s
D.length=4 charAt=t
第7题
下面程序的运行结果是什么?#include <iostream>using namespace std;int main(){ char a[2][10]={"Xyccw"," XYcCw "}; int i; for (i=0; i<5; i++) { if(a[0]!=a[1]) break; } if (i==5) cout<<"两个字符串相同"<<endl; else if (a[0]a[1]) cout<<"较大的字符串为:"<<a[0]<<endl; else cout<<"较大的字符串为:"<<a[1]<<endl; return 0;}
第8题
A、8
B、7
C、6
D、5
第9题
下面程序的运行结果()。 include<stdio.h> void main() { ifdef MYDEBUG int a=90; printf("a=%d\n",a); else a+=10; printf("a=%d\n",a); endif )
A.a=90
B.a=100
C.a=190
D.程序不正确
第10题
A.程序的输出结果为大写字母A
B.程序的输出结果为小写字母a
C.运行时产生错误信息
D.格式说明符的个数少于输出项的个数,编译出错
第11题
public class J_Test {
public static void main(String[] args) {
int[] a = new int[5];
boolean[] b = new boolean[5];
System.out.println(a[4]);
System.out.println(b[5]);
}
}
A.程序可以通过编译并正常运行,结果输出“0false”
B.程序可以通过编译并正常运行,结果输出“1true”
C.程序无法通过编译
D.程序可以通过编译,但无法正常运行