第11题 (1.0分) 题号:6877 难度:中 第8章
若有定义语句:double a, *p=&a ; 以下叙述中错误的是().
A:定义语句中的*号是一个间址运算符
B:定义语句中的*号是一个说明符
C:定义语句中的p只能存放double类型变量的地址
D:定义语句中,*p=&a把变量a的地址作为初值赋给指针变量p
第12题 (1.0分) 题号:6849 难度:中 第8章
有以下程序:
#include <stdio.h>
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);
第13题 (1.0分) 题号:6940 难度:中 第8章
若有定义语句:
char *s1="OK", *s2="ok";
以下选项中,能够输出"OK"的语句是
A:if (strcmp(s1,s2)!=0) puts(s2);
B:if (strcmp(s1,s2)!=0) puts(s1);
C:if (strcmp(s1,s2)==1) puts(s1);
D:if ( strcmp(s1,s2)==0) puts(s1);
第14题 (1.0分) 题号:7091 难度:中 第8章
有以下程序
#include <stdio.h>
int b=2;
int fun(int *k )
{ b=*k+b; return (b); }
main()
{ int a[10]={1,2,3,4,5,6,7,8}, i;
for(i=2;i<4;i++) {b=fun(&a[i])+b; printf("%d ",b);}
printf("\n");
}
程序运行后的输出结果是
A:8 10
B:10 28
C:10 12
D:10 16
第15题 (1.0分) 题号:7150 难度:中 第8章
若有以下程序
#include <stdio.h>
char *a="you", b[ ]="welcome#you#to#China!";
main()
{ int i,j=0; char *p;
for ( i=0; b[i]!='\0'; i++ )
{ if (*a == b[i])
{ p=&b[i];
for (j=0; a[j]!='\0'; j++)
{ if (a[j] != *p) break;
p++;
}
if (a[j]=='\0') break;
}
}
printf("%s\n", p);
}
则程序的输出结果是
A:#to#China!
B:#you#to#China!
C:me#you#to#China!
D:#China!
第16题 (1.0分) 题号:6820 难度:中 第8章
设已有定义:float x;,则以下对指针变量p进行定义且赋初值的语句中正确的是().
A:int *p=(float)x;
B:float *p=&x;
C:float p=&x;
D:float *p=1024;
第17题 (1.0分) 题号:6885 难度:中 第8章
有以下程序(注:字符a的ASCII码值为97) :
#include <stdio.h>
main()
{ char *s ={ "abc" };
do
{printf ("%d", *s%10); ++s; }
while ( *s );
}
程序运行后的输出结果是().
A:789
B:abc
C:7890
D:979899
第18题 (1.0分) 题号:6998 难度:中 第8章
有以下程序
#include <stdio.h>
void fun1(char *p)
{
char *q;
q=p;
while(*q!='\0')
{
(*q)++;
q++;
}
}
main()
{
char a[]={"Program"}, *p;
p=&a[3];
fun1(p);
printf("%s\n",a);
}
程序执行后的输出结果是
A:Prphsbn
B:Prohsbn
C:Progsbn
D:Program
第19题 (1.0分) 题号:7206 难度:中 第8章
若有以下程序段
char str[4][12]={ "aa","bbb","ccccc","d" } , *strp[4];
int i;
for( i = 0; i< 4; i++ ) strp[i] = str[i];
不能正确引用字符串的选项是
A:str[0]
B:strp
C:strp[3]
D:*strp
第20题 (1.0分) 题号:7023 难度:中 第8章
有以下程序
#include <stdio.h>
void f(int *p,int *q);
main()
{
int m=1,n=2,*r=&m;
f(r, &n);
printf("%d,%d",m,n);
}
void f(int *p,int *q)
{
p=p+1;
*q=*q+1;
}
程序运行后的输出结果是
A:2,3
B:1,3
C:1,4
D:1,2