String name="Jane Doe";36.int$age=24;37.Double_height=123.5;38.double~temp=37.5;Which two are true?()A.Line 35 will not compile.B.Line 36 will not compile.C.Line 37 will not compile.D.Line 38 will not compile.

题目
String name="Jane Doe";36.int$age=24;37.Double_height=123.5;38.double~temp=37.5;Which two are true?()

A.Line 35 will not compile.

B.Line 36 will not compile.

C.Line 37 will not compile.

D.Line 38 will not compile.


相似考题
更多“String name="Jane Doe";36.int$age=24;37.Double_height=123.5;38.double~temp=37.5;Which two are true?() ”相关问题
  • 第1题:

    阅读以下说明C++代码,将应填入(n)处的字句写在对应栏内。

    [说明]

    本程序实现了雇员信息管理功能,其中封装了雇员信息及其设置、修改、删除操作。已知当输入为“Smith 31 2960.0”时,程序的输出是:

    姓名:Smith 年龄:31 工资:2960

    姓名:Smith 年龄:31 工资:3500

    姓名:Mary 年龄:23 工资:2500

    [C++程序]

    include <iostream.h>

    include <string.h>

    class employee{

    char *name; //雇员姓名

    short age; //年龄

    float salary;//工资

    public:

    employee();

    void set_name(char *);

    void set_age(short a) {age=a;}

    void set_salary(float s) {salary=s;}

    (1);

    ~ employee(){delete[] name;}

    };

    employee::employee() { name="";

    age=0;

    salary=0.0;

    void employee::set_name(char *n)

    { name=new char[strlen(n)+1];

    (2) (name,n);

    }

    void employee::print()

    { cout<<"姓名":"<<name<<" 年龄:"<<agc<<" 工资:" <<salary<<endl;

    }

    void main()

    { char *na;

    short ag=0;

    float sa=0;

    (3);

    na=new char[10];

    cin>>na>>ag>>sa;

    emp.set_name(na);

    emp.set_age(ag);

    emp.set_salary(sa);

    emp.print();

    (4) (3500.0);

    emp.print();

    (5);

    emp.set_name("Mary");

    emp.set_age(23);

    emp.set_salary(2500.0);

    emp.print();

    }


    正确答案:(1) void print() (2) strcpy (3) employee emp (4) emp.set_salary (5)emp.~employee()
    (1) void print() (2) strcpy (3) employee emp (4) emp.set_salary (5)emp.~employee() 解析:程序定义了一个employee类,它包含了一个雇员的档案数据,及对这些数据的若干处理函数:构造函数employee创建一个雇员空档案;set_name(),set_age ()和set_salary()分别用来为雇员档案填入姓名、年龄和工资;print()函数的功能是输出该雇员的档案内容;析构函数~employee()的功能是当某雇员档案撤销或改成另一姓名时,释放原数据占用的空。
    (1)此处应声明print函数;
    (2)此处应调用字符申拷贝函数,以更改name属性的值;
    (3)此处显然应声明emp变量;
    (4)~(5):由程序的输出可知(4)处重新设置了emp变量salary属性的值,(5)处则应调用析构函数.

  • 第2题:

    Person p = new Person(“张三”,23);这条语句会调用下列哪个构造方法给属性进行初始化()

    A.public Person(){}

    B.public Person(String name,int age) { this.name = name; this.age = age; }

    C.public Person(int age,String name) { this.age = age; this.name = name; }

    D.public Person(String name) { this.name = name; }


    答案:B
    解析:创建对象时会找到匹配的构造方法给属性进行初始化,由于Person p = new Person(“张三”,23);这条语句中有两个参数,而且第1个参数是String类型的,第2个参数是int类型的,因此会调用B选项中的构造方法。

  • 第3题:

    字典类型变量 d = {'name':'张三','age':22,'gender':'F'} 则 sorted(d)的值为

    A.['22','F','张三']

    B.['name':'张三','age':22,'gender':'F]

    C.['name','age''gender']

    D.['age', 'gender', 'name']


    ['age', 'gender', 'name']

  • 第4题:

    要在D盘的Temp 目录下建立一个名为NamE.dat 的顺序文件,应使用______语句。

    A.Open "NamE.dat" For Output As #1

    B.Open "NamE.dat" For Input As #1

    C.Open "D:\Temp\NamE.dat" For InputAs #1

    D.Open "D:\Temp\NamE.dat" For Output As #1


    正确答案:D

  • 第5题:

    Given:35.Stringname="JaneDoe";36.int$age=24;37.Double_height=123.5;38.double~temp=37.5;Whichtwostatementsaretrue?()

    A.Line35willnotcompile.

    B.Line36willnotcompile.

    C.Line37willnotcompile.

    D.Line38willnotcompile.


    参考答案:A, D