70-536中文题库(带解析)(4)

2019-03-16 18:57

CompareInfo:实现一组方法进行区分区域性的字符串比较。

要创建CompareInfo的实例,需调用请使用 CultureInfo.CompareInfo 属性,或使用 GetCompareInfo 方法。

IndexOf(source,value)搜索指定的子字符串并返回整个源字符串内第一个匹配项的从零开始的索引。所以选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

解析:第六章 第一小节

此题主要考察NumberFormatInfo:根据区域性定义如何设置数值格式以及如何显示数值。属性:NumberNegativePattern 。获取或设置负数值的格式模式。默认值是1表示-1. [?neɡ?tiv]

属性:CurrencyNegativePattern 获取或设置负货币值的格式模式。 默认值是0 0 ($n) 1 -$n 所以选B

23、您正在为客户开发财政报告。 您的客户都有一个主要的办公室,在美国和一个在墨西哥的卫星办公室。 您需要确保当卫星办公室中的用户生成的该报告 当前日期显示在墨西哥西班牙语格式。 您应该使用哪个代码段?

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 第六章 第一小节

解析:此题主要考察了DateTimeFormatInfo,创建它的新实例,调用CultureInfo的DateTimeFormat属性。

DateTimeFormatInfo:定义如何根据区域性设置 DateTime 值的格式并显示这些值。 24、联系第74道题,解密

您正在开发一个方法,以使用数据加密标准(DES) 算法对敏感数据进行加密。您的方法接受下列参数:

·名为message 的待加密的字节数组 ·名为key 的加密密钥 ·名为iv 的初始化向量

您需要对数据加密。您还需要将加密数据写入MemoryStream 对象。 您应该使用哪个代码段?

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);

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

解析:此题主要考察了DES加密。其中

CreateEncryptor()是创建加密器容器,参数是指定的密钥和初始化向量,排除C, CryptoStream:定义将数据流链接到加密转换的流。考察了Write方法,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

解析:此题考察了SecurityPermission类,Unmanaged:非托管代码

Demand 要求调用堆栈中的所有高级调用方都已被授予了当前权限对象所指定的权限

26.您正在开发一种更高版本验证哈希数据的方法,通过使用 MD5 算法。 数据作为字节数组的命名消息(为message)传递给您的方法。 您需要通过使用 MD5 计算哈希值的传入的参数。 您还需要将结果放入一个字节数组。 您应该使用哪个代码段? A. HashAlgorithm algo = HashAlgorithm.Create(\[??lɡ?rie?m] 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

解析:HashAlgorithm表示所有加密哈希算法实现均必须从中派生的基类。

ComputerHash():计算输入数据的哈希值。题目的数据已经放置到message数组中,所以选A

27.您创建一个通过使用最终用户凭据运行的方法。您需要使用Microsoft Windows 组向用户授权。您必须添加代码段,该代码段确定用户是否在名为Clerk 的本地组中。 您应该使用哪个代码段?

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

解析: 此题主要考察的WindowsPrincipal: 允许代码检查 Windows 用户的 Windows 组成员身份。判断这个用户是否在“Clerk”组中。所以选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

解析:此题主要考察了FileSecurity类,表示文件的访问控制和审核安全。方法的SetAcessRuleProtection()方法

最后应设置文件的安全控制,最好的答案选A

29. 您正在编写用于用户身份验证和授权的代码。用户名、密码和角色存储在您的应用程序数据存储区中。您需要建立一个用户安全上下文,用于IsInRole 之类的授权检查。您编写以下代码段以向用户授权。

if (!TestPassword(userName, password))

throw new Exception(\

String[] userRolesArray = LookupUserRoles(userName);

您需要完成此代码,以便它建立用户的安全上下文。 您应该使用哪个代码段?

A. GenericIdentity ident = new GenericIdentity(userName); //该类表示具有指定名称的用户。 GenericPrincipal currentUser = new GenericPrincipal(ident, userRolesArray); //表示当前用户的角色

Thread.CurrentPrincipal = currentUser; //线程当前的负责人是是userRolesArray中userName

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

解析:对比几个答案,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

解析: 关键是就好像从本地Intranet 区域中加载程序集一样这一句,遍历所有答案,只有C完成了一个功能,所以答案选C

31.您正在开发一个类库,将打开网络套接字到网络上的计算机的连接。

您会将该类库部署到全局程序集缓存并授予它完全信任。 您编写以下代码,确保使用的套接字连接。

SocketPermission permission =new SocketPermission(PermissionState.Unrestricted); permission.Assert();//您的代码有权限执行、但代码的调用方可能没有权限执行的操作, 警告 请谨慎使用断言,因为它们会打开安全漏洞,并会破坏运行库实施安全限制的机制。

某些使用类库的应用程序可能没有必需的权限以打开网络套接字连接。 您需要取消该断言。 您应该使用哪个代码段? A. CodeAccessPermission.RevertAssert(); B. CodeAccessPermission.RevertDeny(); C. permission.Deny();


70-536中文题库(带解析)(4).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:基础施工方案

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: