已知下面的程序段,正确的判断是______。 #define A3 #define B(A) ((A+1)*a) int a=3; …… X=3*(A+B(7));
A.程序错误,不允许嵌套定义
B.X=93
C.X=81
D.程序错误,宏定义不允许有参数
第1题:
阅读下面的程序段: publiC class Sun { public static void main (String args[ ]) { int a=0; for(int i=1;i<=3;i++) { for(int j=1;j<=i;j++) { for(int k=j;k<=3;k++) { a=a+1; } } } System.out.println(A) ; } } 执行上面的3重循环后,a的值为( )。
A.3
B.9
C.14
D.21
第2题:
以下程序运行后,输出结果是 #define PT 5.5 #define S(x)PT* x * x main() {int a=1,b=2; printf("%4.lf\n",S(a+b); }
A.49.5
B.9.5
C.22
D.45
第3题:
已知下面的程序段,正确的判断是 ______。#define A 3#define B(A) ((A+1)*A) ……int a=3;X=3*(A+B(7));
A.程序错误,不允许嵌套定义
B.X=93
C.X=81
D.程序错误,宏定义不允许有参数
第4题:
有以下程序
#include <stdio.h>
#define F(X,Y) (X)*(Y)
main( )
{ int a=3, b=4;
printf("%d\n", F(a++, b++));
}
程序运行后的输出结果是
A.12
B.15
C.16
D.20
第5题:
以下程序的输出结果是______。 #define M(x,y,z) x*y+z main() { int a=1,b=2,c=3 printf("%d%d\n",M(a+b,b+c,c+a)); }
A.19
B.17
C.15
D.12
第6题:
以下程序运行后,输出结果是______。 #define P4.5 #define S(x)P*x*x #include<stdio.h> main() { int a=2,b=3; printf("%.1f\n",S(a+b)); }
A.49.5
B.112.5
C.18
D.24
第7题:
执行下列程序的结果是( )。 #define N 5 #define H(x) ((N+2)*x) main() { int a=2,b=3,C; c=H(a+b); printf("%d",c); }
A.15
B.17
C.23
D.35
第8题:
以下程序运行后,输出结果是 ( ) # include<stdio.h> # define PT5.5 # define S (x)PT* x * x main( ) { int a=1,b=2; printf("%4.1f\n",s(a+b)); }
A.49.5
B.9.5
C.22
D.45
第9题:
有以下程序: #includedstdi0.h> #define f(x)X*x*x main( ) {int a=3,S,t; s=f(a+1);t=f((a+1)); printf("%d,%d\n",S,t); } 程序运行后的输出结果是( )。
A.10,64
B.10,10
C.64,10
D.64,64
第10题:
有以下程序:#include <stdio.h>#define P 3void F(int x) { return(P* x* x); tmain( ){ printf(" % d \n" ,F(3 + 5) ); }程序运行后的输出结果是( )。
A.192
B.29
C.25
D.编译出错
第11题:
已知下面的程序段,正确的判断是______ #define A3 #define B(A) ((A+1)*a) X=3*(A+B(7)); X=3*(A+B(7);
A.程序错误,不允许嵌套定义
B.X=93
C.X=81
D.程序错误,宏定义不允许有参数
第12题:
3
5
7
9
第13题:
以下程序运行后,输出结果是 #define PT 5.5 #define S(x) PT*x*x #include<stdio.h> main() { int a=1,b=2; printf("%4.1f\n",s(a+b));}
A.49.5
B.9.5
C.22
D.45.0
第14题:
以下程序的输出结果是【18】 。
#define MAX(x,y)(x)>(y)?(x):(y)
main()
{ int a=5,b=2,c=3,d=3,t;
t=MAX(a+b,c+d)*10;
printf("%d\n",t);
}
第15题:
下列程序的运行结果为( )。 #define MAX(x,y)(x)>(y)?(x):(y) main() { int a=2,b=3,c=1,d=3,t; printf("%d\n",(MAX(a+b,c+d))*100); }
A.500
B.5
C.4
D.400
第16题:
已知下面的程序段,正确的判断是______。 #define A 3 #define B(A) ((A+1)*a) int a=3; ...... X=3*(A+B(7));
A.程序错误,不允许嵌套定义
B.X=93
C.X=81
D.程序错误,宏定义不允许有参数
第17题:
若有如下程序: sub(int a,int b,int c) { c=a+b; return(c);} main() {int x=3,y=4,z=6; sub(x,y,z); printf('%d”,z); } 则程序运行后的输出结果是( )。
A.3
B.6
C.7
D.4
第18题:
有如下程序 int func(int a,int b) { return(a+b); } main() { int x=3,y=6,z=7,r; r=func(func(x,y),z); printf("%\d\n",r); }该程序的输出的结果是______。
A.14
B.15
C.16
D.17
第19题:
有以下程序
#include<stdio.h>
#define f(X)X*X*X
main( )
{int a=3,s,t;
s=f(a+1);t=f((n+1));
printf(“%d,%d\n”,s,t);
}
程序运行后的输出结果是
A.10,64
B.10,10
C.64,10
D.64,64
第20题:
以下程序运行后,输出结果是______。 #define PT 5.5 #define S(x) PT*x*x main() { int a=1,b=2;printf("%4.1 f\n",S(a+b)); }
A.49.5
B.9.5
C.22
D.45
第21题:
若有宏定义如下: #define X 5 #define Y X+1 #define Z Y*X/2以下程序段的输出结果是______。 int a;a=Y; printf("%d\n",Z); printf("%d\n",--a);
A.7 6
B.12 6
C.12 5
D.7 5
第22题:
以下程序运行后,输出结果是 #define PT 5.5 #define S(x) PT*x*x #include<stdio.h> main() { int a=1,b=2; printf("%4.1f\n",S(a+b));}
A.49.5
B.9.5
C.22
D.45
第23题:
下面程序的运行结果是()。 #define DOUBLE(r) r*r main( ) { int a=1,b=2,temp; temp=DOUBLE(a+b); printf(“%d/n”,temp); }
第24题:
10,64
10,10
64,10
64,64