Q1. You are developing a new Windows application that needs to write messages to the event log. You use the EventLog class to write these messages. Each event log message must specify the name of the application writing to an event log. Which property of the EventLog class should you use?
A. Source
B. Log
C. Site
D. MachineName
Answer: A
Q2. You are writing a C# program and need to select an appropriate repetition structure for your requirement. You need to make sure that the test for the termination condition is performed at the bottom of the loop rather than at the top. Which repletion structure should you use?
A. The while statement
B. The for statement
C. The foreach statement
D. The do-while statement
Answer: D
Q3. 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
Q4. 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
Q5. Suppose that you are a new C# developer and are reviewing object-oriented programming fundamentals.
Which of the following statements is not true?
A. A class is a concrete instance of an object.
B. A class defines the template for an object.
C. A class is a definition of a new data type.
D. A constructor is used to initialize the data members of the object.
Answer: A
Q6. You are writing a C# program. You write the following method:
public static void TestSwitch(int op1, int op2, char opr)
{
int result;
switch (opr)
{
case '+':
result = op1 + op2;
case '-':
result = op1 - op2;
case '*':
result = op1 * op2;
case '/':
result = op1 / op2;
default:
Console.WriteLine("Unknown Operator");
return;
}
Console.WriteLine("Result: {0}", result);
return;
}
However, when you compile this code, you get the following error message:
Control cannot fall through from one case label to another
How should you modify the code to make sure that it compiles successfully?
A. After each case, add the following code line: break;
B. After each case, add the following code line: continue;
C. After each case, add the following code line: goto default;
D. After each case, add the following code line: return;
Answer: A
Q7. You are invoking a Web service method that returns an ArrayList object. The client application is written is C#, whereas the Web service is written in Visual Basic. The Web service is outside your corporate firewall. You receive an "object not found" error when you call the method that returns the ArrayList object but can call other methods successfully from the same Web service. What could be the problem?
A. The client and the Web service are not written in the same programming language.
B. The firewall is blocking all SOAP calls.
C. The client project does not contain a reference to the System.Collection namespace.
D. The ArrayList class cannot be serialized.
Answer: C
Q8. 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
Q9. 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
Q10. Suppose that you are writing code for a class named Product. You need to make sure that the data members of the class are initialized to their correct values as soon as you create an object of the Product class. The initialization code should always be executed. What should you do?
A. Create a static method in the Product class to initialize data members.
B. Create a constructor in the Product class to initialize data members.
C. Create a static property in the Product class to initialize data members.
D. Create an event in the Product class to initialize data members.
Answer: B