微软资质认证考试题库5_第1页
微软资质认证考试题库5_第2页
微软资质认证考试题库5_第3页
微软资质认证考试题库5_第4页
微软资质认证考试题库5_第5页
已阅读5页,还剩81页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

PrepKing

Number:70-511

PassinQScore:700

TimeLimit:90min

FileVersion:7.0

PrepKing-70-511

ExamA

QUESTION1

YouuseMicrosoft.NETFramework4tocreateaWindowsPresentationFoundation(WPF)

application.

Youwritethefollowingcodefragment.

<StackPanelTextBox.PreviewTextlnput=',StackPanel_PreviewTextlnput,'>

<TextBoxName="TxtBoxA'7>

<TextBoxName="TxtBoxB'7>

<TextBoxName=HTxtBoxC"/>

</StackPanel>

YoucreateaneventhandlernamedStackPanel_PreviewTextlnput.Youalsohaveacollectionof

stringsnamedKeywords.

YouneedtoensurethatTxtBoxAandTxtBoxBdonotcontainanyofthestringsintheKeywords

collections.

Whichcodesegmentshouldyouuse?

A.privatevoidStackPanel_PreviewTextlnput(object

sender,TextCompositionEventArgse)

{FrameworkElementfeSource=senderas

FrameworkElement;

if(feSource.Name=="TxtBoxA"||feSource.Name==

"TxtBoxB")

{foreach(stringkeywordinKeywords)

(

if(e.Text.Contains(keyword)){

©.Handled=false;

return;

)

}}e.Handled=true;

})

B.privatevoidStackPanel_PreviewTextlnput(object

sender,TextCompositionEventArgse){

FrameworkElementfeSource=e.Sourceas

FrameworkElement;

f(feSource.Name=="TxtBoxA"||feSource.Name==

"TxtBoxB")

f(feSource.Name=="TxtBoxA"||feSource.Name==

"TxtBoxB"){

foreach(stringkeywordinKeywords)

(

if(e.Text.Contains(keyword)){

e.Handled=false;

return;

)

}e.Handled=true;

C.privatevoidStackPanel_PreviewTextlnput(object

sender,TextCompositionEventArgse)

{

FrameworkElementfeSource=senderas

FrameworkElement;

if(feSource.Name=="TxtBoxA"||feSource.Name==

"TxtBoxB")

{foreach(stringkeywordinKeywords)

{if(e.Text.Contains(keyword)){

e.Handled=true;

return;}

}e.Handled=false;

})

D.privatevoidStackPanel__PreviewTextlnput(object

sender,TextCompositionEventArgse)

{FrameworkElementfeSource=e.Sourceas

FrameworkElement;

if(feSource.Name=="TxtBoxA"||feSource.Name==

"TxtBoxB")

(

foreach(stringkeywordinKeywords)

{if(e.Text.Contains(keyword)){

e.Handled=true;

return;

}}e.Handled=false;

)

}

Answer:D

Section:(none)

Explanation/Reference:

QUESTION2

YouuseMicrosoft.NETFramework4tocreateaWindowsPresentationFoundation(WPF)

application.

TheapplicationcontainsacompositeusercontrolthatincludesaTextBoxcontrolnamedtxtinput.

Theusercontrolwillbehostedinawindowandwillhavehandlersforthetext-changedeventof

txtinput.

Youneedtoensurethattheapplicationmeetsthefollowingrequirements:

■Createsatext-changedeventhandlernamedAudit_TextChangedforthetxtInputcontrol.

■ExecutesAudit_TextChangedevenwhenspecifichandlersmarktheeventashandled.

Whichcodesegmentshouldyouaddtotheconstructoroftheusercontrol

A.txtlnput.TextChanged+=Audit_TextChanged;

B.AddHandler(TextBox.TextChangedEver)t,new

RoutedEventHandler(Audit_TextChanged),true);

C.EventManager.RegisterClassHandler(typeof(TextBox),

TextBox.TextChangedEvent,new

RoutedEventHandler(Audit_TextChanged),true);

D.EventManager.RegisterClassHandler(typeof(TextBox),

TextBox.TextChangedEvent,new

RoutedEventHandler(Audit_TextChanged),false);

Answer:B

Section:(none)

Explanation/Reference:

QUESTION3

YouuseMicrosoft.NETFramework4tocreateaWindowsPresentationFoundation(WPF)

application.

TheapplicationcontainsacompositeusercontrolthatincludesaTextBoxcontrolnamedtxtinput.

Theusercontrolwillbehostedinawindowandwillhavehandlersforthetext-changedeventof

txtinput.

Youneedtoensurethattheapplicationmeetsthefollowingrequirements:

AddHandler(TextBox.TextChangedEvent,newRoutedEventHandler(Audit_TextChanged),true);

WhichofthefollowingstatmentsareTRUE?(chooseallthatapply)

A.Atext-changedeventhandler,named

Audit_TextChanged,wasCreatedforthetxtinput

control.

B.Audit_TextChangedwillstoprunningbecausethe

eventismarkedashandledbycertaineventhandlers.

C.Eventhroughtheeventismarkedhandledbycertain

eventhandlers,Audit_TextChangedwillstillrun.

D.Audit_TextChangedwillcontinuetorununtiltheevent

ismarkedashandled.

Answer:AC

Section:(none)

Explanation/Reference:

QUESTION4

YouuseMicrosoft.NETFramework4tocreateaWindowsPresentationFoundation(WPF)

application.

YoucreateawindowthatcontainsaButtoncontrolandaMenuitemcontrol.Bothcontrolsare

labeled"Addsugar."

TheCommandpropertiesoftheButtonandMenuitemcontrolsaresettothesame

RoutedCommandnamedAddSugarCommand.

Youwritethefollowingcodesegment.

privatevoidCanAddSugar(objectsender,CanExecuteRoutedEventArgse){...}

YouneedtoensurethatwhentheCanAddSugarmethodsetse.CanExecutetofalse,the

MenuitemandButtoncontrolsaredisabled.

Whatshouldyoudo?

A.CreateaneventhandlerfortheCanExecuteChanged

eventoftheAddSugarCommandcommand.

CalltheCanAddSugarmethodfromwithintheevent

handler.

B.InherittheAddSugarCommandfromthe

RoutedUICommandclassinsteadofthe

RoutedCommandclass.

CalltheCanAddSugarmethodfromwithinthe

constructoroftheAddSugarCommandcommand.

C.AddaCommandBindingobjecttothe

CommandBindingpropertyoftheMenuitemcontrol.

SettheCanExecutepropertyoftheCommandBinding

objecttotheCanAddSugarmethod.

D.AddaCommandBindingobjecttothe

CommandBindingspropertyofthewindow.

SettheCommandpropertyofCommandBindingtothe

AddSugarCommandcommand.

SettheCanExecutepropertyofthe

CommandBindingobjecttotheCanAddSugarmethod.

Answer:D

Section:(none)

Explanation/Reference:

QUESTION5

YouuseMicrosoft.NETFramework4tocreateaWindowsPresentationFoundation(WPF)

application.The

applicationhasawindownamedMainWindowthathasaStackPanelcontrolnamedspasthe

rootelement.

YouwanttocreateaButtoncontrolthatcontainsaTextBlockcontrolwiththe"Save"Text

property.

Youneedtocreatethecontroldynamicallyandaddthecontroltosp.

WhichcodesegmentshouldyouwriteintheconstructoroftheMainWindowclass?

A.Buttonbtn=newButton();

TextBlocktext=newTextBlock();

text.Text="Save";

btn.Content=text;

sp.DataContext=btn;

B.Buttonbtn=newButton();

TextBlocktext=newTextBlock();

text.Text="Save";

btn.Content=text;

sp.Children.Add(btn);

C.Buttonbtn=newButton();

TextBlocktext=newTextBlock();

text.Text="Save*';

sp.Children.Add(btn);

sp.ChiIdren.Add(text);

D.Buttonbtn=newButton();

TextBlocktext=newTextBlock();

text.Text="Save";

btn.ContentTemplateSelector.SelectTemplate(text,

null);

sp.Children.Add(btn);

Answer:B

Section:(none)

Explanation/Reference:

QUESTION6

YoucreateaWindowsclientapplicationbyusingWindowsPresentationFoundation(WPF).

Theapplicationcontainsthefollowingcodefragment.

<Window.Resources>

<DataTemplatex:Key="detail”>

</DataTemplate>

</Window.Resources>

<StackPanel>

<ListBoxName=',lbDetails">

</ListBox>

<ButtonName=HbtnDetails">Details</Button>

</StackPanel>

YouneedtoassignIbDetailstousethedetaildatatemplatewhenbtnDetailsisclicked.

WhichcodesegmentshouldyouwritefortheclickeventhandlerforbtnDetails?

A.IbDetails.ltemsPanel.FindName(ndetair,IbDetails);

B.vartmpl=(ControlTemplate)FindResource("detail");

IbDetails.Template=tmpl;

C.vartmpl=(DataTemplate)FindName("detair');

IbDetails.ItemTemplate=tmpl;

D.vartmpl=(DataTemplate)FindResource('detair');

IbDetails.ltemTemplate=tmpl;

Answer:D

Section:(none)

Explanation/Reference:

QUESTION7

YouuseMicrosoft.NETFramework4tocreateaWindowsPresentationFoundation(WPF)

application.

Youwanttoaddanaudioplayerthatplays.wavor.mp3fileswhentheuserclicksabutton.

YouplantostorethenameofthefiletoavariablenamedSoundFilePath.

Youneedtoensurethatwhenauserclicksthebutton,thefileprovidedbySoundFilePath

plays.

Whatshouldyoudo?

A.Writethefollowingcodesegmentinthebuttononclick

event.

System.Media.SoundPlayerplayer=new

System.Media.

SoundPlayer(SoundFilePath);player.play();

B.Writethefollowingcodesegmentinthebuttononclick

event.

MediaPlayerplayer=newMediaPlayer();

player.Open(newURI(SoundFilePath),

UriKind.Relative));player.play();

C.UsethefollowingcodesegmentfromthePlaySound()

Win32APIfunctionandcallthePlaySoundfunctionin

thebuttononclickevent.

[sysimport(dll="winmm.dll")]

publicstaticexternlongPlaySound(String

SoundFilePath,longhModule,longdwFlags);

D.ReferencetheMicrosoft.DirectXDynamicLink

Libraries.Usethefollowingcodesegmentinthebutton

onclickevent.

Audiosong=newSong(SoundFilePath);

song.CurrentPosition=song.Duration;song.Play();

Answer:B

Section:(none)

Explanation/Reference:

QUESTION8

YouuseMicrosoft.NETFramework4tocreateaWindowsPresentationFoundation(WPF)

application.

Youwritethefollowingcodefragment.

<StackPanel>

<StackPanel.Resources>

<StyleTargetType="{x:TypeButton}">

<EventSetterEvent=nClick"Handler='ButtonHandler"^

</Style>

</StackPanel.Resources>

<ButtonName="OkButton">Ok</Button>

<ButtonName^CancelButton"Click=',CancelClickedM>Cancel</Button>

</StackPanel>

YouneedtoensurethattheButtonHandlermethodisnotexecutedwhentheuserclicksthe

CancelButtonbutton.

Whichcodesegmentshouldyouaddtothecode-behindfile?

A.privatevoidCancelClicked(objectsender,

RoutedEventArgse)

(

Buttonbtn=(Button)sender;

btn.Command=null;

)

B.privatevoidCancelClicked(objectsender,

RoutedEventArgse){

Buttonbtn=(Button)sender;

btn.lsCancel=true;

}

C.privatevoidCancelClicked(objectsender,

RoutedEventArgse){

e.Handled=true;

)

D.privatevoidCancelClicked(objectsender,

RoutedEventArgse){

e.Handled=false;

}

Answer:C

Section:(none)

Explanation/Reference:

QUESTION9

YouuseMicrosoftVisualStudio2010andMicrosoft.

NETFramework4tocreateaWindowsPresentationFoundation(WPF)application.

YoucreateaWPFwindowintheapplication.

Youaddthefollowingcodesegmenttotheapplication.

publicclassViewModel

(

publicCollectionViewData{get;set;}

)

publicclassBusinessobject

{

publicstringName{get;set;}

)

TheDataContextpropertyofthewindowissettoaninstanceoftheViewModelclass.

TheDatapropertyoftheViewModelinstanceisinitializedwithacollectionofBusinessobject

objects.

YouaddaTextBoxcontroltotheWindow.

YouneedtobindtheTextpropertyoftheTextBoxcontroltotheNamepropertyofthecurrent

itemoftheCollectionviewoftheDataContextobject.

Youalsoneedtoensurethatwhenabindingerroroccurs,theTextpropertyoftheTextBox

controlissettoN/A.

Whichbindingexpressionshouldyouuse?

A.{BindingPath=Data/Name,FallbackValue=N/A'}

B.{BindingPath=Data.Name,FallbackValue=N/A'}

C.{BindingPath=Data/Name,TargetNullValue=,N/A'}

D.{BindingPath=Data.Name,TargetNullValue=,N/A'}

Answer:A

Section:(none)

Explanation/Reference:

B

QUESTION10

YouuseMicrosoft.NETFramework4tocreateaWindowsFormsapplication.

YouaddanewclassnamedCustomertotheapplication.

YouselecttheCustomerclasstocreateanewobjectdatasource.

YouaddthefollowingcomponentstoaWindowsForm:

■ABindingSourcecomponentnamedcustomerBindingSourcethatisdata-boundtothe

Customerobjectdatasource.

■AsetofTextBoxcontrolstodisplayandedittheCustomerobjectproperties.

■EachTextBoxcontrolisdata-boundtoapropertyofthecustomerBindingSourcecomponent.

■AnErrorProvidercomponentnamederrorProviderthatvalidatestheinputvaluesforeach

TextBoxcontrol.

YouneedtoensurethattheinputdataforeachTextBoxcontrolisautomaticallyvalidatedby

usingtheErrorProvidercomponent.

Whichtwoactionsshouldyouperform?(Eachcorrectanswerpresentspartofthesolution.

Choosetwo.)

A.ImplementthevalidationrulesinsidetheValidating

eventhandlerofeachTextBoxcontrolbythrowingan

exceptionwhenthevalueisinvalid.

B.Implementthevalidationrulesinsidethe

TextChangedeventhandlerofeachTextBoxcontrol

bythrowinganexceptionwhenthevalueisinvalid.

C.Implementthevalidationrulesinsidethesetterofeach

propertyoftheCustomerclassbythrowingan

exceptionwhenthevalueisinvalid.

D.Addthefollowingcodesegmenttothe

InitializeComponentmethodoftheWindowsForm.

this.errorProvider.DataSource=

this.customerBindingSource;

E.Addthefollowingcodesegmenttothe

InitializeComponentmethodoftheWindowsForm.

this.errorProvider.DataSource=

this.customerBindingSource.DataSource;

this.errorProvider.DataMember=

this.customerBindingSource.DataMember;

Answer:CD

Section:(none)

Explanation/Reference:

QUESTION11

YouuseMicrosoft.NETFramework4tocreateaWindowsPresentationFoundation(WPF)

application.

Youwritethefollowingcodesegment.(Linenumbersareincludedforreferenceonly.)

01publicclassContact

02{

03privatestring_contactName;

04

05publicstringContactName{

06get{return_contactName;}

07set{_contactName=value;}

08)

09

10)

YouaddthefollowingcodefragmentwithinaWPFwindowcontrol.

<TextBox>

<TextBox.Text>

<BindingPath="ContactName"UpdateSourceTrigger="PropertyChanged,'>

<Binding.ValidationRules>

<DataErrorValidationRule/>

</Binding.ValidationRules>

</Binding>

</TextBox.Text>

</TextBox>

TheTextBoxcontrolisdata-boundtoaninstanceoftheContactclass.

YouneedtoensurethattheContactclasscontainsabusinessruletoensurethatthe

ContactNamepropertyisnotemptyorNULL.

YoualsoneedtoensurethattheTextBoxcontrolvalidatestheinputdata.

Whichtwoactionsshouldyouperform?(Eachcorrectanswerpresentspartofthesolution.

Choosetwo).

A.Replaceline01withthefollowingcodesegment.

publicclassContact:IDataErrorlnfo

B.Replaceline01withthefollowingcodesegment,

publicclassContact:ValidationRule

C.Replaceline01withthefollowingcodesegment.

publicclassContact:INotifyPropertyChanging

D.Addthefollowingcodesegmentatline04.publicevent

PropertyChangingEventHandlerPropertychanging;

E.Modifyline07withthefollowingcodesegment:

set{

if(this.Propertychanging!=null)

PropertyChanging(this,new

PropertyChangingEventArgsC'ContactName"));

if(string.IsNullOrEmpty(value))

thrownewApplicationException(HContactnameis

required'1);

_contactName=value;

}

F.Addthefollowingcodesegmentatline09.

publicstringError{

publicstringthis[stringcolumnName]{

get(

if(columnName=="ContactName"&&

string.IsNullOrEmpty(this.ContactName))

return"Contactnameisrequired*1;

returnnull;

}

}

Answer:AF

Section:(none)

Explanation/Reference:

QUESTION12

YouuseMicrosoft.NETFramework4tocreateaWindowsPresentationFoundation(WPF)

application.

Youwritethefollowingcodesegment.

publicclassContact{privatestring_contactName;

publicstringContactName{

get{return_contactName;}

set{

if(string.IsNullOrEmpty(value))

thrownewApplicationException(HContactnameisrequired");

_contactName=value;

)

YouaddthefollowingcodefragmentinaWPFwindowcontrol.

<TextBoxText="{BindingPath=ContactName,ValidatesOnExceptions=True,

UpdateSourceTrigger=PropertyChanged}"/>

TheTextBoxcontrolisdata-boundtoaninstanceoftheContactclass.Youplantoimplementan

ErrorTemplateintheTextBoxcontrol.

YouneedtoensurethatthevalidationerrormessageisdisplayednexttotheTextBoxcontrol.

Whichcodefragmentshouldyouuse?

A.<ControlTemplate>

<DockPanel>

<AdornedElementPlaceholderName="box"/>

<TextBlockText=u{BindingElementName=box,

Path=AdornedElement.(Validation.Errors)[0].ErrorCont

ent}"Foreground="RedH/>

</DockPanel>

</ControlTemplate>

B.<ControlTemplate>

<DockPanel>

<AdornedElementPlaceholderName=^,box'^/>

<TextBlockText=n{BindingElementName=box,

Path=(Validation.Errors)[0].Exception.Message}"

Foreground="Red"/>

</DockPanel>

</ControlTemplate>

C.<ControlTemplate>

<DockPanel>

<ContentControlName="boxu/>

<TextBlockText=n{BindingElementName=box,

Path=ContentControl.(Validation.Errors)[0].ErrorConte

nt}"Foreground=MRedH/>

</DockPanel>

</ControlTemplate>

D.<ControlTemplate>

<DockPanel><ContentControlName="box"/>

<TextBlockText="{BindingElementName=box,

Path=(Validation.Errors)[0].Exception.Message}"

Foreground="Redn/>

</DockPanel>

</ControlTemplate>

Answer:A

Section:(none)

Explanation/Reference:

QUESTION13

YouuseMicrosoft.NETFramework4tocreateaWindowsFormsapplication.

Youhaveadatasetasshowninthefollowingexhibit.

YouplantoaddaDataGridViewtodisplaythedataset.

YouneedtoensurethattheDataGridViewmeetsthefollowingrequirements:

■ShowsOrderDetailsfortheselectedorder.

■ShowsonlyOrderDetailsforitemsthathaveUnitPricegreaterthan20.

■SortsProductsbyProductName

Whichcodesegmentshouldyouuse?

A.ordersBindingSource.DataSource=

productsBindingSource;

ordersBindingSource.DataMember=

FK_Order_Details_Products";

productsBindingSource.Filter=''UnitPrice>20";

productsBindingSource.Sort="ProductName";

B.productsDataGridView.DataSource=

ordersBindingSource;

productsBindingSource.Filter=''UnitPrice>20";

productsBindingSource.Sort="ProductName";

C.order_DetailsBindingSource.DataSource=

ordersBindingSource;

order_DetailsBindingSource.DataMember=

HFK_Order_Details_Orders";

order_DetailsBindingSource.Filter="UnitPrice>20";

productsBindingSource.Sort="ProductName";

D.order_DetailsDataGridView.DataSource=

ordersBindingSource;

order_DetailsBindingSource.Filter="UnitPrice>20”;

productsBindingSource.Sort="ProductName";

Answer:C

Section:(none)

Explanation/Reference:

QUESTION14

YouuseMicrosoft.NETFramework4tocreateaWindowsPresentationFoundation(WPF)

application.

YouplantouseanexistingWindowsFormscontrolnamedMyWinFormControlinthe

MyControlsassembly.

Youneedtoensurethatthecontrolcanbeusedinyourapplication.

Whatshouldyoudo?

A.Addthefollowingcodefragmenttotheapplication.

<Windowx:Class="HostingWflnWpf.Window1”

xmlns=Hhttp:

///winfx/2006/xaml/presentation

xmlns:x="http:

///winfx/2006/xamr'

xmlns:wf=,'clr-namespace:MyCompany.Controls;asse

mbly=MyControls「■ntleUHostingWflnWpf">

<Grid>

<ElementHost>

<wf:MyWinFormControlx:Name="contror'/>

</ElementHost>

</Grid></Window>

B.Addthefollowingcodefragmenttotheapplication.

<Windowx:Class="HostingWflnWpf.Window1"

xmlns="http:

///winfx/2006/xaml/presentation

xmlns:x="http:

///winfx/2006/xaml"

xmlns:wf="clr-namespace:MyCompany.Controls;asse

mbly=MyControls;HTitle="HostingWflnWpf">

<Grid>

<WindowsFormsHost>

<wf:MyWinFormControlx:Name="control"/>

</WindowsFormsHost>

</Grid></Window>

C.Addthefollowingcodesegmenttothe

WindowsLoadedfunction.

ElementHosthost=newElementHost();

host.Dock=DockStyle.Fill;

MyWinFormControlcontrol=new

MyWinFormControl();

host.Child=control;

this.Controls.Add(host);

D.Addthefollowingcodesegmenttothe

WindowsLoadedfunction.

Gridgrid=newGrid();

System.Windows.Forms.lntegration.WindowsFormsHo

sthost=new

System.Windows.Forms.Integration.WindowsFormsHo

St();

MyWinFormControlcontrol=new

MyWinFormControl();

grid.Children.Add(host);

Answer:B

Section:(none)

Explanation/Reference:

QUESTION15

YouuseMicrosoft.NETFramework4tocreateaWindowsFormsapplication.

YouplantouseaWindowsPresentationFoundation(WPF)controloftheUserControHtype

hostedinan

ElementHostcontrolnamedelementHostl.

Youwritethefollowingcodesegment.(Linenumbersareincludedforreferenceonly.)

01publicclassWPFInWinForms{

02publicWPFInWinForms

03(

04lnitializeComponent();

05

06)

07privatevoidOnBackColorChange(objectsender,StringpropertyName,objectvalue)

08{

09ElementHosthost=senderasElementHost;

lOSystem.Drawing.Colorcol=(System.Drawing.Color)value;

11SolidColorBrushbrush=

newSolidColorBrush(System.Windows.Medi

a.Color.FromRgb(col.R,col.G,col.B));

12UserControl1uc1=host.ChildasUserControH;

13uc1.Background=brush;

14}

15}

Youneedtoensurethattheapplicationchangesthebackgroundcolorofthehostedcontrolwhen

thebackgroundcoloroftheformchanges.

Whichcodesegmentshouldyouinsertatline05?

A.elementHostl.PropertyMap.RemoveCBackColor");

elementHostl.PropertyMap.AddCBackColor",new

PropertyTranslator(OnBackColorChange));

B.elementHostl.PropertyMap.Remove("Background");

elementHostl.PropertyMap.Add("Background",new

PropertyTranslator(OnBackColorChange));

C.elementHostl.PropertyMap.Add("BackColor",new

PropertyTranslator(OnBackColorChange));

elementHostl.PropertyMap.Apply("BackColor");

D.elementHostl.PropertyMap.Add(nBackground",new

PropertyTranslator(OnBackColorChange));

elementHostl.PropertyMap.ApplyC'Background");

Answer:A

Section:(none)

Explanation/Reference:

QUESTION16

YouuseMicrosoft.NETFramework4tocreateaWindowsFormsapplication.

YouneedtoallowtheuserinterfacetousethecurrentlyconfiguredculturesettingsintheControl

Panel.

Whichcodesegmentshouldyouuse?

A.Thread.CurrentThread.CurrentUICulture=

Thread.CurrentThread.CurrentCulture;

B.Thread.CurrentThread.Currentculture=

Thread.CurrentThread.CurrentUICulture;

C.Thread.CurrentThread.CurrentUICulture=

Cultureinfo.InstalledUICulture;

D.Thread.CurrentThread.CurrentCulture=

Culturelnfo.lnstalledUICulture;

Answer:A

Section:(none)

Explanation/Reference:

QUESTION17

YouuseMicrosoft.NETFramework4tocreateaWindowsFormsapplication.

Youcreatedanewapplication,youthenwrotethecodebelow:

Thread.CurrentThread.CurrentUICulture=Thread.CurrentThread.Currentculture;

WhichofthefollowingoptionsareTRUE?

A.Theuserinterfacewillmakeuseofthecurrently

configuredculturesettingsintheControlPanelat

present.

B.Theuserinterfacewillmakeuseofnewculture

settings.

C.Theuserinterfacewillhavenoculturesettings.

D.Theuserinterfacewillmakeuseoftheculturesettings

thatwereinstalledwiththeoperatingsystem.

Answer:A

Section:(none)

Explanation/Reference:

QUESTION18

YouuseMicrosoft.NETFramework4tocreateanapplication.

Theapplicationcontainsapartiallytrustedclientassemblyandaserverassembly.

Youcreateacustomsandboxedapplicationdomain.

Youneedtoensurethattheapplicationcanbeexecutedinapartial-trustenvironment.

Whatshouldyoudo?

A.Applythefollowingattributetotheserverassembly.

[assembly:

AllowPartiallyTrustedCallers(PartialTrustVisibilityLevel

=VisibleToAIIHosts)]

B.Applythefollowingattributetotheserverassembly.

[assembly:

AllowPartiallyTrustedCallers(PartialTrustVisibilityLevel

=NotVisibleByDefault)]

C.Applythefollowingattributetotheclientassembly.

[assembly:

AllowPartiallyTrustedCallers(PartialTrustVisibilityLevel

=VisibleToAIIHosts)]

D.Applythefollowingattributetotheclientassembly.

[assembly:

AllowPartiallyTrustedCallers(PartialTrustVisibilityLevel

=NotVisibleByDefault)]

Answer:B

Section:(none)

Explanation/Reference:

QUESTION19

YouupgradeaWindowsFormsapplicationtoMicrosoft.NETFramework4.Theapplicationwas

developed

byusingapreviousversionofthe.NETFramework.TheapplicationusestheCode

AccessSecurity(CAS)policyforfileaccess.

Whentheapplicationisexecuted,youreceivethefollowingexception:

nNotSupportedException:ThismethodusesCASpolicy,whichhasbeenobsoletedbythe.NET

Framework."

Youneedtoresolvetheerror.

Whatshouldyoudo?

A.Addthefollowingcodefragmenttotheapplication's

configurationfile.

<runtime>

<NetFx40_LegacySecurityPolicyenabled=Mtrue7>

</runtime>

B.Addthefollowingcodefragmenttotheapplication's

configurationfile.<runtime>

<legacyV1CASPolicyenabled="true'7>

</runtime>

C.Addthefollowingcodesegmenttotheapplication's

mainmethod.

AppDomaindomain=

System.AppDomain.CreateDomain(,,MyDomain,');

PolicyLevelpolLevel=

PolicyLevel.CreateAppDomainLevel();

PermissionSetpermSet=new

PermissionSet(PermissionState.None);

permSet.AddPermission(new

SecurityPermission(SecurityPermissionFlag.Execution)

);

domain.ExecuteAssembly("Assemblies\\MyWindowsEx

e.exe");

polLeveLRootCodeGroup.Policystatement=new

PolicyStatement(permSet);

domain.SetAppDomainPolicy(polLevel);

D.Addthefollowingcodesegmenttotheapplication's

mainmethod.

PermissionSetrequiredSet=new

PermissionSet(PermissionState.None);

requiredSet.AddPermission(new

SecurityPermission(SecurityPermissionFlag.Execution)

);PermissionSet

optionalSet=new

PermissionSet(PermissionState.None);

optionalSet.AddPermission(new

FilelOPermission(FilelOPermissionAccess.Read,new

string[]{@Hc:\temp"}));

PermissionSetdeniedSet=new

PermissionSet(PermissionState.None);

deniedSet.AddPermission(new

SecurityPermission(SecurityPermissionFlag.ControlPol

icy));Console.WriteLine(AnCurrentpermissions

granted:");

PermissionSetpermsDenied=null;

foreach(IPermissionpermin

SecurityManager.ResolvePolicy(evidence,

requiredSet,optionalSet,deniedSet,out

permsDenied)){}

Answer:A

Section:(none)

Explanation/Reference:

QUESTION20

YouuseMicrosoft.NETFramework4tocreateaWindowsFormsclientapplication.

Youwritethefollowingcodesegment.

sealedclassFormSettings:ApplicationSettingsBase{

[UserScopedSettingO]

[DefaultSettingValue(H225,200")]

publicSizeFormSize

(

get{return(Size)this["FormSizen];}

set{this["FormSizen]=value;}

)

)

TheapplicationcontainsaformoftypeFormlthatcontainsaFormSettingsobjectnamed

frmSettingsl.

Youneedtomaintaintheuser'sformsizepreferenceeachtimetheuserexecutesthe

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论