-
-
-
-
-
-
-
-
-
-
-
A single line comments are implemented by
A) �B) //C) /*D) !�
-
Is it possible to Override Private Virtual methods
A) YesB) NoC) Either A or BD) None
-
How can you sort the elements of the array in descending order
A) Sort methodsB) Reverse methodsC) By calling Sort and then Reverse methodsD) Can�t sort in descending
-
What is the order of destructors called in a polymorphism hierarchy
A) Starts with derived class ends at base classB) Starts with base class ends at derived classC) The destructor of base can not becalledD) RandomlyExplanation: Uses Bottomup approach while calling Destructors from derived class
-
In C# a technique used to stream the data is known as
A) WadingB) SerializationC) CrunchingD) Marshalling
-
In the following cases which is not function overloading
A) Same parameter types but different return valuesB) Varying number of parametersC) Different parameters types but different return valuesD) Different parameters type but same return values
-
What is an indexer in C#
A) Special syntax for overloading [ ] operator for a classB) One which speeds up the function callC) None of the above
-
The C# keyword int maps to which .NET type
A) System.Int16B) System.Int32C) System.Int64
-
Windows services created by C# app run only
A) Windows 95B) Windows 98C) Windows NT & Above
-
-
How do you import Activex component in to .NET
A) With AXImp.exeB) With Pinvoke.exeC) With Tlbimp.exe
-
Which class use to Read/Write data to memory
A) FileStreamB) NetworkStreamC) MemoryStream
-
Which of the following has stream as the base class
A) Buffered StreamB) MemoryStreamC) FileStream
-
Stream object can not be initialized
A) TrueB) FalseExplanation: Stream is an abstract class ie it is the representation of bytes
-
Public policy applies to
A) Shared assembliesB) Private assembliesC) Both
-
-
What is the extension of a resource file
A) .csB) .rsxC) .resx
-
Which utility is used to create resource file
A) regasmB) resgenC) regsvrExplanation: Resgen.exe is used to create resource files in C#.net
-
In a multilevel hierarchy how are the constructors are called
A) TopDownB) BottomUpC) None
-
How do you make a class not instantiable
A) Making class as AbstractB) Having a Private constructorC) Making the class sealedD) Both A & B
-
Which attribute you generally find on top of main method
A) [assembly]B) [ STA ]C) [ STAThread ]
-
How do you refer parent classes in C#
A) SuperB) ThisC) Base
-
Application Isolation is assured using
A) ThreadsB) RemotingC) ApplicationDomain
-
Assemblies cannot be loaded side by side
A) TrueB) FalseExplanation: Assemblies can be loaded side by side
-
How do you add objects to hashtable
A) With Add methodB) With insert MethodC) With = operator
-
What is the output of Vectors.RemoveAt(1)
A) Removes the object whose key is 1B) Removes the object whose value is 1C) Removes the object at position 1
-
It is not possible for a delegate to wrap more than 1 method
A) True B) False
-
What happens when a C# project has more than 1 Main methods
A) Compiler throws warning messageB) Compiler throws Error messageC) Compiler successfully compiles
-
Which of the following explicit type conversion is achieved with out loosing the original data value
A) Byte to LongB) Long to ByteC) Float to intExplanation: Byte stores up to 255 which can easily be stored in a long variable
-
Which of these operator has the Highest Precedence
A) ( )B) &&C) | |
-
How do you determine the size required by a Value type on the stack
A) Length operatorB) Sizeof operatorC) Mem operator
-
How do you check whether an Object is compatible with Specific Type
A) Is OperatorB) Like OperatorC) Compare operator
-
How do you make CLR enforce overflow checking
A) Using Checked KeywordB) Using Unchecked KeywordC) With Try Catch
-
X=X+1 is equivalent to
A) X++B) X+=1C) Both A & B
-
If we need to compare X to a value 3 how do we do it in C#
A) If (X==3)B) If (X=3)C) If (X.equals(3) )
-
Which operator is used for TypeCasting
A) [ ]B) ( )C) TypeOf
-
Array declaration in C# is done with
A) [ ]B) {}C) ( )
-
How to get the capacity of an array in C#
A) Count PropertyB) Length PropertyC) Ubound method
-
Which of the following is wrong with regards to Out keyword
A) For Out parameters a variable can be passed which has not initializedB) If Out parameters are not assigned a value with in the function body compiler throws errorC) The variable passed as a Out parameter must be static
-
Which modifiers hides an inherited method with same signature
A) NewB) VirtualC) SealedExplanation: New hides the inherited method which was overridden by base class
-
For Each statement implicitly implements which interface
A) IEnumerableB) IcomparerC) NoneExplanation: All iterators implements Ienumerable
-
The condition for If statement in C# is enclosed with in
A) ( )B) { }C) [ ]
-
Which of the escape sequence is used for Backspace
A) oB) aC) b
-
Which of the member is not a member of Object
A) Equals ( )B) GetType ( )C) ToString ( )D) Parse( )
-
Which statement is invalid with regards to Constant
A) They must be initialized when they are declaredB) The value of the constant must be computable at compile timeC) Constants are not staticD) Constant is a variable whose value can be changed through out it�s life time when it is static.
-
Instantiating a reference object requires the use of
A) New keywordB) = OperatorC) Set keyword
-
What happens if we refer a variable which in not initialized in C#
A) Compiler throws warning messageB) Compiler throws error messageC) Compiles the application with out any problemExplanation: Variable needs to be initialized before use
-
What does Main method returns in C#
A) StringB) IntegerC) FloatExplanation: Main returns either Nothing or int
-
Which of the following application need not to have an entry point
A) Console applicationB) Windows applicationC) Class ModulesExplanation: Class modules are referred by another project which will have entry point.
-
Which of the following keyword is used along with Main function in C#
A) VirtualB) StaticC) InheritsExplanation: Main functions are always static as it runs with out any instance
-
What are Namespaces
A) Naming convention used in .NetB) Group of classes categorized to avoid name clashC) None of the above
-
.NET run time relies on the object reference counts to manage memory
A) TrueB) FalseExplanation: .Net run time relies on Garbage Collection to manage memory
-
Which is .NET s answer to Memory Management
A) ReflectionB) Common Type SystemC) GarbageCollection
-
Which of the following is not a subclass of reference type
A) EnumerationsB) DelegatesC) ArraysExplanation: Enumerations are of Value Type
-
Which of the following is not a subclass of Value Type class
A) EnumerationsB) User defined value typesC) Boxed value typesExplanation: Boxed value types are of reference types
-
It is not possible to debug the classes written in other .Net languages in a C# project.
A) TrueB) FalseExplanation: It is possible to debug the code as all are adhering to CTS & CLS
-
Code written in C# can not used in which of the languages
A) J#B) Managed C++C) Vb.NetD) JavaExplanation: Java is not targeted to run under CLR
-
.NET interfaces are not derived from IUnknown & they do not have associated GUID�s
A) TrueB) FalseExplanation: Only COM interfaces are derived from Iunknown and they do have GUIDs
-
Which are the important features of IL
A) Use of attributesB) Strong data typingC) Object orientation & use of interfaceD) All of the above
-
Intermediate Language also facilitates language interoperability
A) TrueB) FalseExplanation: AS the managed code is bound to CTS & CLS it is language interoperable
-
Platform specific code is obtained when
A) source code is compiled to get MSILB) when MSIL is compiled by CLRC) Both of the aboveExplanation: When CLR compiles the managed it generates the native code which is compatible to platform.
-
Code running under the control of CLR is often referred as
A) Source CodeB) Managed CodeC) Unmanaged CodeExplanation: Source code is compiled to MSIL, which is generally known as managed code
-
-
How do you add ASP.Net 3rd party component
Skill/Topic: AdvancedA) By add/Remove items in the project menuB) Add reference of dll file and place the code where ever requiredC) Cannot add 3rd party component to asp.net
-
When is the user controls code is executed
Skill/Topic: AdvancedA) After the webform loadsB) After the page_init event of webformC) Before Page_init event of web form
-
Which method displays the custom control
Skill/Topic: AdvancedA) The PrerenderB) RenderC) Page_LoadD) Display
-
What is the significance of Response.AddHeaders( )
Skill/Topic: AdvancedA) Adds HTTP Headers to output streamB) Adds Tag to rendered PageC) Add Headers to the web site
-
Whats is the significance of Response.ClearHeaders( )
Skill/Topic: AdvancedA) Clears all Headers from the buffer streamB) Clears all the section value from rendered HTML FileC) Clears the content of the Rendered pageD) None of the above
-
Which of the following are not a member of Server Object
Skill/Topic: AdvancedA) ExecuteB) TransferC) OpenD) HTMLDecode
-
Whats the significance of Request.MapPath( )
Skill/Topic: AdvancedA) Maps the specified virtual path to a physical pathB) Maps the specified absolute path to virtual pathC) None
-
What is the out put of the following codebyte a=200;byte b=100;byte c=a+b;Response.Write ( C );
Skill/Topic: AdvancedA) 300B) Compile Time errorC) Run time ErrorD) Just prints �C�
-
Select the output of the statement < form method=post action=�test.aspx� >
Skill/Topic: AdvancedA) Transfers all the form data to test.aspx with HTTP headersB) Transfers all the form data to test.aspx with out HTTP headersC) Calls post method on test.aspxD) None of the above
-
What data types do a Rangevalidator supports
Skill/Topic: AdvancedA) IntegerB) StringC) DateD) All of the above
-
What is the lifespan for items stored in viewstate
Skill/Topic: AdvancedA) Exists for the Life of the current pageB) 20 minsC) 2 minsD) 2 sec
-
What is a diffgram ?
Skill/Topic: AdvancedA) The one which renders the dataset object contents to XMLB) Finds the difference in two objectsC) Finds the difference in two filesD) None of the above
-
Why is Global.asax is used for ?
Skill/Topic: AdvancedA) To implement application & Session level eventsB) To store configuration informationC) To store styling informationD) None of the above
-
Is it possible edit data in a repeater control
Skill/Topic: AdvancedA) NoB) Yes
-
What is the purpose of Reflection?
Skill/Topic: AdvancedA) For Reading metadata at runtimeB) For knowing version of assemblyC) For finding path of an assembly
-
What is a strong name?
Skill/Topic: AdvancedA) Public KeyB) Private KeyC) Combination Of both Public,Private key and digital signature
-
Which of the following extension does a webservice file will have
Skill/Topic: AdvancedA) .AsmxB) .AspxC) .AscxD) .Resx
-
Which Language can Support SOAP
Skill/Topic: AdvancedA) VBB) JAVAC) COBOLD) All of the above
-
What is the difference between Server.Transfer & Response.Redirect
Skill/Topic: AdvancedA) No DifferenceB) Server.Transfer needs a roundtrip, Response.Redirect does notC) Response.Redirect needs roundtrip, Server.Transfer does notD) Server.Transfer can transfer user between 2 applicaions
-
Is it Possible to Serialize HashTable with XMLSerializer
Skill/Topic: AdvancedA) YesB) No
-
Which of the following is not a member of ConnectionObject
Skill/Topic: AdvancedA) BeginTransactionB) EndTransactionC) ExecuteD) Open
-
How do we Delete, Update, Select data in a Dataset
Skill/Topic: AdvancedA) Using SQLDataAdapterB) Using SQLDataReaderC) Using SQLCommandD) None
-
Select the Interface which provides Fast, connected forward-only access to data
Skill/Topic: AdvancedA) IdataRecordB) IdatabaseC) IdataReaderD) Irecorder
-
Which objects is used to create foreign key between tables?
Skill/Topic: AdvancedA) DataRelationB) DataRelationshipC) DataConstraintD) Datakey
-
What is the advantage of Disconnected mode of ADO.Net in ASP.Net
Skill/Topic: AdvancedA) Automatically dump data at client PCB) Not necessary to connect with serverC) user data can update and retrieve in dataset and when connection connected, update values with serverD) All of the above
-
How to open more than one datareader at a time
Skill/Topic: AdvancedA) Use different datareader variableB) Use different datareader and connection variableC) Can not be done
-
Which method do you invoke on the DataAdapter control to load your generated dataset with data?
Skill/Topic: AdvancedA) LoadB) FillC) GetAllD) None
-
Which of the following is not a member of ADODBCommand object
Skill/Topic: AdvancedA) ExecuteReaderB) ExecuteScalarC) ExecuteStreamD) OpenE) CommandText
-
The object used by SQL connection to make Security Demands
Skill/Topic: AdvancedA) SQLLCientAttributeB) SQLPermissionC) SQLPermissionClientD) SQLClientPermission
-
Whch of the following is not a member of Response Object?
Skill/Topic: AdvancedA) ClearB) WriteC) ExecuteD) Flush
-
What is a satallite assembly ?
Skill/Topic: IntermediateA) Any DLL file used by an EXE file.B) An Assembly containing localized resources for another assemblyC) None of the above
-
What is the purpose of code behind ?
Skill/Topic: IntermediateA) To separate different sections of a page in to different filesB) To merge HTML layout and code in to One fileC) To separate HTML Layout and code to different fileD) To ignore HTML usage
-
Where do you store the information about the user locale
Skill/Topic: IntermediateA) System.userB) System.webC) System.DrawingD) System.Web.UI.Page.Culture
-
Which control supports paging
Skill/Topic: IntermediateA) RepeaterB) DatagridC) BothD) None
-
What does Response.End will do?
Skill/Topic: IntermediateA) It will stop the server processB) It will stop the client processC) None of the above
-
Why do we use XMLSerializer class
Skill/Topic: IntermediateA) RemotingB) WebServicesC) Xml documentary Files
-
How do you explicitly kill a user�s session ?
Skill/Topic: IntermediateA) Session.Close ( )B) Session.Discard ( )C) Session.AbandonD) Session.End
-
What is the maximum number of cookies that can be allowed to a web site
Skill/Topic: IntermediateA) 1B) 10C) 20D) 30E) More than 30
-
Which of the following is not a valid state management tool?
Skill/Topic: IntermediateA) Application StateB) Hidden Form FieldC) QuerystateD) Cookies
-
What is the default authentication mode for IIS
Skill/Topic: IntermediateA) WindowsB) AnonymousC) Basic AuthenticationD) None
-
Session Object classes are defined in which of the following namespace?
Skill/Topic: IntermediateA) System.Web.UIB) System.Web.SessionStateC) System.Web
-
Web Controls Supports CSS
Skill/Topic: IntermediateA) TrueB) False
-
Does the �EnableViewState� allows the page to save the users input on a form
Skill/Topic: IntermediateA) YesB) No
-
Select the type Processing model that asp.net simulate
Skill/Topic: IntermediateA) Event-drivenB) StaticC) LinearD) TopDown
-
Who can access Session state variables
Skill/Topic: IntermediateA) All Users of an applicationB) A Single sessionC) All users within a single tunnel
-
How do you turn off the Session state for a webform ?
Skill/Topic: IntermediateA) In Web.config file set the tag to TrueB) In Web.config file set the tag to falseC) Set the Session state to false in webform properties windowD) Set the EnableSession state to false in webform properties window
-
How do you trace the application_End event on runtime?
Skill/Topic: IntermediateA) By DebuggingB) By TracingC) Can not be done
-
Select the validation control used for �PatternMatching�
Skill/Topic: IntermediateA) FieldValidatorB) RegularExpressionValidatorC) RangeValidatorD) PatternValidator
-
How do you disable client side validation ?
Skill/Topic: IntermediateA) Set the language property to C#B) Set the Runat property to serverC) Set the ClientTarget property to DownlevelD) Set the inherits property to codeb
-
Where is the default Session data is stored in ASP.Net
Skill/Topic: IntermediateA) InProcessB) StateServerC) SQL ServerD) All of the above
-
Select the caching type supported by ASP.Net
Skill/Topic: IntermediateA) Output CachingB) DataCachingC) Both a & bD) None of the above
-
Which property of the session object is used to set the local identifier ?
Skill/Topic: IntermediateA) SessionIdB) LCIDC) ItemD) Key
-
The interface used by ASP.Net to create Unique Id�s?
Skill/Topic: IntermediateA) AppDomainsetupB) System.UI.Naming.ContainerC) IAsyncResultD) customFormatter
-
what is the difference between user control and custom control
Skill/Topic: IntermediateA) Both can use as drag and drop toolB) Both are sameC) Both can use different applicationD) One Custom Control can be use in different project but not the same with User control
-
The number of forms that can be added to a aspx page is
Skill/Topic: IntermediateA) 2B) 3C) 1D) More than 3
-
It is possible to set Maximum length for a text box through code
Skill/Topic: IntermediateA) TrueB) False
-
Why is Global.asax is used
Skill/Topic: BeginnerA) Implement application and session level eventsB) Declare Global variablesC) No use
-
What�s the difference between Response.Write() andResponse.Output.Write()?
Skill/Topic: BeginnerA) Response.Output.Write() allows you to flush outputB) Response.Output.Write() allows you to buffer outputC) Response.Output.Write() allows you to write formatted outputD) Response.Output.Write() allows you to stream output
-
What is the transport protocol used to call a webservice
Skill/Topic: BeginnerA) HTTPB) SOAPC) TCPD) SMTP
-
A web application running on multiple servers is called as
Skill/Topic: BeginnerA) WebFormB) WebfarmC) Website
-
Custom Controls are derived from which of the classes
Skill/Topic: BeginnerA) System.Web.UI.WebcontrolB) System.Web.UI.CustomcontrolC) System.Web.UI.Customcontrols.Webcontrol
-
To add a custom control to a Web form we have to register with
Skill/Topic: BeginnerA) TagPrefixB) Name space of the dll that is referencedC) AssemblynameD) All of the above
-
Can a dll run as stand alone application ?
Skill/Topic: BeginnerA) NoB) YesC) Sometimes we can make it by introducing some code
-
Which of the following is true ?
Skill/Topic: BeginnerA) User controls are displayed correctly in the Visual Studio .NET DesignerB) Custom controls are displayed correctly in VS.Net DesignerC) User and Custom controls are displayed correctly in the Visual Studio .NET Designer.
-
Which of these namespaces used for FileAccess
Skill/Topic: BeginnerA) System.IOB) System.IO.IsolatedStorageC) System.DirectoryServicesD) All of these
-
The code will be processed on web server when the runat attribute of the < Script > tag has the following value.
Skill/Topic: BeginnerA) DesktopB) ClientC) Server
-
The best way to delimit ASP.Net code from HTML code in your pages is by using --------------- tags.
Skill/Topic: BeginnerA) < Body >B) < Head >C) < Script >
-
The following is the namespace used for Reflection:
Skill/Topic: AdvancedA) System.Windows.ReflectionB) System.ReflectionC) System.Features.Reflection
-
To access attributes, the following is used:
Skill/Topic: AdvancedA) reflectionB) pointersC) collections
-
The following method is used to force the garbage collector :
Skill/Topic: AdvancedA) Garbage.CollectB) System.GC.Collect()C) Gc.Clea.Up()
-
Each process in a 32 bit Windows environment has the following amount of virtual memory available:
Skill/Topic: AdvancedA) 4 MBB) 400MBC) 4 GB
-
The correct syntax for defining a delefate is:
Skill/Topic: AdvancedA) delegate {MyMethod( int y) }B) delegate void MyMethod(int y) ;C) delegate: MyMethod (int y)
-
We inherit a class using the following syntax:
Skill/Topic: AdvancedA) class DerivedClass: BaseClass{ }B) class DerivedClass:: BaseClass{ }C) class BaseClass :DerivedClass { }
-
How do you deploy an assembly?
Skill/Topic: AdvancedA) Using MSI installerB) using a CAB archiveC) using XCOPYD) All of the above
-
How does a running application communicate or share data with other applicxation running indifferent application domains?
Skill/Topic: AdvancedA) using ExceptionsB) using attributesC) using .NET remoting services.
-
We need to register a private assembly in the Windows registry in order to use it.
Skill/Topic: AdvancedA) TrueB) FalseExplanation: We just need to copy it in the folder where the executable is located or in a subfolder below it..
-
Assembly version information is stored in the:
Skill/Topic: AdvancedA) ManifestB) Garbage CollectorC) Heap
-
Assemblies are of the following types:
Skill/Topic: AdvancedA) SsharedB) PrivateC) Friendly
-
Any process can be divided into multiple
Skill/Topic: AdvancedA) ProgramsB) ThreadsC) Application domains
-
NET offers the follwing security features:
Skill/Topic: AdvancedA) Transaction based securityB) Code-based securityC) Both the aboveD) None of the above
-
You can explicitly call the garbage collector
Skill/Topic: AdvancedA) TrueB) False
-
Garbage Collector:
Skill/Topic: AdvancedA) Copies the IL code to the heapB) Destroys the pointersC) is responsible for automatic memory management
-
Reference types are stored in :
Skill/Topic: AdvancedA) the HeapB) the stackC) the hard-disk
-
Value Types are stored on the heap ..? Is it true/False ?
Skill/Topic: AdvancedA) TrueB) False
-
What is automatic memory management in .NET known as:
Skill/Topic: AdvancedA) Managed CodeB) Smart CachingC) Garbage Collection
-
What is Boxing?
Skill/Topic: AdvancedA) conversion of reference types to value typesB) conversion of value types to reference typesC) Encapsulating a base class
-
Can we use pointers in C#?
Skill/Topic: AdvancedA) YesB) NoExplanation: Pointers can be used if required, but it will be unsafe code.
-
Events in C# are impltemented using:
Skill/Topic: AdvancedA) Specialized DLLsB) PointersC) Delegates
-
We can call COM objects in C# using :
Skill/Topic: AdvancedA) DLLImportB) UsingDLLC) DLLCall
-
1. Are there some features of C# language not supported by .NET?
Skill/Topic: AdvancedA) YesB) NoExplanation: For example some instances of operator overloading!
-
To change the value of a variable while debugging , the following window is used
Skill/Topic: IntermediateA) DebugB) WatchC) Immediate
-
Method Overloading and Overriding are the same
Skill/Topic: IntermediateA) TrueB) FalseExplanation: Overloading is changing the behavior of a method in a derived class, whereas overriding is having multiple methods with the same name
-
What is a multicast delegate?
Skill/Topic: IntermediateA) a delegate having multiple handlers assigned to itB) a delegate called multiple timesC) a delegate which has multiple implementations
-
Structs and classes support inheritance
Skill/Topic: IntermediateA) TrueB) FalseExplanation: Only classes can inherit. Structs can�t.
-
Interfaces provide implementation of methods
Skill/Topic: IntermediateA) TrueB) FalseExplanation: They only provide declaration on methods, events and properties
-
You can inherit multiple interfaces in C#
Skill/Topic: IntermediateA) TrueB) FalseExplanation: A class can inherit multiple interfaces
-
Even if an exception hasn�t occurred, the �finally� block will get executed
Skill/Topic: IntermediateA) YesB) NoExplanation: Finally block is always executed
-
Namespaces are used to
Skill/Topic: IntermediateA) Separate assembliesB) Create a unique name for an assemblyC) Avoid name clashes between data types
-
Which of the following is the correct way to instantiate an object in C#:
Skill/Topic: BeginnerA) objThis = System.CreateObject( ThisObject);B) objThis = new ThisObject();
-
We declare an integer variable 'x' in C# as
Skill/Topic: BeginnerA) x integer;B) integer x;C) int x;
-
A code block in C# is enclosed between
Skill/Topic: BeginnerA) < >B) [ ]C) { }
-
To read user input from the console, the following statement is used
Skill/Topic: BeginnerA) Console.ReadLine();B) Console.Input()C) System.GetuserRequest();
-
The following is a correct call to the Main() function
Skill/Topic: BeginnerA) static void Main()B) static Main(void)C) Main()
-
All the C# programs must have the following statement
Skill/Topic: BeginnerA) using DotNetB) using SystemC) include System
-
To write a line of text to the xonsole window, we make the following call
Skill/Topic: BeginnerA) Console.WriteLine()B) console.writeline()C) System.Output()
-
There must be at least the following function in a C# program
Skill/Topic: BeginnerA) main()B) Main()C) Enter()
-
Every statement in C# must end in
Skill/Topic: BeginnerA) ;B) ,C) #
-
The C# code files have an extension
Skill/Topic: BeginnerA) .csharpB) .csC) #
-
You can create the following using C#
Skill/Topic: BeginnerA) class librariesB) Stand alone GUI (Windows Forms) applicationsC) ASP.NET Web pagesD) Command Line applications
-
ASP.NET web pages can be programmed in C#?
Skill/Topic: BeginnerA) YesB) No
-
IL code compiles to
Skill/Topic: BeginnerA) Platform-specific Executable codeB) Byte CodeC) .NET CodeExplanation: The CLR compiles the IL into Platform-specific Executable code
-
Which is the first level of compilation in the .NET languages?
Skill/Topic: BeginnerA) CLRB) ILC) Platform-specific codeExplanation: Intermediate Language
-
What is IL?
Skill/Topic: BeginnerA) Interchangeable LibraryB) Interoperable LanguagesC) Intermediate LanguageD) Interchangeable languages
-
What is CLR?
Skill/Topic: BeginnerA) Common Library ReorganizationB) Csharp Language RespecificationC) Csharp Library RosterD) Common Language Runtime
-
What is CLS?
Skill/Topic: BeginnerA) Common Language SpecificationB) Common Library SystemC) Csharp Language SpecificationD) Code Location Specification
-
-
-
-
-
Difference between static page and dynamic page?
Static PagesQuick and easy to put together, even by someone who doesn't have much experience. Ideal for demonstrating how a site will look. Cache friendly, one copy can be shown to many people. Dynamic PagesOffers highly personalized and customised visitor options. Database access improves the personalized experience (as opposed to using just client side cookies) Scripts can read in data sources and...
-
-
can we connect two datareader to same data source using single connection at same time?
No, we cann't since once connection to database is opened must be closed before you reopen again .
-
What is difference in an Abstract Class and an Interface.
Abstract class can contain method definations also.Interfaces are essentially having all method prototypes no definitionIn short Interface is a abstract class having all methods abstract
-
-
-
-
What is stored procedure?
A program running in the database that can take complex actions based on the inputs you send it. Using a stored procedure is faster than doing the same work on a client, because the program runs right inside the database server. Stored procedures are nomally written in PL/SQL or Java.
-
What is the difference between structures and classes in C++?
There is only one difference ,in classes the members are private by default whereas it is not so in structures.
-
-
-
How's method overriding different from overloading?
When overriding, you change the method behavior for a derived class. Overloading simply involves having a method with the same name within the class.
-
What's the top .NET class that everything is derived from?
System.Object.
-
Describe the accessibility modifier protected internal.
It's available to derived classes and classes within the same Assembly (and naturally from the base class it's declared in).
-
Are private class-level variables inherited?
Yes, but they are not accessible, so looking at it you can honestly say that they are not inherited. But they are.
-
Does C# support multiple inheritance?
No, use interfaces instead.
-
How do you inherit from a class in C#?
Place a colon and then the name of the base class. Notice that it's double colon in C++.
-
What's the implicit name of the parameter that gets passed into the class' set method?
Value, and its datatype depends on whatever variable we're changing.
-
-
-
What does the parameter Initial Catalog define inside Connection String?
The database name to connect to.
-
Why would you use untrusted verificaion?
Web Services might use it, as well as non-Windows applications.
-
Which one is trusted and which one is untrusted?
Windows Authentication is trusted because the username and password are checked with the Active Directory, the SQL Server authentication is untrusted, since SQL Server is the only verifier participating in the transaction.
-
What connections does Microsoft SQL Server support?
Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server username and passwords).
-
Explain ACID rule of thumb for transactions.
Transaction must be Atomic (it is one unit of work and does not dependent on previous and following transactions), Consistent (data is either committed or roll back, no �in-between� case where something has been updated and something hasnot), Isolated (no transaction sees the intermediate results of the current transaction), Durable (the values persist if the data had been committed even if the system...
-
What is the wildcard character in SQL?
Let us say you want to query database with LIKE for all employees whose name starts with La. The wildcard character is %, the proper query with LIKE would involve La%.
-
What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET?
SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix, but it is a .NET layer on top of OLE layer, so not the fastest thing in the world. ODBC.NET is a deprecated layer provided for backward compatibility to ODBC engines.
-
Explain the three services model (three-tier application).
Presentation (UI), business (logic and underlying code) and data (from storage or other sources).
-
Can you change the value of a variable while debugging a C# application?
Yes, if you are debugging via Visual Studio.NET, just go to Immediate window.
-
What are three test cases you should go through in unit testing?
Positive test cases (correct data, correct output), negative test cases (broken or missing data, proper handling), exception test cases (exceptions are thrown and caught properly).
-
How do you debug an ASP.NET Web application?
Attach the aspnet_wp.exe process to the DbgClr debugger.
-
Where is the output of TextWriterTraceListener redirected?
To the Console or a text file depending on the parameter passed to the constructor.
-
Why are there five tracing levels in System.Diagnostics.TraceSwitcher?
The tracing dumps can be quite verbose and for some applications that are constantly running you run the risk of overloading the machine and the hard drive there. Five levels range from None to Verbose, allowing to fine-tune the tracing activities.
-
What does assert() do?
In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true.
-
What does the This window show in the debugger?
It points to the object that is pointed to by this reference. Object�s instance data is shown.
-
What debugging tools come with the .NET SDK?
CorDBG - command-line debugger, and DbgCLR - graphic debugger. Visual Studio .NET uses the DbgCLR. To use CorDbg, you must compile the original C# file using the /debug switch.
-
Is XML case-sensitive?
Yes, so and are different elements.
-
What is the difference between and XML documentation tag?
Single line code example and multiple-line code example.
-
How do you generate documentation from the C# file commented properly with a command-line compiler?
Compile it with a /doc switch.
-
What is the difference between // comments, /* */ comments and /// comments?
Single-line, multi-line and XML documentation comments.
-
What namespaces are necessary to create a localized application?
System.Globalization, System.Resources.
-
What are the ways to deploy an assembly?
An MSI installer, a CAB archive, and XCOPY command.
-
How is the DLL Hell problem solved in .NET?
Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly.
-
What is a multicast delegate?
It is a delegate that points to and eventually fires off several methods.
-
Can multiple catch blocks be executed?
No, once the proper catch code fires off, the control is transferred to the finally block (if there are any), and then whatever follows the finally block.
-
Will finally block get executed if the exception had not occurred?
Yes. What is the C# equivalent of C++ catch (�), which was a catch-all statement for any possible exception?
-
What is the .NET datatype that allows the retrieval of data by a unique key?
HashTable. What is class SortedList underneath?
-
How can you sort the elements of the array in descending order?
By calling Sort() and then Reverse() methods.
-
What is the difference between the System.Array.CopyTo() and System.Array.Clone()?
The first one performs a deep copy of the array, the second one is shallow.
-
-
What is the advantage of using System.Text.StringBuilder over System.String?
StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each time it is being operated on, a new instance is created.
-
What is the difference between System.String and System.StringBuilder classes?
System.String is immutable; System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.
-
If a base class has a bunch of overloaded constructors, and an inherited class has another bunch of overloaded constructors, can you enforce a call from an inherited constructor to an arbitrary base constructor?
Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.
-
How can you overload a method?
Different parameter data types, different number of parameters, different order of parameters.
-
-
Why cannot you specify the accessibility modifier for methods inside the interface?
They all must be public. Therefore, to prevent you from getting the false impression that you have any freedom of choice, you are not allowed to specify any accessibility, it is public by default.
-
What is an interface class?
It is an abstract class with public abstract methods all of which must be implemented in the inherited classes.
-
Can you allow class to be inherited, but prevent the method from being over-ridden?
Yes, just leave the class public and make the method sealed.
-
Can you prevent your class from being inherited and becoming a base class for some other classes?
Yes, that is what keyword sealed in the class definition is for. The developer trying to derive from your class will get a message: cannot inherit from Sealed class WhateverBaseClassName. It is the same concept as final class in Java.
-
Can you override private virtual methods?
No, moreover, you cannot access private methods in inherited classes, have to be protected in the base class to allow any sort of access.
-
Can you declare the override method static while the original method is non-static?
No, you cannot, the signature of the virtual method must remain the same, only the keyword virtual is changed to keyword override.
-
What does the keyword virtual mean in the method definition?
The method can be over-ridden.
-
How is method overriding different from overloading?
When overriding, you change the method behavior for a derived class. Overloading simply involves having a method with the same name within the class.
-
What is the top .NET class that everything is derived from?
System.Object.
-
C# provides a default constructor for me. I write a constructor that takes a string as a parameter, but want to keep the no parameter one. How many constructors should I write?
Two. Once you write at least one constructor, C# cancels the freebie constructor, and now you have to write one yourself, even if there is no implementation in it.
-
Describe the accessibility modifier protected internal.
It is available to derived classes and classes within the same Assembly (and naturally from the base class it is declared in).
-
Are private class-level variables inherited?
Yes, but they are not accessible, so looking at it you can honestly say that they are not inherited. But they are.
-
When you inherit a protected class-level variable, who is it available to?
Classes in the same namespace.
-
Does C# support multiple inheritance?
No, use interfaces instead.
-
What is the implicit name of the parameter that gets passed into the class set method?
Value, and its datatype depends on whatever variable we are changing.
-
Does C# support parameterized properties?
No. C# does, however, support the concept of an indexer from language spec. An indexer is a member that enables an object to be indexed in the same way as an array. Whereas properties enable field-like access, indexers enable array-like access. As an example, consider the Stack class presented earlier. The designer of this class may want to expose array-like access so that it is possible to inspect...
-
What is the equivalent to regsvr32 and regsvr32 /u a file in .NET development?
Try using RegAsm.exe. The general syntax would be: RegAsm. A good description of RegAsm and its associated switches is located in the .NET SDK docs. Just search on "Assembly Registration Tool".
-
How can I get around scope problems in a try/catch?
If you try to instantiate the class inside the try, it'll be out of scope when you try to access it from the catch block. A way to get around this is to do the following: Connection conn = null; try {conn = new Connection();conn.Open();}finally{ if (conn != null) conn.Close(); }By setting it to null before the try block, you avoid getting the CS0165 error (Use of possibly unassigned local variable...
-
Why do I get a security exception when I try to run my C# app?
Some security exceptions are thrown if you are working on a network share. There are some parts of the frameworks that will not run if being run off a share (roaming profile, mapped drives, etc.). To see if this is what's happening, just move the executable over to your local drive and see if it runs without the exceptions. One of the common exceptions thrown under these conditions is System.Security.SecurityException.To...
-
Is there regular expression (regex) support available to C# developers?
Yes. The .NET class libraries provide support for regular expressions. Look at the documentation for the System.Text.RegularExpressions namespace.
-
Is there any sample C# code for simple threading?
Some sample code follows: using System;using System.Threading;class ThreadTest {public void runme() {Console.WriteLine("Runme Called");} public static void Main(String[] args) {ThreadTest b = new ThreadTest();Thread t = new Thread(new ThreadStart(b.runme));t.Start();}}
-
How do you mark a method obsolete?
Assuming you've done a "using System;": [Obsolete]public int Foo() {...}or [Obsolete("This is a message describing why this method is obsolete")]public int Foo() {...}Note: The O in Obsolete is capitalized.
-
Does C# support #define for defining global constants?
No. If you want to get something that works like the following C code:#define A 1use the following C# code: class MyConstants{public const int A = 1;}Then you use MyConstants.A where you would otherwise use the A macro. Using MyConstants.A has the same generated code as using the literal 1.
-
How can I access the registry from C# code?
By using the Registry and RegistryKey classes in Microsoft.Win32, you can easily access the registry. The following is a sample that reads a key and displays its value: using System;using Microsoft.Win32;class regTest{public static void Main(String[] args){RegistryKey regKey;Object value;regKey = Registry.LocalMachine;regKey = regKey.OpenSubKey("HARDWARE\DESCRIPTION\System\CentralProcessor\0");value...
-
Is it possible to have a static indexer in C#?
No. Static indexers are not allowed in C#.
-
Does C# support try-catch-finally blocks?
Yes. Try-catch-finally blocks are supported by the C# compiler. Here's an example of a try-catch-finally block: using System;public class TryTest{static void Main(){try{Console.WriteLine("In Try block");throw new ArgumentException();}catch(ArgumentException n1){Console.WriteLine("Catch Block");}finally{Console.WriteLine("Finally Block");}}}Output: In Try BlockCatch BlockFinally Block
-
If I return out of a try/finally in C#, does the code in the finally-clause run?
Yes. The code in the finally always runs. If you return out of the try block, or even if you do a "goto" out of the try, the finally block always runs, as shown in the following example: using System;class main {public static void Main() {try {Console.WriteLine("In Try block");return;}finally {Console.WriteLine("In Finally block");}}}Both "In Try block" and "In Finally block" will be displayed. Whether...
-
Is it possible to restrict the scope of a field/method of a class to the classes in the same namespace?
There is no way to restrict to a namespace. Namespaces are never units of protection. But if you're using assemblies, you can use the 'internal' access modifier to restrict access to only within the assembly.
-
-
How can I get the ASCII code for a character in C#?
Casting the char to an int will give you the ASCII value: char c = 'f';System.Console.WriteLine((int)c);or for a character in a string: System.Console.WriteLine((int)s[3]);The base class libraries also offer ways to do this with the Convert class or Encoding classes if you need a particular encoding.
-
Can I define a type that is an alias of another type (like typedef in C++)?
Not exactly. You can create an alias within a single file with the "using" directive: using System;using Integer = System.Int32; // aliasBut you can't create a true alias, one that extends beyond the file in which it is declared. Refer to the C# spec for more info on the 'using' statement's scope.
-
How does one compare strings in C#?
In the past, you had to call .ToString() on the strings when using the == or != operators to compare the strings' values. That will still work, but the C# compiler now automatically compares the values instead of the references when the == or != operators are used on string types. If you actually do want to compare references, it can be done as follows: if ((object) str1 == (object) str2) { ... }Here's...
-
How do I register my code for use by classic COM clients?
Use the regasm.exe utility to generate a type library (if needed) and the necessary entries in the Windows Registry to make a class available to classic COM clients. Once a class is registered in the Windows Registry with regasm.exe, a COM client can use the class as though it were a COM class.
-
How do you specify a custom attribute for the entire assembly (rather than for a class)?
Global attributes must appear after any top-level using clauses and before the first type or namespace declarations. An example of this is as follows: using System;[assembly : MyAttributeClass]class X {}Note that in an IDE-created project, by convention, these attributes are placed in AssemblyInfo.cs.
-
Is there an equivalent of exit() for quitting a C# .NET application?
Yes, you can use System.Environment.Exit(int exitCode) to exit the application or Application.Exit() if it's a Windows Forms app.
-
How do I convert a string to an int in C#?
Here's an example: using System;class StringToInt{public static void Main(){String s = "105";int x = Convert.ToInt32(s);Console.WriteLine(x);}}
-
Is there a way of specifying which block or loop to break out of when working with nested loops?
The easiest way is to use goto: using System;class BreakExample {public static void Main(String[] args) {for(int i=0; i<3; i++) {Console.WriteLine("Pass {0}: ", i);for( int j=0 ; j<100 ; j++ ) {if ( j == 10) goto done;Console.WriteLine("{0} ", j);}Console.WriteLine("This will not print");}done:Console.WriteLine("Loops complete.");}}
-
How do I simulate optional parameters to COM calls?
You must use the Missing class and pass Missing.Value (in System.Reflection) for any values that have optional parameters.
-
How do I create a multilanguage, multifile assembly?
Unfortunately, this is currently not supported in the IDE. To do this from the command line, you must compile your projects into netmodules (/target:module on the C# compiler), and then use the command line tool al.exe (alink) to link these netmodules together.
-
Does C# support properties of array types?
Yes. Here's a simple example: using System;class Class1 {private string[] MyField;public string[] MyProperty {get { return MyField; }set { MyField = value; }}}class MainClass{public static int Main(string[] args) {Class1 c = new Class1();string[] arr = new string[] {"apple", "banana"};c.MyProperty = arr;Console.WriteLine(c.MyProperty[0]); // "apple"return 0;}}
-
How do I create a multilanguage, single-file assembly?
This is currently not supported by Visual Studio .NET.
-
Is it possible to have different access modifiers on the get/set methods of a property?
No. The access modifier on a property applies to both its get and set accessors. What you need to do if you want them to be different is make the property read-only (by only providing a get accessor) and create a private/internal set method that is separate from the property.
-
How do you implement thread synchronization (Object.Wait, Notify,and CriticalSection) in C#?
You want the lock statement, which is the same as Monitor Enter/Exit: lock(obj) {// code}translates to: try {CriticalSection.Enter(obj);// code} finally {CriticalSection.Exit(obj);}
-
How do destructors and garbage collection work in C#?
C# has finalizers (similar to destructors except that the runtime doesn't guarantee they'll be called), and they are specified as follows: class C{~C(){// your code}public static void Main() {}}Currently, they override object.Finalize(), which is called during the GC process.
-
How do I declare inout arguments in C#?
The equivalent of inout in C# is ref. , as shown in the following example: public void MyMethod (ref String str1, out String str2) {...}When calling the method, it would be called like this: String s1;String s2;s1 = "Hello";MyMethod(ref s1, out s2);Console.WriteLine(s1);Console.WriteLine(s2);Notice that you need to specify ref when declaring the function and calling it.
-
I was trying to use an "out int" parameter in one of my functions. How should I declare the variable that I am passing to it?
You should declare the variable as an int, but when you pass it in you must specify it as 'out', like the following: int i;foo(out i);where foo is declared as follows: [return-type] foo(out int o) { }
-
Does C# support templates?
No. However, there are plans for C# to support a type of template known as a generic. These generic types have similar syntax but are instantiated at run time as opposed to compile time. You can read more about them here.
-
How do you directly call a native function exported from a DLL?
Here's a quick example of the DllImport attribute in action: using System.Runtime.InteropServices;class C{[DllImport("user32.dll")]public static extern int MessageBoxA(int h, string m, string c, int type);public static int Main() {return MessageBoxA(0, "Hello World!", "Caption", 0);}}This example shows the minimum requirements for declaring a C# method that is implemented in a native DLL. The method...
-
Does C# support C type macros?
No. C# does not have macros. Keep in mind that what some of the predefined C macros (for example, __LINE__ and __FILE__) give you can also be found in .NET classes like System.Diagnostics (for example, StackTrace and StackFrame), but they'll only work on debug builds.
-
What is the syntax for calling an overloaded constructor within a constructor (this() and constructorname() does not compile)?
The syntax for calling another constructor is as follows: class B{B(int i){ }}class C : B{C() : base(5) // call base constructor B(5){ }C(int i) : this() // call C(){ }public static void Main() {}}
-
Why do I get a syntax error when trying to declare a variable called checked?
The word checked is a keyword in C#.
-
webFarm Vs webGardens
A web farm is a multi-server scenario. So we may have a server in each state of US. If the load on one server is in excess then the other servers step in to bear the brunt. How they bear it is based on various models. 1. RoundRobin. (All servers share load equally) 2. NLB (economical) 3. HLB (expensive but can scale up to 8192 servers) 4. Hybrid (of 2 and 3). 5. CLB (Component load balancer).A...
-
What is a Metadata?
Metadata is information about a PE. In COM, metadata is communicated through non-standardized type libraries. In .NET, this data is contained in the header portion of a COFF-compliant PE and follows certain guidelines; it contains information such as the assembly’s name, version, language (spoken, not computer—a.k.a., “culture”), what external types are referenced,...
-
What is managed code and managed data?
Managed code is code that is written to target the services of the Common Language Runtime. In order to target these services, the code must provide a minimum level of information (metadata) to the runtime. All C#, Visual Basic .NET, and JScript .NET code is managed by default. Visual Studio .NET C++ code is not managed by default, but the compiler can produce managed code by specifying ...
-
What is the difference between a namespace and assembly name?
A namespace is a logical naming scheme for types in which a simple type name, such as MyType, is preceded with a dot-separated hierarchical name. Such a naming scheme is completely under control of the developer. For example, types MyCompany.FileAccess.A and MyCompany.FileAccess.B might be logically expected to have functionally related to file access. The .NET Framework uses a hierarchical...
-
What is an assembly?
An assembly is the primary building block of a .NET Framework application. It is a collection of functionality that is built, versioned, and deployed as a single implementation unit (as one or more files). All managed types and resources are marked either as accessible only within their implementation unit, or as accessible by code outside that unit. .NET Assembly contains all the metadata...
-
What is "Common Language Specification" (CLS)?
CLS is the collection of the rules and constraints that every language (that seeks to achieve .NET compatibility) must follow. It is a subsection of CTS and it specifies how it shares and extends one another libraries.
-
What is the output of the following query?
SELECT TRUNC(1234.5678,-2) FROM DUAL;1200
-
-
What is the advantage of specifying WITH GRANT OPTION in the GRANT command?
The privilege receiver can further grant the privileges he/she has obtained from the owner to any other user.
-
What will be the output of the following query
SELECT DECODE(TRANSLATE('A','1234567890','1111111111'), '1','YES', 'NO' );Answer :NOExplanation : The query checks whether a given string is a numerical digit.
-
What will be the output of the following query?
SELECT REPLACE(TRANSLATE(LTRIM(RTRIM('!! ATHEN !!','!'), '!'), 'AN', '**'),'*','TROUBLE') FROM DUAL;TROUBLETHETROUBLE
-
-
Which system tables contain information on privileges granted and privileges obtained?
USER_TAB_PRIVS_MADE, USER_TAB_PRIVS_RECD
-
-
What are interfaces?
Interfaces provide more sophisticated ways to organize and control the objects in your system. The interface keyword takes the abstract concept one step further. You could think of it as a �pure� abstract class. It allows the creator to establish the form for a class: method names, argument lists, and return types, but no method bodies. An interface can also contain fields, but The interface keyword...