Q1. You are developing a new application that optimizes the processing of a warehouse’s operations. When the products arrive, they are stored on warehouse racks. To minimize the time it takes to retrieve an item, the items that arrive last are the first to go out. You need to represent the items that arrive and leave the warehouse in a data structure. Which data structure should you use to represent this situation?
A. array
B. linked list
C. stack
D. queue
Answer: C
Q2. Which of the following is not true about linked lists?
A. A linked list does not allow random access to its items.
B. A link to the head node can help you locate all the nodes in a linked list.
C. The items in a linked list must be stored in contiguous memory locations.
D. Linked lists are extremely fast in performing insert and delete operations.
Answer: C
Q3. You are developing an application that needs to copy data from a SQL Server table to a DataSet. Which of the following methods should you use to copy the data?
A. Fill
B. FillSchema
C. GetFillParameters
D. Update
Answer: A
Q4. You are developing a C# program for a bike rental company. The data is stored in a SQL Server 2000 server named BikeServer in a database named BikeDB. You must use the Windows Integrated authentication to connect to the BikeDB database. Which of the following connection strings should you choose in your C# program for connecting to the BikeDB database?
A. "Provider=SQLOLEDB;Data Source=BikeServer;InitialCatalog=BikeDB;Integrated Security=SSPI;"
B. "Provider=SQLOLEDB;Data Source=BikeServer;InitialCatalog=BikeDB;User Id=sa; Password=gih6774y"
C. "Data Source=BikeServer;InitialCatalog=BikeDB;Trusted_Connection=true;"
D. "Data Source=BikeServer;InitialCatalog=BikeDB;User Id=sa;Password=gih6774y"
Answer: A
Q5. You are developing a new application that optimizes the processing of a manufacturing plant’s operations. You need to implement a data structure that works as a “buffer” for overflow capacity. When the manufacturing capacity is available, the items in the buffer need to be processed in the order in which they were added to the buffer. Which data structure should you use to implement such buffer?
A. array
B. linked list
C. stack
D. queue
Answer: D
Q6. You are developing an algorithm before you write the C# program. You need to perform some calculations on a number. You develop the following flowchart for the calculation:
If the input value of n is 5, what is the output value of the variable fact according to this flowchart?
A. 720
B. 120
C. 24
D. 6
Answer: B
Q7. You develop a new ASP.NET inventory application on the Northwind Web server. You deploy the files in the folder c:\WebInventory. The application should be available via the URL www.northwind.com/inventory. The URL www.northwind.com is already set up to point to the Northwind Web server. What should you do to make your inventory application available at the expected URL?
A. Change the name of the directory c:\WebInventory to c:\Inventory.
B. Create a virtual directory named Inventory and point it to c:\WebInventory.
C. Create a virtual directory named WebInventory and point it to c:\Inventory.
D. Move the directory c:\WebInventory to the c:\inetput\wwwroot directory.
Answer: B
Q8. You are creating a new class named Sphere derived from the Shape class. The Shape class has the following code:
class Shape
{
public virtual void Area()
{
// additional code...
}
}
The Area method in the Shape class should provide new functionality but also hide the Shape class implementation of the Area method. Which code segment should you use to accomplish this?
A. class Sphere : Shape
{
public override void Area()
{
// additional code ...
}
}
B. class Sphere : Shape
{
public new void Area()
{
// additional code ...
}
}
C. class Sphere : Shape
{
public virtual void Area()
{
// additional code ...
}
}
D. class Sphere : Shape
{
public static void Area()
{
// additional code ...
}
}
Answer: B
Q9. You are updating an existing Windows Forms application. The form hosts a DateTimePicker control named dateTimePicker1. You need to write code that executes when the value of the dateTimePicker1 control is changed. You write a method, ProcessValueChanged, that contains the code you want to execute. What code should you write to invoke the ProcessValueChanged method? Any code that your write must not affect existing functionality of the application.
A. dateTimePicker1.ValueChanged += new System.EventHandler( ProcessValueChanged);
B. dateTimePicker1.ValueChanged = new System.EventHandler( ProcessValueChanged);
C. dateTimePicker1.Value += new System.EventHandler( ProcessValueChanged);
D. dateTimePicker1.Value = new System.EventHandler( ProcessValueChanged);
Answer: A
Q10. You are writing a C# program that iterates through a collection such as arrays and lists. You need to make sure that you process each item in the collection once. You also need to ensure that your code is easy to read and debug. Which of the following C# statements provide the best solution for this requirement?
A. while
B. for
C. foreach
D. do-while
Answer: C
Q11. You need a Windows Form similar to the W_RecForm form that is being already used by the application. However, you need a couple of extra controls on your form that are not available on W_RecForm. You need to make sure that you accomplish this requirement with the least coding effort. In future, if the W_RecForm is enhanced, you need to make sure that those enhancements are available in your form as well. What should you do?
A. Copy the code for W_RecForm to a new form. Modify the code for the new form.
B. Use visual inheritance to inherit the new form from W_RecForm. Add the new functionality to the newcontrol.
C. Modify the code for W_RecForm. Copy the code to create a new form.
D. Convert the code in the W_RecForm to a custom control. Use the new custom control in all places.
Answer: B
Q12. Which of the following languages is not considered a high-level programming language?
A. C#
B. Visual Basic
C. Common Intermediate Language
D. C++
Answer: C
Q13. As you design a database for your company, you review the normalization rules for the database tables. You need to ensure that your table design meets the requirements for the third normal form. Which of the following statements must be true for your tables? (Choose all that apply.)
A. None of the columns in the table should have multiple values in the same row of data.
B. All non-key columns are functionally dependent on the entire primary key.
C. At least one non-key column is functionally dependent on the entire primary key.
D. Non-key attributes don’t share any functional dependency.
E. Non-key attributes share functional dependency.
Answer: ABD
Q14. The application you are developing needs to write data to a flat file that include items such as a five-digit integer key, followed by a 20-character customer name, followed by two date and time fields. Your solution should be as fast as possible and should create smallest size data file. Which of the following classes should you use?
A. FileStream
B. StreamWriter
C. BinaryWriter
D. DataWriter
Answer: C
Q15. You are writing code to handle events in your program. You define a delegate named PolygonHandler like this:
public delegate void PolygonHandler(Polygon p);
You also create a variable of the PolygonHandler type as follows:
PolygonHandler handler;
Later in the program, you need to add a method named CalculateArea to the method invocation list of the handler variable. The signature of the CalculateArea method matches the signature of the PolygonHandler method. Any code that you write should not affect any existing event-handling code. Given this restriction, which of the following code lines should you write?
A. handler = new PolygonHandler(CalculateArea);
B. handler = CalculateArea;
C. handler += CalculateArea;
D. handler -= CalculateArea;
Answer: C
Q16. You are developing a C# program. You write the following code:
int i = 6;
do
{
if (i == 3)
break;
Console.WriteLine("The value of i = {0}", i);
i++;
}
while (i <= 5);
How many times will the control enter the while loop?
A. 0
B. 1
C. 2
D. 3
Answer: B
Q17. You are planning to develop a new software system for your organization. You need to verify that the implementation of the system matches with the requirements of the system. Which of the following activities would accomplish this requirement?
A. testing
B. design
C. release
D. requirements analysis
Answer: A
Q18. You need to develop a C# program that exports the contents of the Customers table to an XML file. The exported data must be in the following format:
<Customer CustomerID="ALFKI" ContactName="Maria Anders" Phone="030-007-4321" />
<Customer CustomerID="ANATR" ContactName="Ana Trujillo" Phone="(5) 555-4729" />
Which of the following code segments should you use to export the Customers table to the specified XML format?
A. foreach(DataColumn c in dataset1.tables["Customers"].Columns)
{
B. ColumnMapping = MappingType.Attribute;
}
dataSet1.WriteXml("Customers.xml");
C. foreach(DataColumn c in dataset1.tables["Customers"].Columns)
{
D. ColumnMapping = MappingType.Element;
}
dataSet1.WriteXml("Customers.xml");
E. foreach(DataColumn c in dataset1.tables["Customers"].Columns)
{
F. ColumnMapping = MappingType.Attribute;
}
dataSet1.WriteXml("Customers.xml", XmlWriteMode.WriteSchema);
G. foreach(DataColumn c in dataset1.tables["Customers"].Columns)
{
H. ColumnMapping = MappingType.Element;
}
dataSet1.WriteXml("Customers.xml", XmlWriteMode.WriteSchema);
Answer: A