Skip to main content

Test Your .NET Knowledge

Q1. “Crushader” company wants to revamp his website. One of the important changes “Crushader” want is to display Ad banners. As a developer, you want to initialize the banner image paths when the first user accesses the application. So what will you do?
1. Add code in application_onstart event of global. Sax file.
2. Add code in application begin request event of global. Sax file.
3. Add code to session_onstart event of global. Sax.
4. Add code in page. Load event handler in the startup page of the application.
5. Create a user control named “Banner.ascx” and initialize all the image paths in this ascx. Then include this banner.ascx in all the pages of the application, which needs the banner displays.
Answer 1.

Q2 Which one of the following is a limitation of XML serialization?
A. In classes that implement IEnumerable, the collection is not serialized.
B. You cannot serialize an object's public fields.
C. You cannot serialize Dataset objects.
D. You cannot serialize XmlNode object.
E. It does not serialize type information.
Answer E
XML serialization does not include type information. For example, if you have a Customer object that exists in the Library namespace, there is no guarantee that it will be deserialized into an object of the same type.

Q3 which one of the following occurs when a struct type is cast to an interface that it implements?
A. The original value type variable is destroyed.
B. A trappable InvalidCastException runtime error occurs.
C. A compiler error occurs; struct types cannot implement an interface.
D. The struct type is boxed and a new reference type created.
E. The original value type is cloned using the Value Type class' implementation of IClonable.
Answer D But yes you can implement interface in structures. As interface can be, only reference types so it will boxed.

Q4
internal class Piston {}
internal class Engine
{
private Piston[] myPistons = new Piston[4];
public bool Ignition() {
//some code
}
}
public class Car
{
private Engine myEngine = new Engine();
public void Start()
{
//put in keys etc..
if (myEngine.Ignition()) {
//some more code

What concept does the above sample code demonstrate?
A. Delegation
B. Composition
C. Polymorphism
D. Combination
E. Inheritance
Answer B

Q5. As a developer, you are displaying product data from SQL Server. Product table has Productid and Product Name. You write ADO.NET code that uses a SqlDataAdapter object and a SqlCommand object to retrieve the product data from the database by calling a stored procedure. You set the Command Type property of the SqlCommand object to CommandType.StoredProcedure. You set the Command Text property of the object to procProductList. Your code successfully files a DataTable object with a list of products that is sorted by ProductID in descending order.
You want the data to be displayed in reverse alphabetic order by Product Name.
What should you do?
A. Set the command text to "SELECT * FROM procProductList ORDER BY ProductName DESC;" then bind the Data Grid control to the DataTable object.
B. Create a new Data View object based on the DataTable object.
C. Set the Sort Property of the Data View object to “ProductName DESC”.
D. Bind the Data Grid control to the Data View object.
E. Set the Allow Sorting property of the Data Grid control to True.
F. Set the Sort Expression property of the DataGridColumn that displays ProductName to bind the Data Grid control to the DataTable object.
G. Set the Display Expression property of the DataTable object to “ORDER BY ProductName DESC”. Bind the DataGrid control to the DataTable object.
Answer: - A

Q6. What is the fastest way to concat strings in ASP.NET? What should you do?
A. Write code that uses the Append method of the String Builder object.
B. Write code that uses the Substring method of the String object.
C. Write code that uses the Concat method of the String object.
D. Write code that uses the plus sign (+) operator to concatenate the strings.
Answer: - A

Q7. "Virtual Software public limited" wants to connect to SQL Server 6.5 using ASP.NET.
A. Use a SqlConnection object to connect to the database, and use a SqlCommand object to run a stored procedure that returns the data.
B. Use an OleDbConnection object to connect to the database, and use an OleDbCommand object to run a stored procedure that returns the data.
C. Configure SQL Server to support HTTP access, and create an XML template to run a stored procedure that returns the data in XML format.
D. Use COM interop to create an ADODB.Connection object, and use an ADODB.Command object to run a SQL statement that returns the data.
Answer: - B
You cannot use SQL Server .NET Data Provider for SQL Server 6.5. It’s only for SQL 7.0 and later


Q8. You want to only get changed data in a dataset which of the below is the best way?
A. productInfo.GetChanges (DataRowState.Detached);
B. product Changes = productInfo.GetChanges();
C. productChanges.Merge (product Info, true);
D. productChanges.Merge (product Info, false);
Answer: - B

Q9. Which of the following does the actual .NET code execute?
A MSIL
B CLS
C CLR
D C#
E CTS
Answer: - C

Q10. Hiding implementation and exposing the interface in OOP's is called as :-
A) Polymorphism
B) Encapsulation
C) Overloading
D) Static
Answer: - B

Q11. Garbage collector runs.
1) When Application is running for more than 30 minutes.
2) Every 1/4th Milli Second.
3) When application is running low of memory.
4) Its very random and takes random time from the CPU clock.
Answer: - 3

Q12. Which line is invalid in the code below?
1. Interface Test2
2. {
3. Int i;
4. Void Method2A (int);
5. String Method2B ();
6. }
A. Line 3
B. Line 4
C. Line 5
Answer: - A

Q13. You want to debug a Web-based ASP.NET application. But for some cause debugging information is not shown. What could be missing?
A. <%@ Page Debug="true" %>
B. <%@ Application Debug="true" %>
C. <%@ Page Trace="true" %>
D. <%@ Application Trace="true" %>
Answer: - A.

Q14. What property is used on the DataTable to indicate conflicts after update method is called?
A. HasErrorConflict
B. HasError
C. HasCollision
D. HasDataError
Answer :- A

Q15. What is a DiffGram?
A. XML file containing both the original and current values for the data.
B. XML files containing the difference between original and current data.
C. DataSet loaded with two XML files, resulting in the difference being current.
D. DataSet loaded with an XML file and the original values from the data source.
Answer: - A




Q What ASP.NET object encapsulates the state of the client and the browser?
A. Application object.
B. Session objects.
C. Response object.
D. Request object.
E. Server object
Answer :- B

Q16. What method(s) must be used with the Application object to ensure that only one process accesses a variable at a time?
A. Synchronize()
B. Lock() and UnLock()
C. ThreadLock
D. Synchronize.
Answer :- B

Q17. Which object can help you maintain data across users?
A. The Session object.
B. The Application object.
C. The Response object.
D. The Request object.
E. The Server object
Answer: - B

Q18. What must be done before you can consume a web service?
A. Build a proxy library by using the TblImp.exe utility.
B. Build a proxy library by using the Disc.exe utility.
C. Build a proxy library by using the csc.exe utility.
D. Build a proxy library by using the wsdl.exe utility
Answer: - D

Q19. What control is used to validate that two fields are equal?
A. RequiredFieldValidator
B. RegularExpressionValidator
C. CompareValidator
D. The equals () method of the field.
Answer :- C

Q20. Why should you close all database objects and set them to NULL before leaving the method where the objects were created?
A. To ensure that the object’s destructors are called.
B. To ensure that the connection to the database is closed as soon as possible.
C. To ensure that the objects can be reused.
D. Good coding practice.
Answer: - B

Q21. You are developing a web application that is retrieving historical library information from a database server and displays it to the users of your application. What cache strategy will give you the best performance?
A. Use the output cache.
B. Use the cache object.
C. Use the ASP.NET central cache.
D. Use the client cache
Answer: - B

Q22. Which tool can you use to precompile a Windows application?
A. mscorcfg.msc
B. ngen.exe
C. caspol.exe
Answer: - B

Q23. Which method of the Service Controller class will allow you to send a command to the service?
A. Stop ()
B. Start ()
C. Pause ()
D. Execute Command ()
Answer: - D

Q24. .NET remote server object must implement.
A. IUnknown
B. IMarshalByValue
C. IMarshalByRef
D. ISingleCall
E. ISerializable
Answer: - E

Q25. You are in charge of creating a remote object that will return database records to the caller of the method. You want to keep track of the number of requests. Which activation mode would you use?
A. Single Call
B. Singleton
C. Client-activated
D. Server-activated
Answer: - B
Q26. You want to ensure that your web method uses the cache for results, so you change the web method attribute to [Web Method (BufferResponse = true)]. When you investigate, you find that your web method still is not using the cache. What is the most effective way of ensuring that your web method uses the cache?
A. Add CacheTime=300 to the Web Method attribute.
B. Add Cache=true to the Web Method attribute.
C. Add EnableCache=true to the WebMethod attribute.
D. Add Cache Duration=300 as a parameter to the WebMethod attribute.
Answer: - D

Q27. What namespace must be used in order to use the DOM for XML support?
A. System.Data.Xml
B. System.Xml
C. System.Xml.DOM
D. System. DOM
Answer: - B

Q28. You need to encrypt the SOAP header. What is the correct method to use?
A. Inherit the web service class from the SoapHeaderEncrypt class.
B. Custom SOAP headers.
C. SOAP header extensions.
D. Enable SSL for the XML web service and configure it to encrypt the headers.
Answer: - C

Popular posts from this blog

Resolved : Power BI Report connection error during execution

Getting Below Power BI Report connection error during execution . Error: Something went wrong Unable to connect to the data source undefined. Please try again later or contact support. If you contact support, please provide these details. Underlying error code: -2147467259 Table: Business Sector. Underlying error message: AnalysisServices: A connection cannot be made. Ensure that the server is running. DM_ErrorDetailNameCode_UnderlyingHResult: -2147467259 Microsoft.Data.Mashup.ValueError.DataSourceKind: AnalysisServices Microsoft.Data.Mashup.ValueError.DataSourcePath: 10.10.10.60;T_CustomerMaster_ST Microsoft.Data.Mashup.ValueError.Reason: DataSource.Error Cluster URI: WABI-WEST-EUROPE-redirect.analysis.windows.net Activity ID: c72c4f12-8c27-475f-b576-a539dd81826a Request ID: dfb54166-c78f-4b40-779f-e8922a6687ad Time: 2019-09-26 10:03:29Z Solution: We found report connection not able to connect to SQL Analysis service so tried below option. Re

Song- Khamoshiyan Piano keyboard Chord,Notation and songs Lyrics

All songs notation and chords at one place

Song : O Saathi Re Film : Mukhathar Ka Sikkandhar Uses : C D D# E G A Note : The numbers at the end of the lines indicate line numbers. Pallavi: O saathi re, tere binaa bhi kya jina, tere binaa bhi kya jina A- C D D#....,D D C DD E...C..CA-...,D D C DD E...CC.......1 Play line 1 again phulon men khaliyon men sapnom ki galiyon men GGG...GAGE.. GGG G A G E.................................................2 tere bina kuchh kahin naa E A G E D C D D#.......................................................................3 tere binaa bhi kya jina, tere binaa bhi kya jina D D C DD E....C..CA-..., D D C DDE....CC.............................4 Charanam: har dhadkan men, pyaas hai teri, sanson men teri khushboo hai CCC C D C A-, CCC C D C A-, DDD DED CD EE.. CCCC......................5 is dharthi se, us ambar tak, meri nazar men tu hi tu hai CCC C D C A-, CCC C D C A-, DDD DED CD EE.. CCCC......................6 pyaar yeh tute naa GGG... GAG D#......E.........................