有以下程序
#include "stdio.h"
#include "string.h"
void main( )
{ char s1[50]={"some string *"},s2[]={"test"};
printf("%s\n", strcat(s1,s2));
}
执行后的输出结果是( )。
A. some string
B. test
C. some stritest
D. some string *test
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e0346511.html
点击查看答案
下列条件语句中,输出结果与其他语句不同的是()。
A. if(a) printf(“%d\n”,x); else printf(“%d\n”,y);
B. if(a==0) printf(“%d\n”,y); else printf(“%d\n”,x);
C. if(a!=0) printf(“%d\n”,x); else printf(“%d\n”,y);
D. if(a==0) printf(“%d\n”,x); else printf(“%d\n”,y);
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e034650b.html
点击查看答案
有以下程序
int fun(int x,int y,int *cp,int *dp)
{ *cp=x+y; *dp=x-y; }
main()
{ int a, b, c, d;
a=30; b=50;
fun(a,b,&c,&d);
printf("%d,%d\n", c, d);
}
输出结果是()。
A. 50,30
B. 30,50
C. 80,-20
D. 80,20
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e0346514.html
点击查看答案
有以下程序
#include
double f(double x);
main()
{double a=0; int i;
for(i=0;i<30;i+=10) a+=f((double)i);
printf(“%5.0f\n”,a);
}
double f(double x)
{return x*x+1;}
程序运行后的输出结果是()。
A. 503
B. 401
C. 500
D. 1404
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e034650e.html
点击查看答案
在调用函数时,如果实参是简单变量,它与对应形参之间的数据传递方式是()。
A. 地址传递
B. 单向值传递
C. 由实参传给形参,再由形参传回实参
D. 传递方式由用户指定
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4d08-c089-2897e034650a.html
点击查看答案
下述对C语言字符数组的描述中错误的是( )。
A. 字符数组可以存放字符串
B. 字符数组中的字符串可以整体输入、输出
C. 可以在赋值语句中通过赋值运算符"="对字符数组整体赋值
D. 不可以用关系运算符对字符数组中的字符串进行比较
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e0346517.html
点击查看答案
设有如下定义:
struct sk
{int a;float b;}data,*p;
若有p=&data;,则对data中的a域的正确引用是()。
A. (*p).data.a
B. (*p).a
C. p->data.a
D. p.data.a
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6090-c089-2897e0346511.html
点击查看答案
若int x;且有下面的程序片断,则输出结果是() 。
for (x=3; x<6; x++)
{
printf((x%2) ? "##%d" : "**%d\n", x);
}
A. ##3
**4
##5
B. **3
##4
**5
C. **3
##4**5
D. ##3**4
##5
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6090-c089-2897e0346519.html
点击查看答案
设有以下程序段,则值为6的表达式是( )。
struct st { int n; struct st *next;};
static struct st a[3]={5,&a[1],7,&a[2],9,0 },*p;
p=&a[0];
A. p++->n
B. ++p->n
C. p->n++
D. (*p).n++
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-54d8-c089-2897e0346515.html
点击查看答案
以下程序的输出结果是()。
main()
{ int i,j,x=0;
for(i=0;i<2;i++)
{ x++;
for(j=0;j<3;j++)
{ if(j%2)continue;
x++;
}
x++;
}
printf("x=%d\n",x);
}
A. x=4
B. x=8
C. x=6
D. x=12
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-58c0-c089-2897e0346507.html
点击查看答案