题目内容 (请给出正确答案)
[单选题]

如下代码片段的输出是什么? int x = 0; int i = 4; for (i = 0; 10 > i; i++ ) { i++; x++; } printf ("x: %d\ni: %d\n", x, i);

A.x: 5 i: 10

B.x: 5 i: 10

C.x: 4 i: 9

D.x: 4 i: 9

提问人:网友xi2008wang 发布时间:2022-01-07
参考答案
查看官方参考答案
如搜索结果不匹配,请 联系老师 获取答案
网友答案
查看全部
  • · 有4位网友选择 C,占比50%
  • · 有2位网友选择 A,占比25%
  • · 有2位网友选择 B,占比25%
匿名网友 选择了C
[235.***.***.90] 1天前
匿名网友 选择了A
[215.***.***.205] 1天前
匿名网友 选择了B
[196.***.***.63] 1天前
匿名网友 选择了C
[235.***.***.90] 1天前
匿名网友 选择了C
[48.***.***.152] 1天前
匿名网友 选择了C
[155.***.***.246] 1天前
匿名网友 选择了A
[215.***.***.205] 1天前
匿名网友 选择了B
[196.***.***.231] 1天前
匿名网友 选择了C
[32.***.***.66] 1天前
匿名网友 选择了A
[103.***.***.50] 1天前
匿名网友 选择了B
[196.***.***.63] 1天前
匿名网友 选择了C
[155.***.***.246] 1天前
匿名网友 选择了C
[48.***.***.152] 1天前
匿名网友 选择了C
[155.***.***.246] 1天前
匿名网友 选择了A
[215.***.***.205] 1天前
匿名网友 选择了B
[196.***.***.231] 1天前
匿名网友 选择了C
[32.***.***.66] 1天前
匿名网友 选择了A
[103.***.***.50] 1天前
匿名网友 选择了B
[196.***.***.63] 1天前
匿名网友 选择了C
[235.***.***.90] 1天前
加载更多
提交我的答案
登录提交答案,可赢取奖励机会。
更多“如下代码片段的输出是什么? int x = 0; int i…”相关的问题
第1题
以下程序对输入的两个整数,按从大到小顺序输出。请在______填入正确内容。 main() { int x,y,z; scanf("%d,%d",&x,&y); if(_________) { z=x; _____; ______; } printf("%d,%d",x,y); }

A、第5行:x <y 第8行:x="y;" 第9行:y="z;&lt;br/"> B、第5行:x>y 第8行:x=y; 第9行:y=z;

C、第5行:x <y 第8行: y="z;" 第9行:x="y;&lt;br/"> D、第5行:x>y 第8行: y=z; 第9行:x=y;

点击查看答案
第2题

阅读以下代码,回答问题:1至问题3 ,将解答填入答题纸的对应栏内。 【代码1】 include void swap(int x, int y) { int tmp =x; x= y; y= tmp; } int maim() { int a= 3, b= 7; printf("a1= %d b1=%d\n",a,b); Swap(a, b); Printf("a2 = %d b2=%d\n”,a,b); return 0; } 【代码2】 include define SPACE " //空格字符 Int main() { char str[128] =" Nothing is impossible! "; int i,num =0,wordMark=0; for(i=0;str[i];i++) If(str[i]==SPACE) WordMark=0; else If(wordMark=0){ wordMark=1; num++; } Printf(“%d/n”,num) return 0; } 【代码3】 include define SPACE " //空格字符 int countStrs(char *); int main() { char str[128] = " Nothing is impossible! "; Printf("%d/n",(1)(str)) return 0; } int countStrs(char *p) { int num=0, wordMark= 0; for(;(2); p++) { If((3)==SPACE) wordMark= 0; else if(!wordMark ) { wordMark = 1; ++num } } return (4) ; }

【问题1】(4分) 写出代码1运行后的输出结果。 【问题2】(3分) 写出代码2运行后的输出结果。 【问题3】(8分) 代码3的功能与代码2完全相同,请补充3中的空缺,将解答写入答题纸的对应栏内。

点击查看答案
第3题
分数类(名词解释题)

分数类

点击查看答案
第4题
阅读下列函数说明和C代码,将应填入(n)处的字句写在对应栏内。

【说明2.1】

以下C语言函数用二分插入法实现对整型数组a中n个数的排序功能。

【函数2.1】

void fun1 (int a[])

{ int i,j,k,r,x,m;

for(i=2;i<=n;i++)

{ (1);

k=1;r=i-1;

while(k<=r)

{ m=(k+r)/2;

if(x<a[m])r=m-1;

else (2);

}

for(j=i-1;j>=k;j--)

a[j+l]=a[j];

(3);

}

}

【说明2.2】

以下程序可以把从键盘上输入的十进制数(long型)以二~十六进制形式输出。

【程序2.2】

include<stdio.h>

main()

{ charb[16]={'0','l','2','3 ,4,'5','6','7','8','9','A','B','C','D','E','F'};

int c[64],d,i=0,base;

long n;

printf("enter a number:\n");

scanf("%1d",&n);

printf("enter new basc:\n");

scanf("%d", &base);

do

{ c[i]=(4);

i++; n=n/base;

} while(n!=0);

printf("transmite new base:\n");

for(--i;i>=0;--i)

{ d=c[i];

printf("%c",(5));

}

}

点击查看答案
第5题
●试题二

阅读下列函数说明和C代码,将应填入(n)处的字句写在答题纸的对应栏内。

【说明2.1】

以下C语言函数用二分插入法实现对整型数组a中n个数的排序功能。

【函数2.1】

void fun1(int a[])

{int i,j,k,r,x,m;

for(i=2;i<=n;i++)

{ (1) ;

k=1;r=i-1;

while(k<=r)

{m=(k+r)/2;

if(x

else (2) ;

}

for(j=i-1;j>=k;j--)

a[j+1]=a[j];

(3) ;

}

}

【说明2.2】

以下程序可以把从键盘上输入的十进制数(1ong型)以二~十六进制形式输出。

【程序2.2】

#include

main()

{char b[16]={′0′,′1′,′2′,′3′,′4′,′5′,′6′,′7′,′8′,′9′,′A′,′B′,′C′,′D′,′E′,′F′};

int c[64],d,i=0,base;

long n;

printf(″enter a number:′n″);

scanf(″%1d″,&n);

printf(″enter new basc:kn″);

scanf(″%d″,&base);

do

{c[i]= (4) ;

i++;n=n/base;

}while(n!=0);

printf("transmite new base:\n");

for(--i;i>=0;--i)

{ d=c[i];

printf("%c", (5) );

}

}

点击查看答案
第6题
给定java 代码,如下,编译运行后,结果是( )。 public class Test{ static String s; public static void main(String args[]) { char c=s.charAt(0); System.out.println(c); } }

A、编译错误

B、运行期异常,异常类型为NullPointerException

C、运行期异常,异常类型为ArithmeticExceptioin

D、正确运行,但无输出内容

点击查看答案
第7题
下列程序的执行,说法错误的是:( )。 public class MultiCatch { public static void main(String args[]) { try { int a=args.length; int b=42/a; int c[]={1}; c[42]=99; //第10行 System.out.println(“b=”+b); } catch(ArithmeticException e) { System.out.println(“除0异常:”+e); //第15行 } catch(ArrayIndexOutOfBoundsException e) { System.out.println(“数组超越边界异常:”+e); //第18行 } } }

A、程序将输出第15行的异常信息

B、程序第10行出错

C、程序将输出 b=42

D、程序将输出第15和18行的异常信息

点击查看答案
第8题
运行以下代码: public class RTExcept{ public static void throwit ( ){ System.out.print(“throwit ”); throw new RuntimeException( ); } public static void main(String[] args){ try{ System.out.print(“hello ”); throwit( ); }catch (Exception re ){ System.out.print(“caught ”); } finally{ System.out.print(“finally ”); } System.out.println(“after ”); } } 运行结果是( )。

A、hello throwit caught

B、hello throwit caught finally after

C、hello throwit RuntimeException

D、hello throwit RuntimeException caught after

点击查看答案
第9题
以下程序运行结果是 public class HasStatic { private static int x=100; public static void main(String args[ ]){ HasStatic hs1=new HasStatic( ); hs1.x++; HasStatic hs2=new HasStatic( ); hs2.x++; hs1=new HasStatic( ); hs1.x++; HasStatic.x--; System.out.println("x="+x); } }

A、x=103

B、x=102

C、x=101

D、编译错误

点击查看答案
第10题
如下代码片段的输出是什么? int i, j; for (i = 0; i <= 0 3 3; i++) { for (j="0;" j j++) if (i="=" || i="=" 5) printf ("*"); else (" "); ("\n");> A、****** * * * * ******

B、****** ******

C、****** ****** ****** ******

D、****** * * * * * * ******

点击查看答案
账号:
你好,尊敬的用户
复制账号
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
欢迎分享答案

为鼓励登录用户提交答案,简答题每个月将会抽取一批参与作答的用户给予奖励,具体奖励活动请关注官方微信公众号:简答题

简答题官方微信公众号

警告:系统检测到您的账号存在安全风险

为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!

微信搜一搜
简答题
点击打开微信
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反简答题购买须知被冻结。您可在“简答题”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
微信搜一搜
简答题
点击打开微信