题目内容 (请给出正确答案)
[主观题]

下面程序的输出结果是()。 #include<iostream> Usingnamespacestd; ClassBase{ public:

Base(intx=O){count<<x; } }; ClassDerived:publicBase{ public:Derved(intx=0{count<<x; } private; Baseval; }; intmina(){ Derivedd(1); retrun0; }

A.0

B.1

C.01

D.001

提问人:网友fql00zty 发布时间:2022-01-07
参考答案
查看官方参考答案
如搜索结果不匹配,请 联系老师 获取答案
更多“下面程序的输出结果是()。 #include<iostrea…”相关的问题
第1题
下列程序存的运行结果 ______。 #include <stdio.h> int main( ) { int i,x[5]={1,2,3,4,5}; for (i=0;i<5;i++) printf("%4d",x[i]); return 0; }> A、□□□1□□□2□□□3□□□4

B、1□□□2□□□3□□□4□□□

C、□□□1 □□□2 □□□3 □□□4

D、1□□□ 2□□□ 3□□□ 4□□□

点击查看答案
第2题

下列程序的输出结果为 class Box{ int length,width,height; public void setInfo(int l,int w,int h){ length = l; width = w; height = h; } public int volumn(){ return length*width*height; } public int area(){ return (length*width + length*height + width*height) * 2; } public String toString(){ return "Length:" + length + " width:" + width + " height:" + height + " volumn: " + volumn() + " area:" + area(); } } public class BoxTest { public static void main(String[] args) { Box b = new Box(); b.setInfo(5,2,4); System.out.println(b.toString()); } }

点击查看答案
第3题
类型class为引用类型,执行下列代码:class test { private string _text; public string text { set { this._text = value; } } } class Application { public static void Main() { test a = new test(); a.text = "original value"; b(a); } public static void b(test c) { c.text = "changed"; } } 执行完毕后,a.text的值仍然为"original value"。
点击查看答案
第4题
下列程序的执行结果是_______。 str="HelloWorld" print(str[5:]) print(str[-5:])

A、World Hello

B、oWorld HelloW

C、World World

D、oWorld Hello

点击查看答案
第5题
下列程序运行的结果是 _____。 public class function { public static void main(String[] args) { System.out.println(fun(3)); } static int fun(int n) { if(n>2) { return (fun(n-1)+fun(n-2)); }else { return 2; } } }
点击查看答案
第6题
下列程序的运行结果是( )。 Public class sun { Public static void main(String args[]) { int x=4,y=0; if(Math.pow(X,2)= =16) y—x ; if(Math.pow(X,2)<15) y—l/x; if(Math.pow(X,2)>15) y=(int)Math.pow(X,2)+1; system.out.println(y); } }

A.4

B.17

C.18

D.0.25

点击查看答案
第7题
下列程序的执行,说法正确的是( )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); //19行 } } }

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

B、程序第10行出错

C、程序将输出“b=42”

D、程序将输出第19行的异常信息

点击查看答案
第8题
下面程序的运行结果是? public static void main(String[] args) { int x = 8; int y = 4; if(x++>8 && ++y<4){ system.out.print(x); }else{ system.out.print(y); } system.out.printf("%d%d",x,y);> A、995

B、985

C、494

D、495

点击查看答案
第9题
指出下列程序中的错误,并简洁说明错误原因 class BC { public: void BC() { } };
点击查看答案
第10题
【单选题】若有以下程序:的运行结果: class Array{ public static void main(){ int []a={1,2,4,3}; try{ for(int i=0;i<a.lenth;i++){ int a1="a[i]/a[i+1];}" }catch(airthmeticexception e){system.out.println(“airthmeticexception”);} catch(indexouterofboundsexception ){ system.out.println(“indexouterofboundsexception”);} }} 则程序运行结果为(> A、AirthmeticException

B、IndexOuterOfBoundsException

C、无显示

D、编译错误

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

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

简答题官方微信公众号

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

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

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