APP下载
首页
>
IT互联网
>
信息技术知识竞赛c语言
搜索
信息技术知识竞赛c语言
题目内容
(
单选题
)
对下面程序段:
#define A 3
#define B(a) ((A+1)*a)
...
x=3*(A+B(7));正确的判断是()。

A、程序错误,不许嵌套宏定义

B、程序错误,宏定义不许有参数

C、x=93

D、x=21

答案:C

信息技术知识竞赛c语言
有以下程序
void fun2(char a, char b){printf(“%c%c”,a,b);}
char a= 'A',b= 'B';
void fun1( ){ a= 'C'; b= 'D'; }
main( )
{ fun1( ) ;
printf( “%c%c”,a,b);fun2('E', 'F'); }
程序的运行结果是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e0346505.html
点击查看题目
若有以下程序片段:
char str[ ]="ab\n\012\\\"";
printf("%d",strlen(str));
上面程序片段的输出结果是 ( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e0346520.html
点击查看题目
以下函数的类型是 ()。
fff(float x)
{ printf (“%d\n”,x*x);}
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4d08-c089-2897e0346507.html
点击查看题目
有以下程序
#include
#define M 5
#define N M+M
void main()
{ int k;
k=N*N*5; printf("%d\n",k);
}
执行后的输出结果是( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6c48-c089-2897e0346501.html
点击查看题目
设有如下函数定义:
int f(char *s)
{ char *p=s;
while(*p!='\0') p++;
return(p-s); }
如果在主程序中用下面的语句调用上述函数,则输出结果为()。
printf("%d\n",f("goodbey!"));
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6090-c089-2897e034650e.html
点击查看题目
有以下程序
#include
main()
{char ch[3][5]={“AAAA”,”BBB”,”CC”};
printf(“%s\n”,ch[1]);
}
程序运行后的输出结果是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e0346513.html
点击查看题目
有以下程序段
  char name[20];
  int num;
  scanf("name=%s num=%d",name,&num);
  当执行上述程序段,并从键盘输入:name=Lili num=1001<回车>后,name的值为( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e0346525.html
点击查看题目
阅读下面的程序,运行结果是()。
main()
{
char *str="ABCabcd";
bubble(str,5);
printf("\n%s",str);
}

bubble(str,count)
char *str;
int count;
{
int i,j=count;
char tmp;
while(j-->1)
for(i=0;i if(str[i] {
tmp=str[i];
str[i]=str[i+1];
str[i+1]=tmp;
}
}
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e0346517.html
点击查看题目
在嵌套使用if语句时,C语言规定else总是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e0346508.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]);
}
执行后的输出结果是( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e0346518.html
点击查看题目
首页
>
IT互联网
>
信息技术知识竞赛c语言
题目内容
(
单选题
)
手机预览
信息技术知识竞赛c语言

对下面程序段:
#define A 3
#define B(a) ((A+1)*a)
...
x=3*(A+B(7));正确的判断是()。

A、程序错误,不许嵌套宏定义

B、程序错误,宏定义不许有参数

C、x=93

D、x=21

答案:C

信息技术知识竞赛c语言
相关题目
有以下程序
void fun2(char a, char b){printf(“%c%c”,a,b);}
char a= 'A',b= 'B';
void fun1( ){ a= 'C'; b= 'D'; }
main( )
{ fun1( ) ;
printf( “%c%c”,a,b);fun2('E', 'F'); }
程序的运行结果是()。

A. CDEF

B. ABEF

C. ABCD

D. CDAB

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e0346505.html
点击查看答案
若有以下程序片段:
char str[ ]="ab\n\012\\\"";
printf("%d",strlen(str));
上面程序片段的输出结果是 ( )。

A. 3

B. 4

C. 6

D. 12

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e0346520.html
点击查看答案
以下函数的类型是 ()。
fff(float x)
{ printf (“%d\n”,x*x);}

A. 与参数X的类型相同

B. void型

C. int型

D. 无法确定

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4d08-c089-2897e0346507.html
点击查看答案
有以下程序
#include
#define M 5
#define N M+M
void main()
{ int k;
k=N*N*5; printf("%d\n",k);
}
执行后的输出结果是( )。

A. 50

B. 55

C. 500

D. 550

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6c48-c089-2897e0346501.html
点击查看答案
设有如下函数定义:
int f(char *s)
{ char *p=s;
while(*p!='\0') p++;
return(p-s); }
如果在主程序中用下面的语句调用上述函数,则输出结果为()。
printf("%d\n",f("goodbey!"));

A. 3

B. 6

C. 8

D. 0

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6090-c089-2897e034650e.html
点击查看答案
有以下程序
#include
main()
{char ch[3][5]={“AAAA”,”BBB”,”CC”};
printf(“%s\n”,ch[1]);
}
程序运行后的输出结果是()。

A. AAAA

B. CC

C. BBBCC

D. BBB

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e0346513.html
点击查看答案
有以下程序段
  char name[20];
  int num;
  scanf("name=%s num=%d",name,&num);
  当执行上述程序段,并从键盘输入:name=Lili num=1001<回车>后,name的值为( )。

A. Lili

B. name=Lili

C. Lili num=

D. name=Lili num=1001

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e0346525.html
点击查看答案
阅读下面的程序,运行结果是()。
main()
{
char *str="ABCabcd";
bubble(str,5);
printf("\n%s",str);
}

bubble(str,count)
char *str;
int count;
{
int i,j=count;
char tmp;
while(j-->1)
for(i=0;i if(str[i] {
tmp=str[i];
str[i]=str[i+1];
str[i+1]=tmp;
}
}

A. bacdCBA

B. baCBAcd

C. cdbaCBA

D. bCBAacd

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e0346517.html
点击查看答案
在嵌套使用if语句时,C语言规定else总是()。

A. 和之前与其具有相同缩进位置的if配对

B. 和之前与其最近的if配对

C. 和之前与其最近的且不带else的if配对

D. 和之前的第一个if配对

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e0346508.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
点击查看答案
试题通小程序
试题通app下载