适用于所有者字段的 OptionalField 属性。
应用,所以所有者字段的属性。
已实现 IFormatter 接口的自定义序列化的车辆类别。
做什么,因为在使用二进制序列化时,私营领域是永远不会保留。
第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.做什么,因为在使用二进制序列化时,私营领域是永远不会保留。
第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.
第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
第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
第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.
第7题:
你创建了一个类库,这个类库被应用程序用于Certkiller .com网站3个部分类库中包含一个如下定义的Department类。public class Department {public string name;public string manager;}每个应用程序使用自定义配置节点来存储在应用程序配置文件中的特定部门的值下面的代码所示。您需要编写代码段中,通过使用从应用程序配置文件中检索字段值创建一个部门的对象实例。您应该使用哪个代码段?()
A.
B.
C.
D.
第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
第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 个函数