D. public class Role :
ConfigurationElement {
internal string _ElementName = \ private string _name;
[ConfigurationProperty(\ public string Name { get {
return _name; } } } 答案: B
19.你需要生成一个语言代码和地区代码的报告列表。使用哪个代码来实现?
A. foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.SpecificCultures)) { // Output the culture information...}
B. CultureInfo culture = new CultureInfo(\ // Output the culture information...
C. foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.NeutralCultures)) { // Output the culture information...}
D. foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.ReplacementCultures)) { // Output the culture information...} 答案: A
20.您创建了一个存储居住在不同区域的客户的信息的应用程序。您是发展中国家的内部工具,用于此应用
程序。你需要收集区域信息您的客户在加拿大。你正在为你这个应用程序开发内部的公用程序。你需要收集的客户信息是加拿大国家的客户。用哪段代码可以实现?
A. foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.SpecificCultures)) { // Output the region information...}
B. CultureInfo cultureInfo = new CultureInfo(\ C. RegionInfo regionInfo = new RegionInfo(\ D. RegionInfo regionInfo = new RegionInfo(\ { // Output the region information...} 答案: C
21、您正在开发一个方法,一个字符串中子字符串搜索。 方法将会意大利本地化。 您的方法接受以下参数: 在那个字串中搜索,名为serchList,搜索的子字串,名为searchValue。 你应该使用哪个代码段? A. return searchList.IndexOf(searchValue);
B. CompareInfo comparer = new CultureInfo(\ return comparer.Compare(searchList, searchValue); C. CultureInfo comparer = new CultureInfo(\ if (searchList.IndexOf(searchValue) > 0) {return true;} else {return false;}
D. CompareInfo comparer = new CultureInfo(\ if (comparer.IndexOf(searchList, searchValue) > 0) {return true;}
else { return false;}
Answer: D
22、您正在为在香港居住的客户端开发应用程序。您需要使用一个减号显示负货币值。 你应该使用哪个代码段?
A. NumberFormatInfo culture = new CultureInfo(\ culture.NumberNegativePattern = 1; return numberToPrint.ToString(\ B. NumberFormatInfo culture = new CultureInfo(\ culture.CurrencyNegativePattern = 1; return numberToPrint.ToString(\ C. CultureInfo culture =new CultureInfo(\culture);
D. CultureInfo culture =new CultureInfo(\return numberToPrint.ToString(\culture); Answer: B
23、您正在为客户开发财政报告。 您的客户都有一个主要的办公室,在美国和一个在墨西哥的卫星办公室。 您需要确保当卫星办公室中的用户生成的该报告 KilTest 70 536 当前日期显示在墨西哥西班牙语格式。 你应该使用哪个代码段?
A. DateTimeFormatInfo dtfi = new CultureInfo(\ DateTime dt = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day);
string dateString = dt.ToString(dtfi.LongDatePattern);
B. Calendar cal = new CultureInfo(\
DateTime dt = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day); Strong dateString = dt.ToString();
C. string dateString = DateTimeFormatInfo.CurrentInfo GetMonthName(DateTime.Today.Month);
D. string dateString = DateTime.Today.Month.ToString(\
Answer: A
24、您正在开发一种方法,用数据加密标准(DES)对敏感数据进行加密。
您的方法接受以下参数:用于加密的字节数组,被命名为messageAn, 需要对数据进行加密的 key,被命名为keyAn,用于初始化向量的加密密钥。 您还需要加密的数据写入内存流对象。你应该使用哪个代码段? A. DES des = new DESCryptoServiceProvider(); des.BlockSize = message.Length;
ICryptoTransform crypto = des.CreateEncryptor(key, iv); MemoryStream cipherStream = new MemoryStream();
CryptoStream cryptoStream = new CryptoStream(cipherStream, crypto, CryptoStreamMode.Write);
cryptoStream.Write(message, 0, message.Length); B. DES des = new DESCryptoServiceProvider();
ICryptoTransform crypto = des.CreateDecryptor(key, iv); MemoryStream cipherStream = new MemoryStream();
CryptoStream cryptoStream = new CryptoStream(cipherStream, crypto, CryptoStreamMode.Write);
cryptoStream.Write(message, 0, message.Length); C. DES des = new DESCryptoServiceProvider(); ICryptoTransform crypto = des.CreateEncryptor(); MemoryStream cipherStream = new MemoryStream();
CryptoStream cryptoStream = new CryptoStream(cipherStream, crypto, CryptoStreamMode.Write);
cryptoStream.Write(message, 0, message.Length); D. DES des = new DESCryptoServiceProvider(); ICryptoTransform crypto = des.CreateEncryptor(key, iv); MemoryStream cipherStream = new MemoryStream();
CryptoStream cryptoStream = new CryptoStream(cipherStream, crypto, CryptoStreamMode.Write);
cryptoStream.Write(message, 0, message.Length); Answer: D
25、您正在开发一种方法调用 COM 组件。 您需要使用来显式请求运行库以执行完全堆栈遍历的声明性安全。 必须确保所有调用方具有所需的 COM Interop 的信任级别之前调用方执行您的方法,。 你应放置哪些属性方法? A. [SecurityPermission(SecurityAction.Demand, Flags=SecurityPermissionFlag.UnmanagedCode)] B. [SecurityPermission(SecurityAction.LinkDemand,
Flags=SecurityPermissionFlag.UnmanagedCode)] C. [SecurityPermission(SecurityAction.Assert, Flags = SecurityPermissionFlag.UnmanagedCode)]
D.[SecurityPermission(SecurityAction.Deny,Flags= SecurityPermissionFlag.UnmanagedCode)] Answer: A
26、您正在开发一种更高版本验证哈希数据方法通过使用 MD5 算法。 数据作为字节数组的命名消息传递给您的方法。 您需要通过使用 MD5 计算哈希值的传入的参数。 您还需要将结果放入一个字节数组。 你应该使用哪个代码段? A. HashAlgorithm algo = HashAlgorithm.Create(\ byte[] hash = algo.ComputeHash(message);
B. HashAlgorithm algo = HashAlgorithm.Create(\ byte[] hash = BitConverter.GetBytes(algo.GetHashCode());
C. HashAlgorithm algo;algo = HashAlgorithm.Create(message.ToString());byte[] hash = algo.Hash;
D. HashAlgorithm algo = HashAlgorithm.Create(\
byte[] hash = null;algo.TransformBlock(message, 0, message.Length, hash, 0); Answer: A
27、创建一个方法,通过使用最终用户的凭据运行。 您需要使用 Microsoft Windows 组来授权用户。 您必须添加一个标识用户是否在本地组 KilTest 70 536 名为秘书中的代码段。你应该使用哪个代码段?
A. WindowsIdentity currentUser = WindowsIdentity.GetCurrent(); foreach (IdentityReference grp in currentUser.Groups)
{NTAccount grpAccount = ((NTAccount)grp.Translate(typeof(NTAccount))); isAuthorized = grpAccount.Value.Equals(Environment.MachineName + @\ if (isAuthorized) break;}
B. WindowsPrincipal currentUser = (WindowsPrincipal)Thread.CurrentPrincipal; isAuthorized = currentUser.IsInRole(\
C. GenericPrincipal currentUser = (GenericPrincipal) Thread.CurrentPrincipal; isAuthorized = currentUser.IsInRole(\
D. WindowsPrincipal currentUser = (WindowsPrincipal)Thread.CurrentPrincipal;
isAuthorized = currentUser.IsInRole(Environment.MachineName); Answer: B
28、要更改一个名为 MyData.xml 文件的安全设置。 你要保留现有的继承的访问规则。 您还需要禁止访问规则的未来继承的更改。 你应该使用哪个代码段?
A. FileSecurity security = new FileSecurity(\ security.SetAccessRuleProtection(true, true);File.SetAccessControl(\ B. FileSecurity security = new FileSecurity();
security.SetAccessRuleProtection(true, true);File.SetAccessControl(\ C. FileSecurity security =
File.GetAccessControl(\ D. FileSecurity security = File.GetAccessControl(\
security.SetAuditRuleProtection(true, true);File.SetAccessControl(\Answer: A
29、您编写代码的用户身份验证和授权。 在用户名、 密码的和角色存储在应用程序数据存储区中。 您需要建立一个将用于授权检查如 IsInRole 的用户安全上下文。 你写下列的
代码段,授权用户。
要完成此代码,以便它建立用户的安全上下文。 你应该使用哪个代码段? A. GenericIdentity ident = new GenericIdentity(userName);
GenericPrincipal currentUser = new GenericPrincipal(ident, userRolesArray); Thread.CurrentPrincipal = currentUser;
B. WindowsIdentity ident = new WindowsIdentity(userName); WindowsPrincipal currentUser = new WindowsPrincipal(ident); Thread.CurrentPrincipal = currentUser;
C. NTAccount userNTName = new NTAccount(userName); GenericIdentity ident = new GenericIdentity(userNTName.Value);
GenericPrincipal currentUser= new GenericPrincipal(ident, userRolesArray); Thread.CurrentPrincipal = currentUser;
D. IntPtr token = IntPtr.Zero;token = LogonUserUsingInterop(userName, encryptedPassword); WindowsImpersonationContext ctx = WindowsIdentity.Impersonate(token); Answer: A
30、要加载到应用程序中的新的程序集。 你需要重写默认证据的程序集。
您需要公共语言运行库 (CLR) 授予的权限设置,该程序集,犹如该程序集加载从本地 Intranet 区域。 您需要生成证据集合。 你应该使用哪个代码段?
A. Evidence evidence = new Evidence(Assembly.GetExecutingAssembly().Evidence ); B. Evidence evidence = new Evidence();evidence.AddAssembly(new Zone(SecurityZone.Intranet));
C. Evidence evidence = new Evidence();evidence.AddHost(new Zone(SecurityZone.Intranet)); D. Evidence evidence = new Evidence(AppDomain.CurrentDomain.Evidence); Answer: C