C语言试卷

第801题

若有以下程序

#include <stdio.h>
#define S(x) x*x
#define T(x) S(x)*S(x)
main()
{
int k=5,j=2;
printf("%d,%d\n",S(k+j),T(k+j));
}

则程序的输出结果是()。

第802题

若有以下程序

#include <stdio.h>
#define S(x) (x)*(x)
#define T(x) S(x)/S(x)+1
main()
{
int k=3,j=2;
printf("%d,%d\n",S(k+j),T(k+j));
}

则程序的输出结果是()。

第803题

以下程序:

#include <stdio.h>
#define SUB(a) (a)-(a)
main()
{
int a=2,b=3,c=5,d;
d=SUB(a+b)*c;
printf("%d\n",d);
}

程序运行后的结果是()。

第804题

有以下程序

#include <stdio.h>
#define SUB(X,Y) (X+1)*Y
main()
{
int a=3,b=4;
printf("%d\n",SUB(a++,b++));
}

程序运行后的输出结果是()。

第805题

有以下程序:

#include <stdio.h>
#define M 5
#define f(x,y)x*y+M
main()
{
int k;
k=f(2,3)*f(2,3);
printf("%d\n",k);
}

程序的运行结果是()。

第806题

有以下程序

#include <stdio.h>
#define N 5
#define M N+1
#define f(x) (x*M)
main()
{
int i1,i2;
i1=f(2);
i2=f(1+1);
printf("%d %d\n",i1,i2);
}

程序的运行结果是()。

第807题

有以下程序;

#include <stdio.h>
#define N 2
#define M N+1
#define MUN (M+1)*M/2
main()
{
printf("%d\n",MUN);
}

程序运行后的输出结果是()。

第808题

有以下程序:

#include<stdio.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);
}

程序运行后的输出结果是()。

第809题

有以下程序:

#include <stdio.h>
#define FNA(x) x*x
#define FNB(x) x+x
main()
{
int a=2,b=4;
printf("%d,%d\n",FNA(FNB(a)),FNB(FNA(b)));
}

程序运行后的输出结果是()。

第810题

设有宏定义:

#define IsDIV(k,n) ((k%n==1)?1:0)

且变量m已正确定义并赋值,则宏调用:

IsDIV(m,5)&&IsDIV(m,7)

为真时所要表达的是()。

第811题

有以下程序:

#include <stdio.h>
#define F(x) 2.84+x
#define PR(a) printf("%d",(int)(a))
#define PRINT(a) PR(a);putchar('\n')
main()
{
PRINT(F(5)*2);
}

程序运行后的输出结果是()。

第812题

有以下程序

#include<stdio.h>
main()
{
int s,t,A=10;
double B=6;
s=sizeof(A);
t=sizeof(B);
printf("%d,%d\n",s,t);
}

在VC++2010平台上编译运行,程序运行后的输出结果是()。

第813题

有以下程序段

int *p;
p=______ malloc(sizeof(int));

若要求使p指向一个int型的动态存储单元,在横线处应填入的是()。

第814题

有以下程序:

#include <stdio.h>
#include <stdlib.h>
main()
{
int *a,*b,*c;
a=b=c=(int*)malloc(sizeof(int));
*a=1;
*b=2,*c=3;
a=b;
printf("%d,%d,%d\n",*a,*b,*c);
}

程序运行后的输出结果是()。

第815题

有以下程序:

#include <stdio.h>
#include <stdlib.h>
void fun(int*p1,int*p2,int*s)
{
s=(int*)malloc(sizeof(int));
*s=*p1+*p2;
free(s);
}
main()
{
int a=1,b=40,*q=&a;
fun(&a,&b,q);
printf("%d\n",*q);
}

程序运行后的输出结果是()。

第816题

有以下程序

#include <stdio.h>
#include <stdlib.h>
void fun(int*p1,int*p2,int*s)
{
s=(int*)malloc(sizeof(int));
*s=*p1+*p2;
}
main()
{
int a[2]={1,2}, b[2]={10,20},*s=a;
fun(a,b,s);
printf("%d\n",*s);
}

程序运行后的输出结果是()。

第817题

有以下程序:

#include <stdio.h>
#include <stdlib.h>
void fun(int*p1,int*s)
{
int *t;
t=(int*)malloc(2*sizeof(int));
*t=*p1+*p1++;
*(t+1)=*p1+*p1;
s=t;
}
main()
{
int a[2]={1,2}, b[2]={0};
fun(a,b);
printf("%d,%d\n",b[0],b[1]);
}

程序运行后的输出结果是()。

第818题

有以下程序:

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
main()
{
char*p1,*p2;
p1=p2=(char*)malloc(sizeof(char)*10);
strcpy(p1,"malloc");
strcpy(p2,p1+1);
printf("%c%c\n", p1[0], p2[0]);
}

程序的运行结果是()。

第819题

以下叙述中错误的是( )。

第820题

以下关于typedef的叙述错误的是()。