护理学专业知识

单选题您最近创建了一个名为车辆的可序列化的类。 类如下所示: [Serializable] public class Vehicle { public string VIN; public string Make; private string Model; private int Year; private string Owner; } Certkiller.com 不想要序列化一个车辆对象,出于安全原因时永久保存的所有者字段。 您需要确保实现这一目标。 你应该做什么?()A 适用于所有者字段的 Op

题目
单选题
您最近创建了一个名为车辆的可序列化的类。 类如下所示: [Serializable] public class Vehicle { public string VIN; public string Make; private string Model; private int Year; private string Owner; } Certkiller.com 不想要序列化一个车辆对象,出于安全原因时永久保存的所有者字段。 您需要确保实现这一目标。 你应该做什么?()
A

适用于所有者字段的 OptionalField 属性。

B

应用,所以所有者字段的属性。

C

已实现 IFormatter 接口的自定义序列化的车辆类别。

D

做什么,因为在使用二进制序列化时,私营领域是永远不会保留。

参考答案和解析
正确答案: D
解析: 暂无解析
如果没有搜索结果,请直接 联系老师 获取答案。
相似问题和答案

第1题:

您最近创建了一个名为车辆的可序列化的类。类如下所示:[Serializable]public class Vehicle {public string VIN;public string Make;private string Model;private int Year;private string Owner;}Certkiller.com 不想要序列化一个车辆对象,出于安全原因时永久保存的所有者字段。您需要确保实现这一目标。你应该做什么?()

A.适用于所有者字段的 OptionalField 属性。

B.应用,所以所有者字段的属性。

C.已实现 IFormatter 接口的自定义序列化的车辆类别。

D.做什么,因为在使用二进制序列化时,私营领域是永远不会保留。


参考答案:B

第2题:

您正在测试一个组件,该组件对Meeting 类实例进行序列化处理,以使它们能够保存到文件系统。Meeting具有如下定义:public class Meeting {private string title;public int roomNumber;public string[] invitees;public Interview(){}public Interview (string t){title = t;} }组件包含一个带有以下代码段的过程Meeting myMeeting = new Meeting("Objectives");myMeeting.roomNumber=20;string[] attendees = new string[2]{"Amy", "Ally"};myMeeting.invitees = attendees;XmlSerializer xs = new XmlSerializer(typeof(Meeting));StreamWriter writer = new StreamWriter(@"C:\Meeting.xml");xs.Serialize(writer, myMeeting);writer.Close();/您需要确定作为运行此过程的结果写入C:\Meeting.xml 文件的XML 块。哪个XML 块代表将写入C:\Meeting.xml 文件的内容?()

A.

B.

C.

D.


参考答案:B
1)要序列化Meeting类,其中它的title变量是私有的,所以不可以序列化文档中没有tilte。 2)Invitees会被序列化为xml组元素 强名称是由程序集的标识加上公钥和数字签名组成的,其中,程序集的标识包括简单文本名称、版本号和区域性信息(如果提供的话)。它使用对应的私钥从程序集文件中生成。(程序集文件包含程序集清单,其中包含组成程序集的所有文件的名称和哈希。)

第3题:

为使下列代码正常运行,应该在下划线处填入的选项是

abstract class Person{

public Person(String n)!

name=n;

}

public____String getDescription();

public String getName(){

return name;

}

private String name;

}

A.static

B.private

C.abstract

D.final


正确答案:C

第4题:

已知String类定义如下:

class String

{

public:

String(const char *str = NULL); // 通用构造函数

String(const String &another); // 拷贝构造函数

~ String(); // 析构函数

String & perater =(const String &rhs); // 赋值函数

private:

char *m_data; // 用于保存字符串

};

尝试写出类的成员函数实现。


正确答案:

 

String::String(const char *str)
{
if ( str == NULL ) //strlen在参数为NULL时会抛
异常才会有这步判断
{
m_data = new char[1] ;
m_data[0] = '\0' ;
}
else
{
m_data = new char[strlen(str) + 1];
strcpy(m_data,str);
}
}
String::String(const String &another)
{
m_data = new char[strlen(another.m_data) + 1];
strcpy(m_data,other.m_data);
}
String& String::operator =(const String &rhs)
{
if ( this == &rhs)
return *this ;
delete []m_data; //删除原来的数据,新开一块内

m_data = new char[strlen(rhs.m_data) + 1];
strcpy(m_data,rhs.m_data);
return *this ;
}
String::~String()
{
delete []m_data ;
}

第5题:

阅读下面代码 abstract class Person { public Person(String n) { name=n; } public______String getDescription(); public String getName() { return name; } private String name; } 在下画线处应填入的修饰符是

A.static

B.abstract

C.protected

D.final


正确答案:B

第6题:

You have recently created a serializable class named Vehicle.The class is shown below:[Serializable]public class Vehicle{public string VIN;public string Make;public string Model;public string Year;}You are planning to create a custom formatter class to control the formatting of Vehicle objects when they are serialized.You need to ensure that is achieved with as little development effort as possible.What should you do?()

A.

B.

C.

D.


参考答案:D

第7题:

你创建了一个类库,这个类库被应用程序用于Certkiller .com网站3个部分类库中包含一个如下定义的Department类。public class Department {public string name;public string manager;}每个应用程序使用自定义配置节点来存储在应用程序配置文件中的特定部门的值下面的代码所示。您需要编写代码段中,通过使用从应用程序配置文件中检索字段值创建一个部门的对象实例。您应该使用哪个代码段?()

A.

B.

C.

D.


参考答案:C

第8题:

阅读下列代码段 abstract class Person{ public Person(String n){ name=n; } public______String getDescription(); public String getName(){ } private String name; } 在下画线处应填入的修饰符是

A.static

B.abstract

C.protected

D.final


正确答案:B
解析:抽象类中的方法没有方法体只有方法声明,那么这个方法必定是抽象的。含有抽象方法的类一定是抽象类,但抽象类中的方法不一定是抽象方法,可以是具体实现了的方法,这个方法可作为继承此抽象类的子类的公共方法。

第9题:

public class Something {

void doSomething () {

private String s = "";

int l = s.length();

}

}

有错吗?


正确答案:

 

错。局部变量前不能放置任何访问修饰符 (private,public,和protected)。final 可以

用来修饰局部变量

(final 如同abstract 和strictfp,都是非访问修饰符,strictfp 只能修饰class 和method 而非

variable)。

第10题:

已知类 String 的原型为

class string

{

public:

string(const char *str=null);//普通构造函数

string(const string &other);//拷贝构造函数

---string(void);

string &operate=(const string &other);//赋值函数

private:

char * m-data;//用于保存字符串

};

请编写 string 的上述4 个函数


正确答案:
 

更多相关问题