Dotcpp   >   练题 - 第208页

全部知识点

第4141题

有以下程序:

#include <stdio.h>
main()
{
 int x;
 scanf("%d",&x);
 if(x<=3);
 else if(x!=10)
 printf("%d\n",x);
}

程序运行时,输入的值在( )范围才会有输出结果。

第4142题

若有以下程序

#include <stdio.h>
main()
{
 int a=1,b=2,c=3,d=4;
 if((a==2)||(b==1))c=2;
 if((c==3)&&(d==-1))a=5;
 printf("%d,%d,%d.%d\n",a,b,c,d);
}

则程序的输出结果是( )。

第4143题

有以下程序

#include <stdio.h>
main()
{
 int a=0,b=0,c=0,d=0;
 if(a=1)b=1;c=2;
 else d=3;
 printf("%d,%d,%d,%d\n",a,b,c,d);
}

程序输出( )。 

第4144题

有如下程序

:#include <stdio.h>
main()
{
 int x=0x13;
 if(x=0x18)printf("T");
 printf("F");
 printf("\n");
}

程序运行后的输出结果是( )。 

第4145题

有以下计算公式:

第37题

 若程序前面已在命令行中包含math.h文件,不能够计算上述公式的程 序段是( )。 

第4146题

如有表达式(w)?(-x):(++y),则其中与w等价的表达式是 ( )。

第4147题

若有定义:int x,y;并已正确给变量赋值,则以下选项中与表达式(x-y)?(x++):(y++)中的条件表达式(x-y)等价的是( )。 

第4148题

有如下嵌套的if语句:

if(a<b) if(a<c)k="a;" else="" k="c;" if(b<c)k="b;"

以下选项中与上述if语句等价的语句是( )。

第4149题

以下程序段中,与语句:k=a>b?(b>c?1:0):0;功能相同的是( )。

第4150题

有语句:k=x

第4151题

若有定义:

int a=0,b=0,c=0,d=0;

有C语言表达式 (a++ && b++)? c++ : d++,以下关于其执行顺序的叙述 正确是( )。

第4152题

若有定义:

int a=0,b=0,c=0,d=0;

以下关于C语言表达式:(++aǁ++b)? ++c:++d执行顺序的叙述正确的是 ( )。

第4153题

有以下程序:

#include <stdio.h>
main()
{
 char a='H';
 a=(a>='A'&&a<='z')?(a-'A'+'a'):a;
 printf("%c\n",a);
}

程序运行后的输出结果是( )。

第4154题

有以下程序

#include <stdio.h>
main()
{
 int x;
 for(x=3;x<6;x++)
 printf((x%2)?("*%d"):("#%d"),x);
 printf("\n");
}

程序的输出结果是( )。 

第4155题

有以下程序:

#include <stdio.h>
int m1(int x,int y)
{
 return x<=y?x:y;
}
int m2(int x,int y)
{
 return x<=y?y:x;
}
int fun(int a,int b){
 return a+b;
}
main()
{
 int x=2,y=3,z=1;
 printf("%d\n",fun(m1(x,y),m2(y,z)));
}

程序的运行结果是( )。 

第4156题

有以下程序:

#include <stdio.h>
main()
{
 int a=0,b=0,c=0,d=0;
 (++a||++b)?++c:++d;
 printf("%d,%d,%d,%d\n",a,b,c,d);}

程序的运行结果是( )。 

第4157题

下列叙述中正确的是( )。

第4158题

若有定义:

float x=1.5;
int a=1,b=3,c=2;

则正确的switch语句是( )。

第4159题

若有定义语句int a,b;double x;则下列选项中没有错误的是( )。

第4160题

有以下程序:

#include <stdio.h>
main()
{
 int k,n=0;char c,str[]="teach";
 for(k=0;str[k];k++)
 {
 c=str[k];
 switch(k)
 {
 case 1: case 3: case 5: putchar(c); printf("%d",++n); break;
 default:putchar('N');
 }
 }
}

程序的运行结果是( )。