有以下程序
#include <stdio.h>
#define S(x) (x)*x*2
main( )
{ int k=5, j=2;
printf( "%d,”,s(k+j) ); printf(”%d\n”,s( (k-j) ) );
}
程序运行后的输出结果是
A) 98,18
B) 39,11
C) 39,18
D) 98,11
第1题:
(36)有以下程序
#include <stdio.h>
#define PT 3.5;
#define S(x) PT*x*x;
main()
{ int a=1, b=2; printf(“%4.1f\n”,S(a+b));}
程序运行后输出的结果是
A)14.0 B)31.5 C)7.5 D)程序有错无输出结果
第2题:
有以下程序:
include<stdio.h>
define S(x)4*(x)*x+1
main( )
{int k=5,j=2;
printf("%d\n",S(k+j));
}
程序运行后的输出结果是( )。
A.197
B.143
C.33
D.28
此程序考查带参数的宏定义,S(k+j)展开后即4*(k+j)*k+j+1,所以结果为l43,答案为B。
第3题:
以下程序的输出结果是【 】。
include <stdio.h>
int fun(int x)
{ static int t=0;
return(t+=x);
}
main()
int s,i;
for(i=1 ;i<=5;i++) s=fun(i);
printf("%d\n",s);
第4题:
以下程序运行后的输出结果是( )。
include<stdio.h>
main()
{ int x=20;
printf("%d", 0<x<20);
printf("%d\n", 0<x && x<20);
}
第5题:
以下程序的输出结果是( )。
include<stdio.h>
main()
fint x=0;
sub(&x,16,2);
printf("%d\n",x);
}
sub(int*a,int n,int k)
{if(k<=n) sub(a,n/2,2*k);
*a+=k;
}
第6题:
下列程序的运行结果是( )。
#include<stdio.h>
#define ADD(x)x+x
main()
{ int m=1,n=2,k=3;
int s=ADD(m+n)*k;
printf("s=%d",s);
}
A.sum=18
B.sum=10
C.sum=9
D.sum=25
第7题:
下列程序的输出结果是______。#include <stdio.h>main(){ union { int k; char i[2]; } *S,a; s=&a; s->i[0]=0x39; s->i[1]=0x38; printf("%x\n",s->k);}
A.3839
B.3938
C.380039
D.390038
第8题:
(34)有以下程序
#include <stdio.h>
int fun()
{ static int x=1;
x*=2;
return x;
}
main()
{ int i,s=1;
for(i=1;i<=3;i++) s*=fun();
printf("%d\n",s);
}
程序运行后的输出结果是
A)0
B)10
C)30
D)64
第9题:
0
1
4
8
第10题:
98,18
39,11
39,18
98,11
第11题:
17,37
49,2401
17,289
49,289
第12题:
21,18
81,81
21,21
18,18
第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题:
以下程序运行后,输出结果是______。 #include<stdio.h> #define PT 5.5 #difine 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
第15题:
有以下程序#include <stdio.h>#define P 24;#define S(x) P*x+x;main(){ int a=2, b=2; printf("%d\n",S(a+b));}程序的运行结果是A.程序编译运行时报错,无法输出 B.54 C.96 D.100
第16题:
以下程序运行后,输出结果是______。 #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
第17题:
有以下程序: #include<stdi0.h> #define S(x)(x)"x"2 main( ) { int k一5,j=2; Drintf("%printf,",S(k+j));printf("%printf\n",S((k—j))); } 程序运行后的输出结果是( )。
A.98,18
B.39,11
C.39,18
D.98,11
第18题:
有以下程序: #include <stdio.h> main() { union { charch[2]; int d; } s; s.d=0x4321; printf("%x,%x\n",s.ch[0],s.ch[1]); } 在16位编译系统上,程序执行后的输出结果是( )。
A.21,43
B.43,21
C.43,00
D.21,00
第19题:
以下程序运行后,输出结果是 #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
第20题:
(35)有以下程序
#include <stdio.h>
#define S(x) 4*(x)*x+1
main()
{ int k=5,j=2;
printf("%d\n",S(k+j));
}
程序运行后的输出结果是
A)197
B)143
C)33
D)28
第21题:
11,2
25,2
11,12
25,26
第22题:
197
143
33
28
第23题:
0
10
30
64