MCTS Microsoft .NET Framework 3.5 Windows.FormsApplication
Number: 070-505
Passing Score: 800
Time Limit: 120 min
File Version: 1.0
Exam : Microsoft 70-505
Title : MCTS Microsoft .NET Framework 3.5 Windows.FormsApplication
Version : 8.02
Exam A
QUESTION 1
You.are.creating.aWindows.Forms.application.by.using.the NET.Framework 3.5 The.application.requires.a.form.to.display.a.clock.
You.need to.create.a.circular.form.to.display.the.clock Which.code.segment.should.you use
A.this.FormBorderStyle.= System.Windows.Forms.FormBorderStyle.None System.Drawing.Drawing2D.GraphicsPath.path = new System.Drawing.Drawing2D.GraphicsPath() path.AddEllipse(0, 0, this.Width, this.Height)
Region.reg = new.Region() this.Region = reg
B.this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle. System.Drawing.Drawing2D.GraphicsPath.path = new.System.Drawing.Drawing2D.GraphicsPath() path.AddEllipse(0, 0, this.Width, this.Height)
Region.reg = new.Region(path) this.Region = reg
C.this.FormBorderStyle.= System.Windows.Forms.FormBorderStyle.None System.Drawing.Drawing2D.GraphicsPath.path = new System.Drawing.Drawing2D.GraphicsPath() path.AddEllipse(0, 0, this.Width, this.Height)
Region.reg = new.Region(path) this.Region = reg
D.this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle. System.Drawing.Drawing2D.GraphicsPath.path = new.System.Drawing.Drawing2D.GraphicsPath() path.AddEllipse(0, 0, this.Width, this.Height)
Region.reg = new.Region() this.Region = reg
Answer: C
Section: (none)
Explanation/Reference:
QUESTION 2
You.are.creating.aWindows.Forms.application.by.using.the NET.Framework 3.5.
You.create a.new.form.in.your.application You.add.a.SplitContainer.control.named.spcFrame.to.the.form. The.SplitContainer.control.has.two.SplitterPanel.controls.named.Panel1.and.Panel2. You.are.configuring.the.SplitContainer.control.to.define.the.layout.of.the.form
You.need to.ensure.that.the.following.requirements.aremet: The.initial.distance.from.the.left.edge.of.the.spcFrame.splitter.is.set.to.200.pixels The.size.of.the.Panel2.SplitterPanel.remains.unchanged.when.the.form.is.resized Which.code.segment.should.you use
A.spcFrame.Panel1MinSize = 200 spcFrame.FixedPanel = FixedPanel.Panel1
B.spcFrame.IsSplitterFixed = true spcFrame.SplitterWidth = 200
C.spcFrame.SplitterDistance = 200 spcFrame.FixedPanel = FixedPanel.Panel2
D.spcFrame.Panel2MinSize = 0 spcFrame.SplitterIncrement = 200.
Answer: C
Section: (none)
Explanation/Reference:
QUESTION 3
You are creating a Windows Forms application by using the NET Framework 3.5.
You create a new form in.the application You add.a.ContextMenuStrip control.name dctxMenu to the form. You.have.a.user defined.class.named.CustomControl. You.write.the.following.code.segment.in.the.application (Line numbers.are.included.for.reference.only.)
01.CustomControl.myControl = new.CustomControl() 02.
You.need to.ensure.that.an.instance of.CustomControl.is.displayed on.the.form.as.a.toplevel.item.of.the. ctxMenu.control.
Which.code.segment.should.you add at.line 02
A.ToolStripControlHost.host = new ToolStripControlHost(myControl) ctxMenu.Items.Add(host)
B.ToolStripPanel.panel = new ToolStripPanel() panel.Controls.Add(myControl) ctxMenu.Controls.Add(panel)
C.ToolStripContentPanel.panel = new ToolStripContentPanel() panel.Controls.Add(myControl) ctxMenu.Controls.Add(panel)
D.ToolStripMenuItem menuItem = new ToolStripMenuItem() ToolStripControlHost.host = new ToolStripControlHost(myControl) menuItem.DropDownItems.Add(host) ctxMenu.Items.Add(menuItem)
Answer: A
Section: (none)
Explanation/Reference:
QUESTION 4
You.are.creating.aWindows.Forms.application.by.using.the NET.Framework 3.5.
You.create.a new.form.in.your.application You add a.PrintDocument.control.named.pntDoc.to.the.form. To.support.the.print.functionality, you.write.the.following.code.segment.in.the.application (Line.numbers. are.included.for.reference.only.)
01.pntDoc.BeginPrint.+= new.PrintEventHandler(PrintDoc_BeginPrint) 02
03.bool.canPrint = CheckPrintAccessControl() 04.if.(!canPrint).{
05 06.} 07.
You.need to.ensure.that.the.following.requirements.are.met:
When.the.user.has.no.print.access, font.and.file.stream.initializations.are.not.executed.and.the.print operation. is.cancelled.
Print.operations.are.logged.whether.or.not.the.user.has.print.access.
What.should.you.do
A.Add.the.following.code.segment.at.line 05.
pntDoc.BeginPrint.-= new.PrintEventHandler(PrintDoc_BeginPrint) pntDoc.BeginPrint.+= new.PrintEventHandler((obj, args).=>.args.Cancel = true). Add.the.following.code.segment.at.line.07
pntDoc.BeginPrint.+= new.PrintEventHandler((obj1, args1) =>.LogPrintOperation())
B.Add.the.following.code.segment.at.line 05
pntDoc.BeginPrint.+= new.PrintEventHandler(delegate(object.obj, PrintEventArgs.args){}) Add.the.following.code.segment.at.line.07.
pntDoc.BeginPrint.-= new.PrintEventHandler(PrintDoc_BeginPrint) pntDoc.BeginPrint.+= new.PrintEventHandler((obj1, args1) =>.LogPrintOperation())
C.Add.the.following.code.segment.at.line.05.
pntDoc.BeginPrint.-= new.PrintEventHandler(PrintDoc_BeginPrint)
pntDoc.BeginPrint.-= new.PrintEventHandler(delegate(object.obj, PrintEventArgs.args){}) Add.the.following.code.segment.at.line.07.
pntDoc.BeginPrint.-= new.PrintEventHandler((obj1, args1) =>.LogPrintOperation())
D.Add.the.following.code.segment.at.line.05.
pntDoc.BeginPrint.+= new.PrintEventHandler((obj, args).=>.args.Cancel = true) Add.the.following.code.segment.at.line.07.
pntDoc.BeginPrint.+= new.PrintEventHandler(PrintDoc_BeginPrint) pntDoc.BeginPrint.-= new.PrintEventHandler((obj1, args1) =>.LogPrintOperation()).
Answer: A
Section: (none)
Explanation/Reference:
QUESTION 5
You.are.creating.aWindows.Forms.application.by.using.the NET.Framework 3.5. You.plan.to.modify.a.list.of.orders.within.a.DataGridView.control.in.the.application.
.You.need to.ensure.that.a.value.is.required.in.the.first.column.of.the.grid.control.
.Which.code.segment.should.you use
A. private.void.dataGridOrders_CellValidated( object.sender,.DataGridViewCellEventArgs.e).{
.if.(e.ColumnIndex.==.0) { var.cellValue.=.dataGridOrders[ e.ColumnIndex,.e.RowIndex].Value.. if.(cellValue.==.null.|| string.IsNullOrEmpty(cellValue.ToString()))
{
dataGridOrders.EndEdit()..
}
}
}
B. private.void.dataGridOrders_Validated( object.sender,.EventArgs.e).{
.if.(dataGridOrders.CurrentCell.ColumnIndex.==.0).{
.var.cellValue.=.dataGridOrders.Text. if.(cellValue.==.null.|| string.IsNullOrEmpty(cellValue.ToString()))
{
dataGridOrders.EndEdit()..}
}
}
C. private void.dataGridOrders_Validating( object.sender,.CancelEventArgs.e).{
.if.(dataGridOrders.CurrentCell.ColumnIndex.==.0).{
.var.cellValue.=.dataGridOrders.Text. if.(cellValue.==.null.|| string.IsNullOrEmpty(cellValue.ToString()))
{
e.Cancel.=.true..
}
}
}
D. private void.dataGridOrders_CellValidating( object.sender,.DataGridViewCellValidatingEventArgs.e).{
.if.(e.ColumnIndex.==.0).{
.if.(e.FormattedValue.==.null.|| string.IsNullOrEmpty(e.FormattedValue.ToString()))
{
e.Cancel.=.true..}
}
}
Answer: D
Section: (none)
Explanation/Reference:
QUESTION 6
You.are.creating.aWindows.Forms.application.by.using.the NET.Framework 3.5. You.write.the.following.code.segment.to.bind.a.list.of.categories.to.a dropdown.list.
.(Line.numbers.are included.for.reference.only.)
01.OleDbConnection.cnnNorthwind.= new.OleDbConnection(connectionString) 02.OleDbCommand.cmdCategory = new.OleDbCommand( "SELECT.CategoryID, CategoryName.FROM. Categories.ORDER.BY CategoryName", cnnNorthwind)
03.OleDbDataAdapter.daCategory = new.OleDbDataAdapter(cmdCategory) 04.DataSet.dsCategory = new.DataSet()
05.daCategory.Fill(dsCategory) 06.
You.need to.ensure.that.the.dropdown.list.meets.the.following.requirements:
Displays.all.category names
Uses.the.category.ID.as.the.selected.item.value
Which.code.segment.should.you add at.line 06
A.ddlCategory.DataSource = dsCategory ddlCategory.DisplayMember = "CategoryName" ddlCategory.ValueMember = "CategoryID"
B.ddlCategory.DataSource = dsCategory.Tables[0]. ddlCategory.DisplayMember = "CategoryName" ddlCategory.ValueMember = "CategoryID"
C.ddlCategory.DataBindings.Add("DisplayMember", dsCategory, "CategoryName") ddlCategory.DataBindings.Add("ValueMember", dsCategory, "CategoryID")
D.ddlCategory.DataBindings.Add("DisplayMember", dsCategory.Tables[0], "CategoryName") ddlCategory.DataBindings.Add("ValueMember", dsCategory.Tables[0], "CategoryID").
Answer: B
Section: (none)
Explanation/Reference:
QUESTION 7
You.are.creating.aWindows.Forms.application.by.using.the NET.Framework 3.5. You.write.a.code.segment.to.connect.to.a.MicrosoftAccess.database.and.populate.a.DataSet. You.need to.ensure.that.the.application.meets.the.following.requirements: It.displays.all.database.exceptions.
It.logs.all.other.exceptions.by using.the.LogExceptionToFile.
Which.code.segment.should.you use
A. try.
{
categoryDataAdapter.Fill(dsCategory)
}
catch.(SqlException.ex)
{
MessageBox.Show(ex.Message,."Exception") LogExceptionToFile(ex.Message)
}
B. try.{ categoryDataAdapter.Fill(dsCategory)} catch.(SqlException.ex)
{
MessageBox.Show(ex.Message,."Exception")..} catch.(Exception.ex)
{
LogExceptionToFile(ex.Message)
}
C. try.{ categoryDataAdapter.Fill(dsCategory)
}
catch.(OleDbException.ex)
{
MessageBox.Show(ex.Message,."Exception")..} catch.(Exception.ex)
{
LogExceptionToFile(ex.Message)
}
D. try.{ categoryDataAdapter.Fill(dsCategory)
}
catch.(OleDbException.ex)
{
MessageBox.Show(ex.Message,."Exception") LogExceptionToFile(ex.Message)
}
Answer: C
Section: (none)
Explanation/Reference:
QUESTION 8
You.are.creating.aWindows.Forms.application.by.using.the NET.Framework 3.5.
You.need to.populate.a.list.box.control.along.with.category.names.by.using.a.DataReader.control. Which.code.segment.should.you use
A.OleDbDataReader.reader
OleDbConnection.cnnNorthwind = new.OleDbConnection( connectionString) cnnNorthwind.Open()
OleDbCommand.cmdCategory = new.OleDbCommand( "SELECT.*.FROM.Categories", cnnNorthwind) reader = cmdCategory.ExecuteReader()
while.(reader.Read())
{
lbCategories.Items.Add(reader["CategoryName"])
}
cnnNorthwind.close()
B.OleDbDataReader.reader
OleDbConnection.cnnNorthwind = new.OleDbConnection( connectionString) cnnNorthwind.Open()
OleDbCommand.cmdCategory = new.OleDbCommand( "SELECT.*.FROM.Orders", cnnNorthwind) reader = cmdCategory.ExecuteReader()
while.(reader.NextResult())
{
lbCategories.Items.Add(reader["CategoryName"])
}
cnnNorthwind.close()
C.OleDbDataReader.reader
OleDbConnection.cnnNorthwind = new.OleDbConnection( connectionString) cnnNorthwind.Open()
OleDbCommand.cmdCategory = new.OleDbCommand( "SELECT.*.FROM.Orders", cnnNorthwind) reader = cmdCategory.ExecuteReader()
cnnNorthwind.Close() while.(reader.Read())
{
lbCategories.Items.Add(reader["CategoryName"])
}
cnnNorthwind.close()
D.OleDbDataReader.reader
using.(OleDbConnection.cnnNorthwind = new.OleDbConnection( connectionString))
{
cnnNorthwind.Open()
OleDbCommand.cmdCategory = new.OleDbCommand( "SELECT.*.FROM.Orders", cnnNorthwind) reader = cmdCategory.ExecuteReader()
}
while.(reader.Read())
{
lbCategories.Items.Add(reader["CategoryName"])
}
cnnNorthwind.close().
Answer: A
Section: (none)
Explanation/Reference:
QUESTION 9
You.are.creating.aWindows.Forms.application.by.using.the NET.Framework 3.5. The.application.stores.a.list.of.part.numbers.in.an.integerbased.array as.shown.in.the.following.code segment (Line.numbers.are.included.for.reference.only.)
01.var.parts = new.int[]
02 {.105, 110, 110, 235, 105, 03 135, 137, 205, 105, 100, 100.} 03 04
05.foreach.(var.item.in.results).{ 06 tbResults.Text.+= item.+."\r\n" 07.}
You.need to.use.a LINQ.to.Objects.query.to.perform the.following.tasks:
Obtain.a.list.of.duplicate.part.numbers.
Order.the.list.by.part.numbers.
Provide.the.part.numbers.and.the.total.count.of.part.numbers.in.the.results.
Which.code.segment.should.you.insert.at.line 04
A.var.results = (from.n.in.parts.orderby.n group.n.by.n.into.n1 select.new.{.n1.Key, count = n1.Count().}). Distinct()
B.var.results = (from.n.in.parts.group.n.by.n.into.n1 where.n1.Count() > 1 orderby.n1 select.new.{.n1.Key, count = n1.Count().})
C.var results = (from.n.in.parts.orderby.n group.n.by.n.into.n1 where.n1.Count() > 1 select.n1)
D.var results = (from.n.in.parts.orderby.n group.n.by.n.into.n1 where.n1.Count() > 1 select.new.{.n1.Key, count = n1.Count().}).
Answer: D
Section: (none)
Explanation/Reference:
QUESTION 10
You.are.creating.aWindows.Forms.application.by.using.the NET.Framework 3.5.
.You.use.LINQ.expressions.to.read.a.list.of.customers.from.the.following.XML.file.
<customers> <customer.id="135".birthDate="4/1/1968">.Paul.Koch.</customer> <customer.id="122".birthDate="7/5/1988">.Bob.Kelly.</customer> <customer.id="044".birthDate="3/24/1990">.Joe.Healy.</customer> <customer.id="982".birthDate="9/15/1974">.Matt Hink.</customer> <customer.id="325".birthDate="1/7/2004"> Tom.Perham.</customer> <customer.id="134".birthDate="9/23/1946">.Jeff.Hay.</customer> <customer.id="653".birthDate="5/15/1947">.Kim.Shane.</customer> <customer.id="235".birthDate="4/24/1979">.Mike.Ray.</customer> </customers>
You.need to.obtain.a.list.of.names.of.customers.who.are.21 years.of.age.or.older.
Which.code.segment.should.you use
A.XDocument.customers = XDocument.Load("Customers.xml")
var results = from.c.in.customers.Descendants("customer") where.((DateTime)c.Attribute("birthDate")). AddYears(21).< DateTime.Now
select.c.Attribute("Name")
B.XDocument.customers = XDocument.Load("Customers.xml")
var results = from.c.in.customers.Descendants("customer") where.((DateTime)c.Attribute("birthDate")). AddYears(21).< DateTime.Now
select.new.{.FullName = c.Value.}
C.XDocument.customers = XDocument.Load("Customers.xml")
var results = from.c.in.customers.Descendants("customer") where.((DateTime)c.Attribute("birthDate")). AddYears(21).< DateTime.Now
select.c.Element("customer")
D.XDocument.customers = XDocument.Load("Customers.xml")
var results = from.c.in.customers.Descendants() where.((DateTime)c.Attribute("birthDate")).AddYears(21). < DateTime.Now
select.new.{.FullName = c.Value.}.
Answer: B
Section: (none)
Explanation/Reference:
QUESTION 11
You.are.creating.aWindows.Forms.application.for.inventory.management.by.using.the NET. Framework.3.5. The.application.provides.a.form.that.allows.users.to.maintain.stock.balances. The.form.has.the.following features:
A dataset.named.dsStockBalance.to.store.the.stock.information business.component.named.scInventory. The.scInventory.component.provides.amethod.named.Save.
You.need to.ensure.that.only the.modified.stock.balances.of.dsStockBalance.are.passed.to.the scInventory. Save.method.
Which.code.segment.should.you use
A.if(dsStockBalance.HasChanges()) dsStockBalance.AcceptChanges() dsUpdates = dsStockBalance.GetChanges() scInventory.Save(dsStockBalance)
B.if(dsStockBalance.HasChanges()) dsUpdates = dsStockBalance.GetChanges() dsStockBalance.AcceptChanges() scInventory.Save(dsStockBalance)
C.if(dsStockBalance.HasChanges()) { dsStockBalance.AcceptChanges() dsUpdates = dsStockBalance.GetChanges() scInventory.Save(dsUpdates).
}
D.if(dsStockBalance.HasChanges()) { dsUpdates = dsStockBalance.GetChanges() dsStockBalance.AcceptChanges() scInventory.Save(dsUpdates).
}
Answer: D
Section: (none)
Explanation/Reference:
QUESTION 12
You.arecreating.aWindows.applicationfor afinancial.services.provider byusing the NETFramework 3.5. You.write.the.following.code.segment.in.the.form (Line.numbers.are.included.for.reference.only.)
01.string.queryString.=
02 "SELECT.CategoryID, CategoryName.FROM.Categories"
03
The.connection.string.for.the.financial.services.database.is.stored.in the.variable.named.connString. You.need to.ensure.that.the.form populates.a.DataGridView.control.named.gridCAT. Which.code.segment.should.you add at.line 03
A.OleDbDataAdapter.adapter.=new.OleDbDataAdapter(queryString,.connString) DataSet.categories.=.new.DataSet()
adapter.Fill(categories,."Categories") gridCAT.DataSource.=.categories.Tables[0].
B.OleDbConnection.conn.=.new.OleDbConnection(connString) conn.Open()..OleDbCommand.cmd.=.new.OleDbCommand(queryString,.conn) OleDbDataReader.reader.=.cmd.ExecuteReader() gridCAT.DataSource.=.reader
C.OleDbDataAdapter.adapter.=new.OleDbDataAdapter(queryString,.connString) DataSet.categories.=.new.DataSet()
adapter.Fill(categories,."Categories") gridCAT.DataSource.=.categories
D.OleDbConnection.conn.= new.OleDbConnection(connString) conn.Open() OleDbCommand.cmd.=.new.OleDbCommand(queryString,.conn) OleDbDataReader.reader.=.cmd.ExecuteReader() gridCAT.DataSource.=.reader.Read().
Answer: A
Section: (none)
Explanation/Reference:
QUESTION 13
You.are.creating.aWindows.Forms.application.that.has.the.print.functionality.by.using.the NET. Framework.3.5.
You.implement.the.PrintPage.page.event.for.the.form You.associate.an.instance.of.the.PrintDocument. control.along.with.an.instance.of.the PrintPreviewDialog.control.named.prevDialog1. You.want.to.set.the.default.size.of.the.PrintPreviewDialog.class.to.full.screen. You.needtoprovideaprintpreview for theuser by.adding acode segment.totheClick.event.of the button on.the. form.
Which.code.segment.should.you use
A.prevDialog1.Width = Screen.PrimaryScreen.Bounds.Width prevDialog1.Height = Screen.PrimaryScreen.Bounds.Height. prevDialog1.ShowDialog()
B.prevDialog1.Width = 1024 prevDialog1.Height = 768 prevDialog1.ShowDialog()
C.prevDialog1.Width = prevDialog1.PrintPreviewControl.Width prevDialog1.Height.= prevDialog1.PrintPreviewControl.Height. prevDialog1.ShowDialog()
D.prevDialog1.Width = prevDialog1.PrintPreviewControl.Width prevDialog1.Height.= prevDialog1.PrintPreviewControl.Height. prevDialog1.Update().
Answer: A
Section: (none)
Explanation/Reference:
QUESTION 14
You.are.creating.aWindows.Forms.application.by.using.the NET.Framework 3.5. You.have.implemented.the.PrintPage.event.to.send.the.page.output.to.the.printer The.users.must.select the. printer.and.the.page.range.before.printing.
You.need to.ensure.that.users.can.print.the.content.of.the.form.by.clicking.the.button.control. Which.code.segment.should.you use
A.PageSetupDialog.pageSetupDialog1 = new.PageSetupDialog() pageSetupDialog1.Document = printDocument1 DialogResult.result = pageSetupDialog1.ShowDialog() if(result.== DialogResult.OK)
{
printDocument1.Print()
}
B.PageSetupDialog.pageSetupDialog1 = new.PageSetupDialog() pageSetupDialog1.Document = printDocument1 DialogResult.result = pageSetupDialog1.ShowDialog() if.(result.== DialogResult.Yes)
{
printDocument1.Print()
}
C.PrintDialog printDialog1 = new.PrintDialog() printDialog1.AllowSomePages = true printDialog1.Document = printDocument1 DialogResult.result = printDialog1.ShowDialog() if.(result.== DialogResult.OK)
{
printDocument1.Print()
}
D.PrintDialog printDialog1 = new.PrintDialog() printDialog1.AllowSomePages = true printDialog1.Document = printDocument1 DialogResult.result = printDialog1.ShowDialog() if.(result.== DialogResult.Yes)
{
printDocument1.Print()
}
Answer: C
Section: (none)
Explanation/Reference:
QUESTION 15
You.are.creating.aWindows.Forms.application.for.the.design.of.circuit.boards.and.electronic. equipment.You.use the NET.Framework 3.5.to.create.the.application. x.that.allows.designers.to.preview.designs.before.printing.them. The.previewed.documents.must.meet.the.following.requirements:
The.graphics.and.text.are displayed.clearly The.fullscale.preview.is.set.as.default.for.the.documents The.zoom.setting.of.the.preview.control.is.adjusted.automatically.when.the.form.is.resized
You.need to.ensure.that.the.requirements.are.met.when.the.form.that.contains.the.custom.print.preview. control.is.displayed
Which.code.segment.should.you use
A.printPreviewControl1.UseAntiAlias = true printPreviewControl1.AutoZoom = true printPreviewControl1.Zoom = 1.0
B.printPreviewControl1.UseAntiAlias = true printPreviewControl1.AutoZoom = true printPreviewControl1.Zoom = 100.0
C.printPreviewControl1.UseAntiAlias = true printPreviewControl1.AutoZoom = false. printPreviewControl1.Zoom = 1.0
D.printPreviewControl1.UseAntiAlias = false. printPreviewControl1.AutoZoom = false. printPreviewControl1.Zoom = 100.0.
Answer: A
Section: (none)
Explanation/Reference:
QUESTION 16
You.are.creating.a.multipledocument.interface.( MDI).application.by.using.the NET.Framework 3.5
You.configure.the.frmParent.form.to.be.an.MDI.parent.
You.write.the.following.code.segment (Line.numbers.are.included.for.reference.only.)
01.Form frmChild = new.Form() 02.Form frmParent = this
03
You.need to.associate.and.display the.frmChild.form and.the.frmParent.form.
.Which.code.segment.should.you add at.line 03
A.frmChild.MdiParent = frmParent. frmChild.ShowDialog()
B.frmChild.MdiParent = frmParent. frmChild.Show()
C.frmChild.IsMdiContainer = true frmChild.ShowDialog()
D.frmChild.IsMdiContainer = true frmChild.Show().
Answer: B
Section: (none)
Explanation/Reference:
QUESTION 17
You.are.creating.aWindows.Forms.application.for.a.courier.company.by using.the NET.Framework 3.5. You.create.a.form.that.allows.customers.to.track.the progress.of.their.shipments The.form.contains.the.following.elements: text.box.named.txtTN.that.allows.users.to.enter.a.tracking.number An.ErrorProvider.control.named. ErrorProvider1.that.informs.users.of.an.invalid.tracking.number function.named.ValidTrackingNumber.that.validates.tracking.numbers.
You.need to.ensure.that.the.txtTN.text.box.is.validated Which.code.segment.should.you use
A.private.void.txtTN_Validating(object.sender, CancelEventArgs.e)
{
if (!ValidTrackingNumber(txtTN.Text))
{
errorProvider1.SetError(txtTN, "InvalidTracking Number") Cancel = true
}
else. errorProvider1.SetError(txtTN, "")
}
B.private.void.txtTN_Validating(object.sender, CancelEventArgs.e)
{
if (!ValidTrackingNumber(txtTN.Text)) errorProvider1.SetError(txtTN, "Invalid.Tracking Number") else.
{
errorProvider1.SetError(txtTN, "") e.Cancel = true
}
}
C.private void.txtTN_Validated(object.sender, EventArgs.e)
{
if (!ValidTrackingNumber(txtTN.Text)) errorProvider1.SetError(txtTN, "Invalid.Tracking Number") else.
{
errorProvider1.SetError(txtTN, "") txtTN.Focus()
}
}
D.private void.txtTN_Validated(object.sender, EventArgs.e)
{
if (!ValidTrackingNumber(txtTN.Text))
{
errorProvider1.SetError(txtTN, "InvalidTracking Number") txtTN.Focus()
}
else. errorProvider1.SetError(txtTN, "")
}
Answer: A
Section: (none)
Explanation/Reference:
QUESTION 18
You.are.creating aWindows.application.by.using.the NET.Framework 3.5 You.create.an.instance.of.the.BackgroundWorker.component.named.backgroundWorker1.to asynchronously. process.timeconsuming.reports.in.the.application
You.write.the.following.code.segment.in.the.application (Line numbers.are.included.for.reference.only.)
01.private.void backgroundWorker1_RunWorkerCompleted( object.sender, RunWorkerCompletedEventArgs. e)
02.{. 03 04.}.
You.need to.write.a.code.segment.that.reports.to the.application.when.the.background.process.detects. any.of.the.following.actions:
An.exception.is.thrown The.process.is.cancelled.
.The.process.is.successfully.completed Which.code.segment.should.you.insert.at.line 03
A.if.(e.Cancelled.== null) MessageBox.Show("Report.Cancelled") else MessageBox.Show("Report.Completed")
B.if.(e.Result.== "Cancelled".||.e.Result.== "Error") MessageBox.Show("Report.Cancelled")
else MessageBox.Show("Report.Completed")
C.if (backgroundWorker1.CancellationPending) MessageBox.Show("Report.Cancelled"). else. MessageBox.Show("Report.Completed")
D.if (e.Error != null) MessageBox.Show(e.Error.Message) else.if.(e.Cancelled) MessageBox.Show("Report.Cancelled") else. MessageBox.Show("Report.Completed").
Answer: D
Section: (none)
Explanation/Reference:
QUESTION 19
You.are.creating.aWindows.Forms.application.by.using.the NET.Framework 3.5
The.application.requires.a.thread.that.accepts.a.single.integer.parameter
You.write.the.following.code.segment (Line.numbers.are.included.for.reference.only.)
01.Thread.myThread = new Thread(new.ParameterizedThreadStart(DoWork)) 02.myThread.Start(100)
03
You.need to.declare.the.method.signature.of.the.DoWork.method.
.Which.method.signature.should.you.use
A.public.void.DoWork()
B.public.void.DoWork(int.nCounter)
C.public.void.DoWork(object.oCounter)
D.public.void.DoWork(Delegate.oCounter)
Answer: C
Section: (none)
Explanation/Reference:
QUESTION 20
You.are.creating.aWindows.application.by.using.the NET.Framework 3.5 You.plan.to.create a.form.that.might.result.in.a.timeconsuming.operation.
.You.use.the QueueUserWorkItem method.and a.Label.control.named.lblResult.
.You.need to.update.the.users.by.using.the.lblResult.control.when.the.process.has.completed.the operation Which.code.segment.should.you use
A.private void.DoWork(objectmyParameter)
{
//.thread.work.this.Invoke(new MethodInvoker(ReportProgress))..
}
privatevoid.ReportProgress()
{
this.lblResult.Text.=."Finished.Thread"
}
B.private void.DoWork(objectmyParameter)
{
//.thread.work.this.lblResult.Text.=."Finished.Thread"
}
C.private void.DoWork(objectmyParameter)
{
//.thread.work.System.Threading.Monitor.Enter(this)..this.lblResult.Text.=."Finished.Thread". System.Threading.Monitor.Exit(this)
}
D.private void.DoWork(objectmyParameter)
{
//.thread.work.System.Threading.Monitor.TryEnter(this)..ReportProgress()..
}
private void.ReportProgress()
{
this.lblResult.Text.=."Finished.Thread"
}
Answer: A
Section: (none)
Explanation/Reference:
QUESTION 21
You.are.creating.aWindows.Forms.application.by.using.the NET.Framework 3.5 You.create.a new.form.in.your.application You.add.100.controls.at.run.time.in.the.Load.event.handler.of.the.form Users.report.that.the.form.takes.a.long.time.to.get.displayed
You.need to.improve.the.performance.of.the.form. What.should.you.do
A.Call.the.InitLayout.method.of.the.form before.adding.all.the.controls Call.the.PerformLayout.method.of.the.form.after.adding.all.the.controls.
B.Call.the.InitLayout.method.of.the.form before.adding.all.the.controls Call.the.ResumeLayout.method.of.the.form.after.adding.all.the.controls
C.Call.the.SuspendLayout.method.of.the.form before.adding.all.the.controls Call.the.PerformLayout.method.of.the.form.after.adding.all.the.controls
D.Call.the.SuspendLayout.method.of.the.form before.adding.all.the.controls Call.the.ResumeLayout.method.of.the.form.after.adding.all.the.controls.
Answer: D
Section: (none)
Explanation/Reference:
QUESTION 22
You.are.creating.aWindows.Forms.application.by.using.the NET.Framework 3.5 The application.is. used.by a.financial.service.provider You.discover.that.the.service.provider.transfers.large.amounts.of.data.by.using.XML.
You.need to.read.and.validate.the.XMLdocuments.in.the.most.timeefficient.manner Which.technology.should.you.use
A.The.XmlReader.class.
B.The.XmlDocument.class.
C.The.XmlResolver.class.
D.The.LINQ.to.XML.method
Answer: A
Section: (none)
Explanation/Reference:
QUESTION 23
You.are.creating.aWindows.Forms.application.by.using.the NET.Framework 3.5 The.application.is.configured.to.use.rolebased.security.
You.need.to ensure.that.users.can.print.reports.only by.selecting.a.printer.from.the.printer.dialog.box You want.to.achieve.this.goal.by.using.the.minimum.level.of.permission.
Which.code.segment.should.you use
A.[System.Drawing.Printing.PrintingPermission (System.Security.Permissions.SecurityAction.Demand, Level=System.Drawing.Printing.PrintingPermissionLevel.AllPrinting)]
B.[System.Drawing.Printing.PrintingPermission (System.Security.Permissions.SecurityAction.Demand, Level=System.Drawing.Printing.PrintingPermissionLevel.NoPrinting)].
C.[System.Drawing.Printing.PrintingPermission (System.Security.Permissions.SecurityAction.Demand, Level=System.Drawing.Printing.PrintingPermissionLevel.DefaultPrinting)].
D.[System.Drawing.Printing.PrintingPermission (System.Security.Permissions.SecurityAction.Demand, Level=System.Drawing.Printing.PrintingPermissionLevel.SafePrinting)]
Answer: D
Section: (none)
Explanation/Reference:
QUESTION 24
You.are.creating.aWindows.Forms.application.by.using.the NET.Framework 3.5. The.application.displays.employee.names.by.using.the.TreeView.control You.need to.implement.the.draganddrop.functionality.in the TreeView.control.
Which.two.actions.should.you.perform (Each.correct.answer.presents.part.of.the.solution Choose.two.)
A.Set.theAllowDrag.property.to.true Create.an.event.handler.for.the.DragOver.event.
B.Set.theAllowDrag.property.to.true Create.an.event.handler.for.the.ItemDrag.event.to.call.the DoDragDrop method
C.Set.theAllowDrag property.to.true Create.an.event.handler.for.the.DragEnter.event.to.call.the DoDragDrop method
D.Create.an.event.handler.for.the.DragDrop.event.to.handle.the.move.or.copy.by.itself
E.Create.an.event.handler.for.the.DragEnter.event.to.handle.the.move.or.copy.by.itself.
Answer: BD
Section: (none)
Explanation/Reference:
QUESTION 25
You.are.creating.aWindows.Forms.application.by.using.the NET.Framework 3.5.
You.have.resource.files.in.five.different.languages
You.need to.test.the.application.in.each.language.
What.should.you.do
A.Set.the.CurrentCulture.property.explicitly.to.the.respective.culture.for.each.language
B.Set.the.CurrentCulture.property.explicitly.to.IsNeutralCulture.for.each.language
C.Set.the.CurrentUICulture.property.explicitly.to.IsNeutralCulture.for.each.language
D.Set.the.CurrentUICulture.property.explicitly.to.the respective.culture.for.each.language.
Answer: D
Section: (none)
Explanation/Reference:
QUESTION 26
You.are.creating.aWindows.Forms.application.by.using.the NET.Framework 3.5 You.plan.to deploy.the application.inmultiple.countries.and.languages You.need to.ensure.that.the.application.meets.the.globalization.requirements
Which.two.actions.should.you.perform (Each.correct.answer.presents.part.of.the.solution Choose.two.)
A.Handle.server.names.and.URLs.as.ASCII.data
B.Use.Unicode.strings.throughout.the application.
C.Use.the.NumberFormatInfo.class.for.numeric.formatting
D.Handle.strings.as.a.series.of.individual.characters.instead of.entire.strings
E.Avoid.usage.of.the.SortKey.class.and the.CompareInfo.class.for.sorting purposes.
Answer: BC
Section: (none)
Explanation/Reference:
QUESTION 27
You.are.creating.aWindows.Forms.application.for.a.financial.service.provider.by.using.the NET. Framework.3.5
You.have.to.implement.a multiple document.interface.(MDI).in.the.application.to.allow.users.to.open multiple. financial.documents.simultaneously.
You.need to.ensure.that.whenever.the.child.MDI.form is.created, the.application.displays.a.message.in the. title.bar.of.the.parent.MDI.that.a.child.form.has.received.focus.
What.should.you.do
A.Implement.theActivated.event.
B.Implement.the.MdiChildActivate.event.
C.Override.the.OnParentVisibleChanged.method.
D.Override.the.OnParentBindingContextChanged.method.
Answer: B
Section: (none)
Explanation/Reference:
QUESTION 28
You.are.creating.aWindows.application.by.using.the NET.Framework 3.5. You.add.a.BackgroundWorker.component.to.aWindows.form.to.handle.a.timeconsuming.operation. You.add.a.Cancel.button.to.the.form.
You.need to.ensure.that.when.the.Cancel.button.is.pressed, the.background.task.is.cancelled. What.should.you.do
A.Set.the.DoWorkEventArgs.Cancel.property.to.False.in.the.DoWork.event.handler.of.BackgroundWorker.
B.Call.the.BackgroundWorker.CancelAsync() method.from.the.OnClick.event.handler.of.the.Cancel.button.
C.Call.the.BackgroundWorker.CancelAsync().method.from.the.DoWork.event.handler.of.the BackgroundWorker.
D.Stop.the.process.in.the.OnClick.event.handler.of.the.Cancel.button.if.the BackgroundWorker. CancellationPending.property.is.True.
Answer: B
Section: (none)
Explanation/Reference:
QUESTION 29
You.are.creating.aWindows.application.for graphical.image.processing by.using.the NET.Framework 3.5. You.create.an.image.processing.function.and.a delegate You.plan.to.invoke.the.image.processing function.by. using.the delegate.
You.need to.ensure.that.the.calling.thread.meets.the.following.requirements: It.is.not.blocked.when.the.delegate.is.running. It.is.notified.when.the.delegate.is.complete.
What.should.you.do
A.Call.the.Invoke.method.of.the.delegate.
B.Call.the.BeginInvoke.and.EndInvoke.methods.of.the.delegate.in.the.calling.thread.
C.Call.the.BeginInvoke.method.by.specifying.a.callback.method.to.be.executed.when.the.delegate.is. complete Call.the.EndInvoke.method.in.the.callback.method.
D.Call.the.BeginInvoke.method.by.specifying.a.callback.method.to.be.executed.when.the.delegate.is. complete Call.the.EndInvoke.method.of.the.delegate.in.the.calling.thread.
Answer: C
Section: (none)
Explanation/Reference:
QUESTION 30
You.are.creating.aWindows.Forms.application.by.using.the NET.Framework 3.5.
You.plan.to develop.a.custom.control.for.the.application The.control.will.be.a.composite.control. Your.need.to.derive.from.the.class.that.will.create.the.control.by using.the.minimum.amount.of. development.effort.
What.should.you.do
A.Derive from.the.Control.class.
B.Derive from.the.UserControl.class.
C.Derive.from.the.FrameworkElement.class.
D.Derive.from.the.ContainerControl.class.
Answer: B
Section: (none)
Explanation/Reference:
QUESTION 31
You.are.creating.aWindows.Forms.application.by.using.the NET.Framework 3.5. You.plan.to develop.a.new.control.for.the.application.
You.need to.ensure.that.the.control.extends.the.DataGridView.control.by.allowing.the.cells.to.contain multicolored.text.
What.should.you.do
A.Override.the.OnPaint.method.
B.Write.a.code.segment.to.handle.the.CellPainting.event.
C.Write.a.code.segment.to.handle.the.CellParsing.event.
D.Write.a.code.segment.to.handle.the.RowPostPaint.event.
Answer: B
Section: (none)
Explanation/Reference:
QUESTION 32
You.are.creating.aWindows.Forms.application.by.using.the NET.Framework 3.5. You.plan.to develop.a.new.control.for.the.application.
You.need to.ensure.that.the.control.extends.the.TreeView.control.by.adding.a.custom.node.tag.and.a highlight.color.
What.should.you.do
A.Override.the.OnPaint.method.
B.Write.a.code.segment.in.the.DrawNode.event.handler.to.specify.the.highlight.color.
C.Set.the.DrawMode.property.of.the.control.to.OwnerDrawAll, and.then.implement.a.custom DrawNode event.handler.
D.Set.the DrawMode property of the control.to OwnerDrawText,and then implement.a custom DrawNode event.handler.
Answer: D
Section: (none)
Explanation/Reference:
QUESTION 33
You.are.creating.aWindows.Forms.application.by.using.the NET.Framework 3.5.
You.plan.to develop.a.new.control.for.the.application The.control.will.have.the.same.properties.as.a TextBox. control.
You.need to.ensure.that.the.control.has.a.transparent.background.when.it.is.painted.on form You.want.to.achieve.this.goal.by.using.the.minimum.amount.of.development.effort. What.should.you.do
A.Create.a new.class.that.is.derived.from.the.Control.class. Call.the.SetStyle.method.in.the.constructor.
B.Create.a new.class.that.is.derived.from.theTextBox.control.class. Override.the.OnPaint.method.in.the.constructor.
C.Create.a.new.class.that.is.derived.from.the.Control.class. Set.the.BackColor.property.of.the.control.to.Transparent. Call.the.SetStyle.method.in.the.constructor.
D.Create.a.new.class.that.is.derived.from.theTextBox.control.class. Set.the.BackColor.property.of.the.control.to.Transparent.in.the.constructor. Call.the.SetStyle.method.in.the.constructor.
Answer: D
Section: (none)
Explanation/Reference:
QUESTION 34
You.createWindows.Forms.applications.by.using.the NET.Framework 3.5. You.plan.to deploy.a.new.application.
You.need to.ensure.that.on.deployment, the application.meets.the.following requirements: It.is.executed.on.the.client.computer. It.is.removed.from.the.client.computer.after.the.application.is.closed. It.is.not.displayed.in.theAdd/Remove.programs.panel.on.the.client.computer. What.should.you.do
A.Deploy.the.application.to.a.central.network.server. Access.the.application.by.using.the.Remote.Desktop.Connection.tool.
B.Deploy.the.application.by.using.the.ClickOnce.technology. Use.the.Mage.exe.tool.to.set.the.Online.Only.option in.the.deployment.manifest.
C.Deploy.the application.by.using.the.ClickOnce.technology. Set.the.Install.attribute.of.the deployment.tag.to.true in.the.deployment.manifest.
D.Deploy.the application.to.a.CDROM.by.using.the.ClickOnce.technology. Execute.the.application.from.the.CDROM.
Answer: B
Section: (none)
Explanation/Reference:
QUESTION 35
You.createWindows.Forms.applications.by.using.the NET.Framework 3.5.
You.plan.to deploy.a.new Windows.Presentation.Foundation.(WPF).XAML.browser.application.(XBAP). The.deployment.must.meet.the.following.requirements:
shortcut.is.added.to.the.Start.menu. The.most.recent.version.of.the.application.is.installed.and.executed on.client.computers. Users.can.uninstall.the.application.from.the.control.panel.
You.need.to.identify.a.deployment.technology.that.meets.the.specified.requirements You.want.to.achieve this. goal.by.using.the.minimum.amount.of.development.effort.
Which.deployment.technology.should.you use
A.XCOPY
B.ClickOnce
C.MicrosoftWindows.Installer
D.Remote.Desktop.connections
Answer: B
Section: (none)
Explanation/Reference:
QUESTION 36
You.createWindows.Forms.applications.by.using.the NET.Framework 3.5.
You.plan.to use.theWindows.Installer.to.deploy.a.new.application.
The.applicationmust.meet.the.following.requirements:
Support.deployment.to.32bit.and.64bit.operating.systems.
Use.the.64bit.Program.Files.folder when.deployed.to.64bit.platforms.
You.need to.ensure.that.the.application.is.deployed appropriately.
What.should.you.do
A.Create.a.single.MSI.file.
.Add.a.launch.condition.that.is.set.to.Version.NT64.
B.Create.a.single.MSI.file. Add.a.launch.condition.that.is.set.to.NOT.Version.NT64.
C.Create.an.MSI.file.that.is.targeted.to.64bit.platforms. Create.an.MSI.file.that.is.targeted.to.32bit.platforms.
D.Create.a.single.MSI.file. Create.a.mergemodule.that.contains.the 32bit.and 64bit.code.
Answer: C
Section: (none)
Explanation/Reference:
QUESTION 37
You.createWindows.Forms.applications.by.using.the NET.Framework 3.5.
You.plan.to use.a.setup.project.to.deploy.a new Windows.Forms.application The.application.uses.a component.that.requires.the.Microsoft NET.Framework.1.1.
You.need to.create.a.launch.condition.so.that.the.application.can.be.deployed.on.client.computers. What.should.you.do
A.Use.the.Depth.property.
B.Use.the.Version.property.
C.Use.the.MinVersion.property.
D.Use.the.ComponentID.property.
Answer: B
Section: (none)
Explanation/Reference:
QUESTION 38
You.createWindows.Forms.applications.by.using.the NET.Framework 3.5.
You.plan.to deploy.a.new.application.by.using.the.ClickOnce.deployment.technology. The.application.is. signed.by.using.a.certificate.obtained.from.a.trustworthy.authority.
You.need to.ensure.that.the.application.can.be.deployed.as.a.trusted application.to Windows.Vista.client. computers.on.a.corporate.network.
What.should.you.do
A.Create.a.manifest.and.set.the.RequestedExecutionLevel.level.attribute.toAsInvoker.
B.Create.a.manifest.and.set.the.RequestedExecutionLevel.level.attribute.toAsAdministrator.
C.Create a.new certificatetrust.list.(CTL) Install the.CTL on the server that.has.the ClickOnce application published.
D.Create.a.new.certificate.trust.list.(CTL) Request.the.network.administrator.to.deploy.the.CTL.by using Group.Policy.
Answer: D
Section: (none)
Explanation/Reference:
QUESTION 39
You.createWindows.Forms.applications.by.using.the NET.Framework 3.5.
You.create.a new.application.forWindows.Vista.client.computers The.application.requires.elevated access.to. read.files.from the.local.file.system.
You.need to.ensure.that.the.application.requires.elevated.permissions.on.execution. What.should.you.do
A.Create.a new.certificate.trust.list.(CTL). Use.the.CertMgr.exe.tool.to.install.the.CTL.on.the.local.computer.
B.Create.a new.certificate.trust.list.(CTL). Install.the.CTL.on.the.server.that.has.the.ClickOnce application.published
C.Create.a.manifest.that.includes.the.<requestedExecutionLevel.level="asInvoker"/>.tag. Add.the.manifest.to.the.executable.file.of.the.application.
D.Create.a.manifest.that.includes.the.<requestedExecutionLevel.level="requireAdministrator"/>.tag. Add.the.manifest.to.the.executable.file.of.the.application.
Answer: D
Section: (none)
Explanation/Reference:
QUESTION 40
You.create Windows.Forms.applications.by.using.the..NET.Framework.3.5. You.plan.to deploy.a.new.application.by.using.the.ClickOnce.technology. During.deployment,.the application.performs.the.following.tasks: Modifies.registry.keys. Modifies.the.files.located.in.the.%PROGRAM.FILES%.folder Administrative.permissions.are.not.granted.to.users.who.install.the.application. You.need to.ensure.that.the.following.requirements.aremet:
The.application.can.be.deployed.toWindows.Vista.client.computers.that.are.not.part.of.an Active Directory.domain. When.the.application.is.deployed,.users.are.not.prompted.to.elevate.their.permissions. What.should.you.do?
A.Create.a.manifest.and.set.the.RequestedExecutionLevel.level.attribute.to AsInvoker.
B.Create.a.manifest.and.set.the.RequestedExecutionLevel.level.attribute.to As Administrator.
C.Create.a.new.certificate.trust.list.(CTL)..Use.the.CertMgr.exe.tool.to.install.the.CTL.on the.local.computer.
D.Createa.new certificate trust.list.(CTL)..Install the.CTL.on the server that.has.theClickOnce application. published.
Answer: C
Section: (none)
Explanation/Reference:
0 Reply:
Post a Comment