试题通
试题通
APP下载
首页
>
IT互联网
>
信息技术知识竞赛c语言
试题通
搜索
信息技术知识竞赛c语言
题目内容
(
单选题
)
有以下程序段
struct st
{int x;int *y;}*pt;
int a[]={1,2},b[]={3,4};
struct st c[2]={10,a,20,b};
pt=c;
以下选项中表达式的值为11的是()。

A、*pt->y

B、pt->x

C、++pt->x

D、(pt++)->x

答案:C

试题通
信息技术知识竞赛c语言
试题通
要求通过while循环不断读入字符,当读入字母N时结束循环。若变量已正确定义,以下正确的程序段是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4d08-c089-2897e0346526.html
点击查看题目
有以下程序(注:字符a的ASCII码值为97)
#include
main()
{char *s={“abc”};
do
{printf(“%d”,*s%10);++s;}
while(*s);
}
程序运行后的输出结果是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e034650d.html
点击查看题目
若有说明:int a[10];则对a 数组元素的正确引用是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4d08-c089-2897e0346504.html
点击查看题目
现有一个文本文件,想以追加方式打开,下列方式正确的是( )。
if((fp=fopen("fname.dat","____"))==NULL)
{printf("can not open file!\n",num); exit(0);}
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-54d8-c089-2897e0346510.html
点击查看题目
有以下程序
#include "stdio.h"
void main()
{ int x=0x02ff,y=0x0ff00;
printf("%d\n",(x&y)>>4|0x005f);
}
执行后的输出结果是( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6c48-c089-2897e034650e.html
点击查看题目
下列程序段执行后,s的值是( )
static char ch[]="600";
int a,s=0;
for(a=0;ch[a]>='0'&&ch[a]<='9';a++)
s=10*s+ch[a]-'0';
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e034650b.html
点击查看题目
有定义语句:char s[10];,若要从终端给s输入5个字符,错误的输入语句是( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-54d8-c089-2897e0346508.html
点击查看题目
有以下程序
#include
void fun(char *s)
{ while(*s)
{ if (*s%2==0) printf("%c",*s);
s++;
}
}
void main()
{
char a[]={"good"};
fun(a);
printf("\n");
}
执行后的输出结果是( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6c48-c089-2897e0346503.html
点击查看题目
有以下程序
#include
struct tt
{int x;struct tt *y;} *p;
struct tt a[4]={20,a+1,15,a+2,30,a+3,17,a};
void main()
{
int i;
p=a;
for(i=1;i<=2;i++)
{printf("%d,",p->x); p=p->y;}
}
执行后的输出结果是( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6c48-c089-2897e0346502.html
点击查看题目
执行下列程序后,i的值是()。
int i,x;
for(i=1,x=1;i<20; i++)
{if (x>=10) break;
if(x%2= =1)
{x+=5; continue; }
x-=3;
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-54d8-c089-2897e0346521.html
点击查看题目
首页
>
IT互联网
>
信息技术知识竞赛c语言
题目内容
(
单选题
)
手机预览
试题通
信息技术知识竞赛c语言

有以下程序段
struct st
{int x;int *y;}*pt;
int a[]={1,2},b[]={3,4};
struct st c[2]={10,a,20,b};
pt=c;
以下选项中表达式的值为11的是()。

A、*pt->y

B、pt->x

C、++pt->x

D、(pt++)->x

答案:C

试题通
试题通
信息技术知识竞赛c语言
相关题目
要求通过while循环不断读入字符,当读入字母N时结束循环。若变量已正确定义,以下正确的程序段是()。

A. while((ch=getchar())!="N")printf("%c",ch);

B. while(ch=getchar()!="N")printf("%c",ch);

C. while(ch=getchar()=="N")printf("%c",ch);

D. while((ch=getchar())=="N")printf("%c",ch);

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4d08-c089-2897e0346526.html
点击查看答案
有以下程序(注:字符a的ASCII码值为97)
#include
main()
{char *s={“abc”};
do
{printf(“%d”,*s%10);++s;}
while(*s);
}
程序运行后的输出结果是()。

A. abc

B. 789

C. 7890

D. 979899

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e034650d.html
点击查看答案
若有说明:int a[10];则对a 数组元素的正确引用是()。

A. a[10]

B. a[3.5]

C. a(5)

D. a[10-10]

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4d08-c089-2897e0346504.html
点击查看答案
现有一个文本文件,想以追加方式打开,下列方式正确的是( )。
if((fp=fopen("fname.dat","____"))==NULL)
{printf("can not open file!\n",num); exit(0);}

A. w

B. ab

C. b

D. a

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-54d8-c089-2897e0346510.html
点击查看答案
有以下程序
#include "stdio.h"
void main()
{ int x=0x02ff,y=0x0ff00;
printf("%d\n",(x&y)>>4|0x005f);
}
执行后的输出结果是( )。

A. 127

B. 255

C. 128

D. 1

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6c48-c089-2897e034650e.html
点击查看答案
下列程序段执行后,s的值是( )
static char ch[]="600";
int a,s=0;
for(a=0;ch[a]>='0'&&ch[a]<='9';a++)
s=10*s+ch[a]-'0';

A. 600

B. 6

C. 0

D. 出错

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e034650b.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
点击查看答案
有以下程序
#include
void fun(char *s)
{ while(*s)
{ if (*s%2==0) printf("%c",*s);
s++;
}
}
void main()
{
char a[]={"good"};
fun(a);
printf("\n");
}
执行后的输出结果是( )。

A. a

B. b

C. c

D. d

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6c48-c089-2897e0346503.html
点击查看答案
有以下程序
#include
struct tt
{int x;struct tt *y;} *p;
struct tt a[4]={20,a+1,15,a+2,30,a+3,17,a};
void main()
{
int i;
p=a;
for(i=1;i<=2;i++)
{printf("%d,",p->x); p=p->y;}
}
执行后的输出结果是( )。

A. 20,15,

B. 20,14,

C. 28,13,

D. 15,20,

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6c48-c089-2897e0346502.html
点击查看答案
执行下列程序后,i的值是()。
int i,x;
for(i=1,x=1;i<20; i++)
{if (x>=10) break;
if(x%2= =1)
{x+=5; continue; }
x-=3;

A. 4

B. 5

C. 6

D. 7

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-54d8-c089-2897e0346521.html
点击查看答案
试题通小程序
试题通app下载