题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-10-18 11:32:01

[单选题]有以下程序
#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);
}
程序的运行结果是()。
A.12 12
B.11 7
C.11 11
D.12 7

更多"[单选题]有以下程序#include &lt;stdio.h&gt"的相关试题:

[单选题]有以下程序
#include
#define N 4
Void fun(int a[][N],int b[])
{ int i;
For(i=0;i}
Main()
{ int x[][N]={{1,2,3},{4},{5,6,7,8},{9,10}},y[N],i;
Fun(x,y);
For(i=0;iPrintf("\n");
}
程序的运行结果是()。
A.1,2,3,4,
B.1,0,7,0,
C.1,4,5,9,
D.3,4,8,10,
[单选题]有以下程序
#include
#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
[单选题]以下程序的输出结果是()。
#include
#define FUDGE(y) 2.84+y
#define PR(a) printf("%d",(int)(a) )
#define PRINT1(a) PR(a);putchar('\n')
Main()
{ int x=2;
PRINT1(FUDGE(5)*x);
}
A.11
B.12
C.13
D.15
[单选题]有以下程序
Main()
{ int k=4,n=0;
For( ; n{ n++;
If(n%3!=0) continue;
K--; }
Printf("%d,%d\n",k,n);
}
程序运行后的输出结果是()。
A.1,1
B.2,2
C.3,3
D.4,4
[单选题]以下程序的输出结果是? int n=0; while(n++<=2); Console.Write(n);
A.2
B.3
C.4
D.语法错误
[单选题]若有以下程序
#include
Void f(int n);
Main()
{ void f(int n);
F(5);
}
Void f(int n)
{ printf("%d\n",n); }
则以下叙述中不正确的是()。
A.若只在主函数中对函数f进行说明,则只能在主函数中正确调用函数f
B.若在主函数前对函数f进行说明,则在主函数和其后的其它函数中都可以正确调用函数f
C.对于以上函数程序,编译时系统会提示出错信息;提示对f函数重复说明
D.函数f无返回值,所以可用void将其类型定义为无值型
[单选题]有以下程序
#include
Main()
{ int n, *p=NULL;
*p=&n;
Printf("Input n:");
Scanf("%d",&p);
Printf("output n:");
Printf("%d\n",p);
}
该程序试图通过指针p为变量n读入数据并输出,但程序有多处错误,以下语句正确的是()。
A.int n , *p=NULL;
B.*p=&n;
C.scanf("%d",&p)
D.printf("%d\n",p);
[单选题]有以下程序
#include
#include
Void fun( char s[][10],int n)
{ char t; int i,j;
For(i=0;iFor(j=i+1;j/* 比较字符串的首字符大小,并交换字符串的首字符 */
If(s[i][0]>s[j][0]) {t=s[i][0];s[i][0]=s[j][0];s[j][0]=t;}
}
Main()
{ char ss[5][10]={"bcc","bbcc","xy","aaaacc","aabcc"};
Fun(ss,5); printf("%s,%s\n",ss[0],ss[4]);
}
程序的运行结果是()。
A.xy,aaaacc
B.aaaacc,xy
C.xcc,aabcc
D.acc,xabcc
[单选题]有以下程序
#include
#include
Typedef struct{ char name[9]; char sex; float score[2]; } STU;
Void f(STU a)
{ STU b={"Zhao",'m',85.0,90.0};
Int i;
Strcpy(a name,b.name);
A sex=b sex;
For(i=0;i<2;i++)
A score[i]=b score[i];
}
Main()
{ STU c={"Qian",'f',95.0,92.0};
F(c);
Printf("%s,%c,%2.0f,%2.0f\n",c.name,c.sex,c.score[0],c.score[1]);
}
程序的运行结果是()。
A.Qian,f,95,92
B.Qian,m,85,90
C.Zhao,f,95,92
D.Zhao,m,85,90
[单选题]有以下程序
#include
#include
Int fun(int n)
{ int *p;
P=(int*)malloc(sizeof(int));
*p=n; return *p;
}
Main()
{ int a;
A=fun(10); printf("%d\n",a+fun(10));
}
程序的运行结果是()。
A.0
B.10
C.20
D.出错
[单选题]以下程序中函数f的功能是将n个字符串,按由大到小的顺序进行排序。
#include
Void f(char p[][10],int n)
{ char t[20]; int i,j;
For(i=0;iFor (j=i+1;jIf(strcmp(p[i],p[j])<0)
{ strcpy(t,p[i]);strcpy(p[i],p[j]);strcpy(p[j],t);}
}
Main()
{char p[][10]={"abc","aabdfg","abbd","dcdbe","cd"};
F(p,5); printf("%d\n",strlen(p[0]));
}
程序运行后的输出结果是()。
A.6
B.4
C.5
D.3
[单选题]有以下程序
Main()
{ int i,n=0;
For( i=2;i<5;i++)
{do
{ if(i%3) continue;
N++;
}while(!i);
N++;
}
Printf("n=%d\n",n);
}
程序执行后输出结果是()。
A.n=5
B.n=2
C.n=3
D.n=4
[单选题]有如下程序
Main( )
{ int m=2,n=-1,d=6;
If(mIf(n<0) d=0;
Else d++;
Printf("%d\n",d);
}
该程序的输出结果是()。
A.0
B.1
C.6
D.7
[单选题]有以下程序
#include
Struct NODE
{int num; struct NODE *next; }
Main()
{struct NODE *p,*q,*r;
P=(struct NODE *)malloc(sizeof(struct NODE));
Q=(struct NODE *)malloc(sizeof(struct NODE));
R=(struct NODE *)malloc(sizeof(struct NODE));
P->num=10;q->num=20;r->num=30;
P->next=q;q->next=r;
Printf("%d\n",p->num+q->next->num);
}
程序运行后的输出结果是()。
A.10
B.20
C.30
D.40
[单选题]有以下程序
#include
Int fun(char s[])
{ int n=0;
While(*s<='9'&&*s>='0') { n=10*n+*s-'0';s++;}
Return(n);
}
Main()
{ char s[10]={ 6', '1','*','4','*', '9', '*', '0', '*'};
Printf("%d\n",fun(s));
}
程序的运行结果是()。
A.9
B.61490
C.61
D.5
[单选题]有以下程序
#include
Struct tt
{ int x; struct tt *y ; }*p;
Struct tt a[4]={20,a+1,15,a+2,30,a+3,17,a};
Main()
{ int i;
P=a;
For(i=1;i<=2;i++) { printf("%d, ",p->x); p=p->y; }
}
程序的运行结果是()。
A.20,30,
B.30,17,
C.15,30,
D.20,15,
[单选题]有以下程序
#include
Void WriteStr(char *fn,char *str)
{ FILE *fp;
Fp=fopen(fn,"w");
Fputs(str,fp);
Fclose(fp);
}
Main()
{
WriteStr("t1.dat","start");
WriteStr("t1.dat","end");
}
程序运行后,文件t1.dat中的内容是()。
A.start
B.end
C.startend
D.endrt
[单选题]有以下程序
#include
Void fun(char *t, char *s)
{ while(*t!=0 ) t++;
While((*t++=*s++)!=0);
}
Main()
{ char ss[10]= "acc",aa[10]= "bbxxyy";
Fun(ss,aa); printf("%s,%s\n",ss,aa);
}
程序的运行结果是()。
A.accxyy,bbxxyy
B.acc,bbxxyy
C.accxxyy,bbxxyy
D.accbbxxyy,bbxxyy

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码