3COM certification 3COM
Adobe certification Adobe
Apple certification Apple
Avaya certification Avaya
BEA certification BEA Systems
Business Objects certification Business Objects
Check Point certification CheckPoint
Cisco certification Cisco
Citrix certification Citrix
CIW certification CIW
COGNOS certification COGNOS
CompTIA certification CompTIA
CWNP certification CWNP
EC-Council certification EC-Council
EMC certification EMC
Exam Express certification Exam Express
Exin certification Exin
F5 Networks certification F5 Networks
H3C certification H3C
HDI certification HDI
HP certification HP
Hitachi certification Hitachi
IBM certification IBM
Isaca certification Isaca
ISC certification ISC
ISEB certification ISEB
Juniper certification Juniper Networks
Lotus certification Lotus
LPI certification LPI
Microsoft certification Microsoft
Mile2 certification Mile2
Network Appliance certification Network Appliance
Nortel certification Nortel
Novell certification Novell
Oracle certification Oracle
PMI certification PMI
RedHat certification RedHat
RSA certification RSA Security
SAIR certification SAIR
SAS certification SAS Institute
SNIA certification SNIA
Sun certification Sun
Sybase certification Sybase
Symantec certification Symantec
Teradata certification Teradata
Tibco certification Tibco
Veritas certification Veritas
VMware certification VMware
All Exams

Microsoft 70-505 Exam - CertifySky.com

Free 70-505 Sample Questions:

1. You are creating a Windows 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

2. You are creating a Windows 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 are met:
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

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 named ctxMenu 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 top-level 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

4. You are creating a Windows 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

5. You are creating a Windows 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

6. You are creating a Windows Forms application by using the .NET Framework 3.5.
You write the following code segment to bind a list of categories to a drop-down 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 drop-down 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

7. You are creating a Windows Forms application by using the .NET Framework 3.5.
You write a code segment to connect to a Microsoft Access 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

8. You are creating a Windows 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

9. You are creating a Windows Forms application by using the .NET Framework 3.5.
The application stores a list of part numbers in an integer-based 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 };
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

10. You are creating a Windows 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