DNU

Download as rtf, pdf, or txt
Download as rtf, pdf, or txt
You are on page 1of 7

q1. explain the differences between server-side and client-side code?

ans. server side code will execute at server (where the website is hosted) end, & all the business
logic will execute at server end where as client side code will execute at client side (usually
written in javascript, vbscript, jscript) at browser end.

q2. what type of code (server or client) is found in a code-behind class?


ans. server side code.

q3. how to make sure that value is entered in an asp:textbox control?


ans. use a requiredfieldvalidator control.

q4. which property of a validation control is used to associate it with a server control on
that page?
ans. controltovalidate property.

q5. how would you implement inheritance using vb.net & c# ?


ans. c# derived class : baseclass
vb.net : derived class inherits baseclass

q6. which method is invoked on the dataadapter control to load the generated dataset with
data?
ans. fill() method.

q7. what method is used to explicitly kill a user's session?


ans. session.abandon()

q8. what property within the asp:gridview control is changed to bind columns manually?
ans. autogenerated columns is set to false

q9. which method is used to redirect the user to another page without performing a round
trip to the client?
ans. server.transfer method.

q10. how do we use different versions of private assemblies in same application without re-
build?
ans.inside the assemblyinfo.cs or assemblyinfo.vb file, we need to specify assembly version.
assembly: assemblyversion

q11. is it possible to debug java-script in .net ide? if yes, how?


ans. yes, simply write "debugger" statement at the point where the breakpoint needs to be set
within the javascript code and also enable javascript debugging in the browser property settings.

q12. how many ways can we maintain the state of a page?


ans. 1. client side - query string, hidden variables, viewstate, cookies
2. server side - application , cache, context, session, database
q13. what is the use of a multicast delegate?
ans. a multicast delegate may be used to call more than one method.

q14. what is the use of a private constructor?


ans. a private constructor may be used to prevent the creation of an instance for a class.

q15. what is the use of singleton pattern?


ans. a singleton pattern .is used to make sure that only one instance of a class exists.

q16. when do we use a dom parser and when do we use a sax parser?
ans. the dom approach is useful for small documents in which the program needs to process a
large portion of the document whereas the sax approach is useful for large documents in which
the program only needs to process a small portion of the document.

q17. will the finally block be executed if an exception has not occurred?
ans.yes it will execute.

q18. what is a dataset?


ans. a dataset is an in memory database kind of object that can hold database information in a
disconnected environment.

q19. is xml a case-sensitive markup language?


ans. yes.

q20. what is an .ashx file?


ans. it is a web handler file that produces output to be consumed by an xml consumer client
(rather than a browser).

q21. what is encapsulation?


ans. encapsulation is the oops concept of binding the attributes and behaviors in a class, hiding
the implementation of the class and exposing the functionality.

q22. what is overloading?


ans. when we add a new method with the same name in a same/derived class but with different
number/types of parameters, the concept is called overload and this ultimately implements
polymorphism.

q23. what is overriding?


ans. when we need to provide different implementation in a child class than the one provided by
base class, we define the same method with same signatures in the child class and this is called
ovem,
q24. what is a delegate?
ans. a delegate is a strongly typed function pointer object that encapsulates a reference to a
method, and so the function that needs to be invoked may be called at runtime.

q25. is string a reference type or value type in .net?


ans. string is a reference type object.

q26. what is a satellite assembly?


ans. satellite assemblies contain resource files corresponding to a locale (culture + language) and
these assemblies are used in deploying an application globally for different languages.

q27. what are the different types of assemblies and what is their use?
ans. private, public(also called shared) and satellite assemblies.

q28. are msil and cil the same thing?


ans. yes, cil is the new name for msil.

q29. what is the base class of all web forms?


ans. system.web.ui.page

q30. how to add a client side event to a server control?


ans. example... btnsubmit.attributes.add("onclick","javascript:fnsomefunctioninjavascript()");

q31. how to register a client side script from code-behind?


ans. use the page.registerclientscriptblock method in the server side code to register the script
that may be built using a stringbuilder.

q32. can a single .net dll contain multiple classes?


ans. yes, a single .net dll may contain any number of classes within it.

q33. what is dll hell?


ans. dll hell is the name given to the problem of old unmanaged dll's due to which there was a
possibility of version conflict among the dlls.

q34. can we put a break statement in a finally block?


ans. the finally block cannot have the break, continue, return and goto statements.

q35. what is a compositecontrol in .net?


ans. compositecontrol is an abstract class in .net that is inherited by those web controls that
contain child controls within them.

q36. which control in asp.net is used to display data from an xml file and then displayed
using xslt?
ans. use the asp:xml control and set its documentsource property for associating an xml file, and
set its transformsource property to set the xml control's xsl file for the xslt transformation.

q37. can we run asp.net 1.1 application and asp.net 2.0 application on the same computer?
ans. yes, though changes in the iis in the properties for the site have to be made during
deployment of each.

q38. what are the new features in .net 2.0?


ans. plenty of new controls, generics, anonymous methods, partial classes, iterators, property
visibility (separate visibility for get and set) and static classes.

q39. can we pop a messagebox in a web application?


ans. yes, though this is done clientside using an alert, prompt or confirm or by opening a new
web page that looks like a messagebox.

q40. what is managed data?


ans. the data for which the memory management is taken care by .net runtime’s garbage
collector, and this includes tasks for allocation de-allocation.
q41. how to instruct the garbage collector to collect unreferenced data?
ans. we may call the garbage collector to collect unreferenced data by executing the
system.gc.collect() method.

q42. how can we set the focus on a control in asp.net?


ans. txtbox123.focus(); or page.setfocus(nameofcontrol);

q43. what are partial classes in asp.net 2.0?


ans. in .net 2.0, a class definition may be split into multiple physical files but partial classes do
not make any difference to the compiler as during compile time, the compiler groups all the
partial classes and treats them as a single class.

q44. how to set the default button on a web form?


ans. <asp:form id="form1" runat="server" defaultbutton="btngo"/>

q45.can we force the garbage collector to run?


ans. yes, using the system.gc.collect(), the garbage collector is forced to run in case required to
do so.

q46. what is boxing and unboxing?


ans. boxing is the process where any value type can be implicitly converted to a reference type
object while unboxing is the opposite of boxing process where the reference type is converted to
a value type.

q47. what is code access security? what is cas in .net?


ans. cas is the feature of the .net security model that determines whether an application or a piece
of code is permitted to run and decide the resources it can use while running.

q48. what is multi-tasking?


ans. it is a feature of operating systems through which multiple programs may run on the
operating system at the same time, just like a scenario where a notepad, a calculator and the
control panel are open at the same time.

q49. what is multi-threading?


ans. when an application performs different tasks at the same time, the application is said to
exhibit multithreading as several threads of a process are running.2
q50. what is a thread?
ans. a thread is an activity started by a process and its the basic unit to which an operating system
allocates processor resources.

q51. what does addressof in vb.net operator do?


ans. the addressof operator is used in vb.net to create a delegate object to a method in order to
point to it.

q52. how to refer to the current thread of a method in .net?


ans. in order to refer to the current thread in .net, the thread.currentthread method can be used. it
is a public static property.

q53. how to pause the execution of a thread in .net?


ans. the thread execution can be paused by invoking the thread.sleep(integervalue) method where
integervalue is an integer that determines the milliseconds time frame for which the thread in
context has to sleep.

q54. how can we force a thread to sleep for an infinite period?


ans. call the thread.interupt() method.

q55. what is suspend and resume in .net threading?


ans. just like a song may be paused and played using a music player, a thread may be paused
using thread.suspend method and may be started again using the thread.resume method. note that
sleep method immediately forces the thread to sleep whereas the suspend method waits for the
thread to be in a persistable position before pausing its activity.

q56. how can we prevent a deadlock in .net threading?


ans. using methods like monitoring, interlocked classes, wait handles, event raising from
between threads, using the threadstate property.

q57. what is ajax?


ans. asyncronous javascript and xml - ajax is a combination of client side technologies that sets
up asynchronous communication between the user interface and the web server so that partial
page rendering occur instead of complete page postbacks.

q58. what is xmlhttprequest in ajax?


ans. it is an object in javascript that allows the browser to communicate to a web server
asynchronously without making a postback.

q59. what are the different modes of storing an asp.net session?


ans. inproc (the session state is stored in the memory space of the aspnet_wp.exe process but the
session information is lost when iis reboots), stateserver (the session state is serialized and stored
in a separate process call viewstate is an object in .net that automatically persists control setting
values across the multiple requests for the same page and it is internally maintained as a hidden
field on the web page though its hashed for security reasons.
q60. what is a delegate in .net?
ans. a delegate in .net is a class that can have a reference to a method, and this class has a
signature that can refer only those methods that have a signature which complies with the class.

q61. is a delegate a type-safe functions pointer?


ans. yes

q62. what is the return type of an event in .net?


ans. there is no return type of an event in .net.

q63. is it possible to specify an access specifier to an event in .net?


ans. yes, though they are public by default.

q64. is it possible to create a shared event in .net?


ans. yes, but shared events may only be raised by shared methods.

q65. how to prevent overriding of a class in .net?


ans. use the keyword notoverridable in vb.net and sealed in c#.

q66. how to prevent inheritance of a class in .net?


ans. use the keyword notinheritable in vb.net and sealed in c#.

q67. what is the purpose of the mustinherit keyword in vb.net?


ans. mustinherit keyword in vb.net is used to create an abstract class.

q68. what is the access modifier of a member function of in an interface created in .net?
ans. it is always public, we cant use any other modifier other than the public modifier for the
member functions of an interface.

q69. what does the virtual keyword in c# mean?


ans. the virtual keyword signifies that the method and property may be overridden.

q70. how to create a new unique id for a control?


ans. controlname.id = "controlname" + guid.newguid().tostring(); //make use of the guid class

q71a. what is a hashtable in .net?


ans. a hashtable is an object that implements the idictionary interface, and can be used to store
key value pairs. the key may be used as the index to access the values for that index.

q71b. what is an arraylist in .net?


ans. arraylist object is used to store a list of values in the form of a list, such that the size of the
arraylist can be increased and decreased dynamically, and moreover, it may hold items of
different types. items in an arraylist may be accessed using an index.

q72. what is the value of the first item in an enum? 0 or 1?


ans. 0

q73. can we achieve operator overloading in vb.net?


ans. yes, it is supported in the .net 2.0 version, the "operator" keyword is used.

q74. what is the use of finalize method in .net?


ans. .net garbage collector performs all the clean up activity of the managed objects, and so the
finalize method is usually used to free up the unmanaged objects like file objects, windows api
objects, database connection objects, com objects etc.

q75. how do you save all the data in a dataset in .net?


ans. use the acceptchanges method which commits all the changes made to the dataset since last
time acceptchanges was performed.

q76. is there a way to suppress the finalize process inside the garbage collector forcibly in
.net?
ans. use the gc.suppressfinalize() method.

q77. what is the use of the dispose() method in .net?


ans. the dispose method in .net belongs to idisposable interface and it is best used to release
unmanaged objects like file objects, windows api objects, database connection objects, com
objects etc from the memory. its performance is better than the finalize() method.

q78. is it possible to have have different access modifiers on the get and set methods of a
property in .net?
ans. no we can not have different modifiers of a common property, which means that if the
access modifier of a property's get method is protected, and it must be protected for the set
method as well.

q79. in .net, is it possible for two catch blocks to be executed in one go?
ans. this is not possible because once the correct catch block is executed then the code flow goes
to the finally block.

q80. is there any difference between system.string and system.stringbuilder classes?


ans. system.string is immutable by nature whereas system.stringbuilder can have a mutable string
in which plenty of processes may be performed.

You might also like