首页 > 计算机类考试> 计算机等级考试
题目内容 (请给出正确答案)
[单选题]

有以下程序: Class Date { public: Date(int y,int m,mt d); { year=y; month=m; day=d; } Date(int y=2000) { year=y; month=10; day=1; } Date(Date &D) { year=d.year; month=d.month; day=d.day; } Void prin

A.2

B.3

C.4

D.5

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“有以下程序:Class Date{public:Date(i…”相关的问题
第1题
有以下类定义 clas sMyClass { public: My Class() { cout<<1;} }; 则执行

有以下类定义 clas sMyClass { public: My Class() { cout<<1;} }; 则执行语句MyClassa,b[2],*p[2];后,程序的输出结果是

A.11

B.111

C.1111

D.11111

点击查看答案
第2题
有以下程序:#include<iostream>using namespace std;#definePl 3.14Class Point{private:int x,y

有以下程序: #include<iostream> using namespace std; #definePl 3.14 Class Point {private: int x,y; public: Point(int a,intB) {X=a; y:b;} int getx() <return x;} int gety() {return y;}}; class Circle:public Point {pri

A.314

B.157

C.78.5

D.153.86

点击查看答案
第3题
有以下程序#include<iostream> using namespace std;class Complex{public: Complex(double r=O,

有以下程序 #include<iostream> using namespace std; class Complex { public: Complex(double r=O,double i=0):re(r),im(i){} double real() const {return re;} double imag()const {return im;} Complex operator +(Complex C) const {return Complex (re+c.re,im+c.im);} private: double re,im; }; int main() { Complex a=Complex(1,1)+Complex (5); cout<<a.real()<<'+'<<a.imag()<<'i'<<endl; retum 0; } 程序执行后的输出结果是

A.6+6i

B.6+1i

C.1+6i

D.1+1i

点击查看答案
第4题
有以下程序:#include<iostream>using namespace std;class MyClass{public: MyClass(); ~MyClass

有以下程序: #include<iostream> using namespace std; class MyClass { public: MyClass(); ~MyClass(); void SetValue(int val); private: static int i; }; int MyClass::i=0; MyClass::MyClass() { i++; cout<<i; } MyClass::~MyClass() { i--; cout<<i; } void MyClass::SetValue(int val) { i=val; } int main() { MyClass*my[2]; int k; for(k=0;k<2;k++) my[k]=new MyClass; for(k=0;k<2;k++) delete my[k]; return 0; } 运行后的输出结果是()。

A.1210

B.1100

C.1234

D.输出结果不确定

点击查看答案
第5题
有以下程序: public class ConstOver { public ConstOver (int x, int y, int z) { } } 下面

A.protected int ConstOver (){ }

B.private ConstOver (int z, int y, byte x) { }

C.public object ConstOver (int x, int y, int z) { }

D.public void ConstOver (byte x, byte y, byte z) { }

点击查看答案
第6题
以下Java程序的运行结果是()。public class Increment{public static void main(String args[]

A. 222

B. 233

C. 223

D. 345

点击查看答案
第7题
以下程序中,错误的行为①#include < iostream.h >②class A③{④public:⑤int n=2;⑥A(int val){cout <

以下程序中,错误的行为 ①#include < iostream.h > ②class A ③{ ④ public: ⑤ int n=2; ⑥ A(int val){cout << val<<end1;} ⑦ ~A(0{}; ⑧}; ⑨void main(0 ⑩{ (11) Aa(0); (12)

A.⑤

B.⑥

C.⑦

D.(11)

点击查看答案
第8题
给出以下代码,该程序的运行结果是()class Example {public static void main (String args[])

A.-1

B.Exception

C.1

D.0

点击查看答案
第9题
以下程序中,错误的行为① #include<iostream.h>② class A③ {④ public:⑤ int n=2;⑥ A(int val) {cout < < val < < endl;}⑦ ~A() {};⑧ };⑨ void main()⑩ {(11) A a (0) ;(12) }

A.⑤

B.⑥

C.⑦

D.⑩

点击查看答案
第10题
下面的程序输出结果是: ()。public class A extends B {undefinedint k = 20;public static voi

A.i=20

B.程序有编译错误

C.i=10

D.i=true

点击查看答案
第11题
有如下程序: #include<iostream> using namespace std; class A { public:
A(){cout<<"A";} }; class B<public:B(){cout<<"B";)); class C:public A { B b; public: C(){cout<<"C";} }; int main(){Cobj;retum 0;} 执行后的输出结果是

A.CBA

B.BAC

C.ACB

D.ABC

点击查看答案
退出 登录/注册
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改