对以下for循环,叙述正确的是()。
for(x=0,y=0;(y!=123)&&(x<4);x++,y++);
A. 是无限循环
B. 循环次数不定
C. 执行了4次
D. 执行了3次
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-54d8-c089-2897e034651e.html
点击查看答案
以下程序运行后的输出结果是( ) 。
#include
#include
#include
main()
{ char *p; int i;
p=(char *)malloc(sizeof(char)*20);
strcpy(p,"welcome");
for(i=6;i>=0;i--) putchar(*(p+i));
printf("\n-"); free(p);
}
A. welcome
B. ewlcome
C. wlecome
D. emoclew
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e034650a.html
点击查看答案
下面程序输出数组中的最大值,由s指针指向该元素.
main()
{ int a[10]={6,7,2,9,1,10,5,8,4,3,},*p,*s;
flr(p=a, s=a; p-a<10; p++)
if(_________)s=p;
printf("The max:%d",*s):
}
则在if语句中的判断表达式应该是()。
A. p>s
B. *p>*s
C. a[p]>a[s]
D. p-a>p-
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e034650c.html
点击查看答案
若有以下定义和语句:double r=99,*p=&r; *p=r;则以下正确的叙述是()。
A. 以下两处的*p含义相同,都说明给指针变量p赋值
B. 在“double r=99,*p=&r;”中,把r的地址赋值给了p所指的存储单元
C. 语句“*p=r;”把变量r的地址值赋给指针变量p
D. 语句“*p=r;”取变量r的值放回r中
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e0346510.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
点击查看答案
有定义语句:char s[10];,若要从终端给s输入5个字符,错误的输入语句是( )。
A. gets(&s[0]);
B. scanf("%s",s+1);
C. gets(s);
D. scanf("%s",s[1]);
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-54d8-c089-2897e0346508.html
点击查看答案
设有以下语句
int a=1,b=2,c;
c=a^(b<<2);
执行后,C的值为()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e0346501.html
点击查看答案
有以下程序
#include
void fun(int *s)
{ static int j=0;
do
{ s[j]+=s[j+1];
}while(++j<2);
}
void main()
{ int k,a[10]={1,2,3,4,5};
for(k=1;k<3;k++)
fun(a);
for(k=0;k<5;k++)
printf("%d",a[k]);
}
执行后的输出结果是( )。
A. 35756
B. 23445
C. 35745
D. 12345
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e0346518.html
点击查看答案
下面程序的输出结果是()。
#include
#include
main()
{ char *p1="abc",*p2="ABC",str[50]= "xyz";
strcpy(str+2,strcat(p1,p2));
printf("%s\n",str);}
A. xyzabcABC
B. zabcABC
C. xyabcABC
D. yzabcABC
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-58c0-c089-2897e034650a.html
点击查看答案
有以下程序
#include "stdio.h"
void main()
{ int a=0,b=1,c=0,d=20;
if(a) d=d-10;
else if(!b)
if(!c) d=1;
else d=25;
printf("d=%d\n",d);
}
执行后的输出结果是( )。
A. d=10
B. d=15
C. d=20
D. d=25
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6c48-c089-2897e034650a.html
点击查看答案