试题通
试题通
APP下载
首页
>
IT互联网
>
信息技术知识竞赛c语言
试题通
搜索
信息技术知识竞赛c语言
题目内容
(
单选题
)
在嵌套使用if语句时,C语言规定else总是()。

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

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

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

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

答案:C

试题通
信息技术知识竞赛c语言
试题通
有以下程序
#include
int fun()
{static int x=1;
x*=2; return x;
}
void main()
{int i,s=1;
for (i=1;i<=2;i++) s=fun();
printf("%d\n",s);
}
执行后的输出结果是( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e0346514.html
点击查看题目
#include "stdio.h"
int digits(int n)
{
int c=0;
do {
c++;
n/=10;
}while(n);
return c;
}
void main( )
{
printf("%d",digits(824));
}
程序运行结果是 ( ) 。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e0346507.html
点击查看题目
若给出以下定义:
char x[ ]="abcdefg";
char y[ ]={'a','b','c','d','e','f','g'};
则正确的叙述为( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e034651d.html
点击查看题目
有以下程序
#include "stdio.h"
void main()
{ int c;
while((c=getchar())!='\n')
switch(c -'2')
{ case 0:
case 1: putchar(c+4);
case 2: putchar(c+4);break;
case 3: putchar(c+3);
default: putchar(c+2);break;
}
printf("\n");
}
通过键盘输入446755,执行后的输出结果是( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6c48-c089-2897e0346508.html
点击查看题目
有以下程序
  #include
  main()
  { int x=011;
  printf("%d\n",++x);
  }
  程序运行后的输出结果是( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6090-c089-2897e034651a.html
点击查看题目
下列程序的输出结果是()。
int b=2;
int func(int *a)
{ b += *a; return(b);}
main()
{ int a=2, res=2;
res += func(&a);
printf("%d \n",res);
}
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6090-c089-2897e0346507.html
点击查看题目
有以下程序
void ss(char *s,char t)
{ while(*s)
{ if(*s==t)*s=t-′a′+′A′;
s++; } }
main()
{ char str1[100]="abcddfefdbd",c=′d′;
ss(str1,c); printf("%s\n",str1);}
程序运行后的输出结果是( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e0346522.html
点击查看题目
下面的程序执行后,文件test中的内容是 ()。
void fun(char *fname,char *st)
{ FILE *myf; int i;
myf=fopen(fname,"w" );
for(i=0;st[i];i++)
fputc(st[i],myf);
fputc('\0',myf);
fclose(myf);
}
main()
{ fun("test","new world"); fun("test","hello,");}
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-58c0-c089-2897e034650e.html
点击查看题目
有以下程序
int add(int a,int b){return+b};}
main()
{int k,(*f)(),a=5,b=10;
f=add;
... }则以下函数调用语句错误的是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e0346504.html
点击查看题目
下程序运行后的输出结果是() 。
  #include
  main()
  { int a;
  a=(int)((double)(3/2)+0.5+(int)1.99*2);
  printf("%d\n",a);
  }
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e0346505.html
点击查看题目
首页
>
IT互联网
>
信息技术知识竞赛c语言
题目内容
(
单选题
)
手机预览
试题通
信息技术知识竞赛c语言

在嵌套使用if语句时,C语言规定else总是()。

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

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

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

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

答案:C

试题通
试题通
信息技术知识竞赛c语言
相关题目
有以下程序
#include
int fun()
{static int x=1;
x*=2; return x;
}
void main()
{int i,s=1;
for (i=1;i<=2;i++) s=fun();
printf("%d\n",s);
}
执行后的输出结果是( )。

A. 1

B. 2

C. 3

D. 4

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e0346514.html
点击查看答案
#include "stdio.h"
int digits(int n)
{
int c=0;
do {
c++;
n/=10;
}while(n);
return c;
}
void main( )
{
printf("%d",digits(824));
}
程序运行结果是 ( ) 。

A. 8

B. 3

C. 4

D. 5

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e0346507.html
点击查看答案
若给出以下定义:
char x[ ]="abcdefg";
char y[ ]={'a','b','c','d','e','f','g'};
则正确的叙述为( )。

A. 数组x和数组y等价

B. 数组x和数组y的长度相同

C. 数组x的长度大于数组y的长度

D. 数组x的长度小于数组y的长度

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e034651d.html
点击查看答案
有以下程序
#include "stdio.h"
void main()
{ int c;
while((c=getchar())!='\n')
switch(c -'2')
{ case 0:
case 1: putchar(c+4);
case 2: putchar(c+4);break;
case 3: putchar(c+3);
default: putchar(c+2);break;
}
printf("\n");
}
通过键盘输入446755,执行后的输出结果是( )。

A. 888988

B. 668966

C. 88898787

D. 66898787

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6c48-c089-2897e0346508.html
点击查看答案
有以下程序
  #include
  main()
  { int x=011;
  printf("%d\n",++x);
  }
  程序运行后的输出结果是( )。

A. 12

B. 11

C. 10

D. 9

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6090-c089-2897e034651a.html
点击查看答案
下列程序的输出结果是()。
int b=2;
int func(int *a)
{ b += *a; return(b);}
main()
{ int a=2, res=2;
res += func(&a);
printf("%d \n",res);
}

A. 4

B. 6

C. 8

D. 10

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6090-c089-2897e0346507.html
点击查看答案
有以下程序
void ss(char *s,char t)
{ while(*s)
{ if(*s==t)*s=t-′a′+′A′;
s++; } }
main()
{ char str1[100]="abcddfefdbd",c=′d′;
ss(str1,c); printf("%s\n",str1);}
程序运行后的输出结果是( )。

A. ABCDDEFEDBD

B. abcDDfefDbD

C. abcAAfefAbA

D. Abcddfefdbd

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e0346522.html
点击查看答案
下面的程序执行后,文件test中的内容是 ()。
void fun(char *fname,char *st)
{ FILE *myf; int i;
myf=fopen(fname,"w" );
for(i=0;st[i];i++)
fputc(st[i],myf);
fputc('\0',myf);
fclose(myf);
}
main()
{ fun("test","new world"); fun("test","hello,");}

A. hello,

B. new worldhello,

C. new world

D. hello, rld

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-58c0-c089-2897e034650e.html
点击查看答案
有以下程序
int add(int a,int b){return+b};}
main()
{int k,(*f)(),a=5,b=10;
f=add;
... }则以下函数调用语句错误的是()。

A. k=(*f)(a,b);

B. k=add(a,b);

C. k=*f(a,b);

D. k=f(a,b);

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e0346504.html
点击查看答案
下程序运行后的输出结果是() 。
  #include
  main()
  { int a;
  a=(int)((double)(3/2)+0.5+(int)1.99*2);
  printf("%d\n",a);
  }

A. 3

B. 2

C. 0

D. 1

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