C#英语面试题

1. Does C# support multiple inheritance?

No, use interfaces instead

2. What’s the implicit name of the parameter that gets passedinto the class’ set method?


Value, and its datatype depends on whatever variable we’rechanging

3. What’s the top .NET class that everything is derivedfrom?


System.Object.

4. How’s method overriding different from overloading?


When overriding, you change the method behavior for a derivedclass. Overloading simply involves having a method with the samename within the class.

5. What is CLR?


The .NET Framework provides a runtime environment called the CommonLanguage Runtime or CLR (similar to the Java Virtual Machine or JVMin Java), which handles the execution of code and provides usefulservices for the implementation of the program. CLR takes care ofcode management at program execution and provides variousbeneficial services such as memory management, thread management,security management, code verification, compilation, and othersystem services. The managed code that targets CLR benefits fromuseful features such as cross-language integration, cross-languageexception handling, versioning, enhanced security, deploymentsupport, and debugging.

6. What is CTS?


Common Type System (CTS) describes how types are declared, used andmanaged in the runtime and facilitates cross-language integration,type safety, and high performance code execution.

7. What is CLS?


The CLS is simply a specification that defines the rules to supportlanguage integration in such a way that programs written in anylanguage, yet can interoperate with one another, taking fulladvantage of inheritance, polymorphism, exceptions, and otherfeatures. These rules and the specification are documented in theECMA proposed standard document, "Partition I Architecture",http://msdn.microsoft.com/net/ecma

8. What is strong name?


A name that consists of an assembly's identity—its simple textname, version number, and culture information (ifprovided)—strengthened by a public key and a digital signaturegenerated over the assembly.

9. What is Application Domain?


The primary purpose of the AppDomain is to isolate an applicationfrom other applications. Win32 processes provide isolation byhaving distinct memory address spaces. This is effective, but it isexpensive and doesn't scale well. The .NET runtime enforcesAppDomain isolation by keeping control over the use of memory - allmemory in the AppDomain is managed by the .NET runtime, so theruntime can ensure that AppDomains do not access each other'smemory. Objects in different application domains communicate eitherby transporting copies of objects across application domainboundaries, or by using a proxy to exchange messages.

10. What is serialization in .NET? What are the ways to controlserialization?


Serialization is the process of converting an object into a streamof bytes. Deserialization is the opposite process of creating anobject from a stream of bytes. Serialization/Deserialization ismostly used to transport objects (e.g. during remoting), or topersist objects (e.g. to a file or database).Serialization can bedefined as the process of storing the state of an object to astorage medium. During this process, the public and private fieldsof the object and the name of the class, including the assemblycontaining the class, are converted to a stream of bytes, which isthen written to a data stream. When the object is subsequentlydeserialized, an exact clone of the original object is created.Binary serialization preserves type fidelity, which is useful forpreserving the state of an object between different invocations ofan application. For example, you can share an object betweendifferent applications by serializing it to the clipboard. You canserialize an object to a stream, disk, memory, over the network,and so forth. Remoting uses serialization to pass objects "byvalue" from one computer or application domain to another. XMLserialization serializes only public properties and fields and doesnot preserve type fidelity. This is useful when you want to provideor consume data without restricting the application that uses thedata. Because XML is an open standard, it is an attractive choicefor sharing data across the Web. SOAP is an open standard, whichmakes it an attractive choice. There are two separate mechanismsprovided by the .NET class library - XmlSerializer andSoapFormatter/BinaryFormatter. Microsoft uses XmlSerializer for WebServices, and uses SoapFormatter/BinaryFormatter for remoting. Bothare available for use in your own code.

11. What are Satellite Assemblies?


Satellite assemblies are often used to deploy language-specificresources for an application. These language-specific assemblieswork in side-by-side execution because the application has aseparate product ID for each language and installs satelliteassemblies in a language-specific subdirectory for each language.When uninstalling, the application removes only the satelliteassemblies associated with a given language and .NET Frameworkversion. No core .NET Framework files are removed unless the lastlanguage for that .NET Framework version is being removed.

12. What is Global Assembly Cache (GAC) and what is the purposeof it?


Each computer where the common language runtime is installed has amachine-wide code cache called the global assembly cache. Theglobal assembly cache stores assemblies specifically designated tobe shared by several applications on the computer. You should shareassemblies by installing them into the global assembly cache onlywhen you need to.

13. What is Reflection in .NET?


All .NET compilers produce metadata about the types defined in themodules they produce. This metadata is packaged along with themodule (modules in turn are packaged together in assemblies), andcan be accessed by a mechanism called reflection. TheSystem.Reflection namespace contains classes that can be used tointerrogate the types for a module/assembly.

14. What is the managed and unmanaged code in .net?


The .NET Framework provides a run-time environment called theCommon Language Runtime, which manages the execution of code andprovides services that make the development process easier.Compilers and tools expose the runtime's functionality and enableyou to write code that benefits from this managed executionenvironment. Code that you develop with a language compiler thattargets the runtime is called managed code; it benefits fromfeatures such as cross-language integration, cross-languageexception handling, enhanced security, versioning and deploymentsupport, a simplified model for component interaction, anddebugging and profiling services

15. What are Namespaces?


The namespace keyword is used to declare a scope. This namespacescope lets you organize code and gives you a way to createglobally-unique types. Even if you do not explicitly declare one, adefault namespace is created. This unnamed namespace, sometimescalled the global namespace, is present in every file. Anyidentifier in the global namespace is available for use in a namednamespace. Namespaces implicitly have public access and this is notmodifiable.

16. What are the access-specifiers available in c#?


Private, Protected, Public, Internal, Protected Internal.

17. Advantage of ADO.Net?


    * ADO.NETDoes Not Depend On Continuously Live Connections
    * DatabaseInteractions Are Performed Using Data Commands
    * Data CanBe Cached in Datasets
    * DatasetsAre Independent of Data Sources
    * Data IsPersisted as XML
    * SchemasDefine Data Structures

 

18. Difference between OLEDB Provider and SqlClient ?


SQLClient .NET classes are highly optimized for the .net /sqlserver combination and achieve optimal results. The SqlClientdata provider is fast. It's faster than the Oracle provider, andfaster than accessing database via the OleDb layer. It's fasterbecause it accesses the native library (which automatically givesyou better performance), and it was written with lots of help fromthe SQL Server team.

19. Differences between dataset.clone anddataset.copy?


Clone - Copies the structure of the DataSet, including allDataTable schemas, relations, and constraints.Does not copy anydata
Copy - Copies both the structure and data for this DataSet.

20. In a Webservice, need to display 10 rows from a table. SoDataReader or DataSet is best choice?


WebService will support only DataSet.

21. What is Remoting?


The process of communication between different operating systemprocesses, regardless of whether they are on the same computer. The.NET remoting system is an architecture designed to simplifycommunication between objects living in different applicationdomains, whether on the same computer or not, and between differentcontexts, whether in the same application domain or not.

22. What’s the difference between System.String andSystem.StringBuilder classes?


System.String is immutable; System.StringBuilder was designed withthe purpose of having a mutable string where a variety ofoperations can be performed.

23. What’s a delegate?


A delegate object encapsulates a reference to a method. In C++ theywere referred to as function pointers.

24. What’s an interface class?


It’s an abstract class with public abstract methods all of whichmust be implemented in the inherited classes

 

1) What is the highest .NET class thateverything is derived from?
A)  System.Data;
B)  System.CodeDom;
C)  System.Object;
D)  System.IO;
2) What is the .NET collection class that allows an element to beaccessed
using a unique key?
A)  ArrayList;
B)  Hashtable;
C)  Stack;
D)  Queue;
3) After user has successfully logged in,user information is notstored in:
A)  ViewState
B)  Cookie
C)  Session
4) A structure in C# can be derived from one or more:
A)  classes
B)  interfaces
C)  both
D)  none
5) Which of the following mode is not available for storage in theASP.NET
  session state?
A)  In-Proc
B)  StateServer
C)  SqlServer
D)  Client-Side
6) How can a web application get configured with thefollowing 
  authorization rules? Anonymous users must not beallowed to access
  the application. All persons except David andJohn must be allowed
  to access the application.
A)  <authorization>
<deny users = "applicationnameDavid,applicationnameJohn" >
<allow roles ="*">
<deny roles = "?">
</authorization>
B)  <authorization>
<deny users = "applicationnameDavid,applicationnameJohn" >
<deny users = "?">
<allow users ="*">
    </authorization>
C)  <authorization>
<allow users ="*">
<deny users = "applicationnameDavid;applicationnameJohn" >
<deny users = "*">
    </authorization>
D)  <authorization>
<allow users ="*">
<deny users = "applicationnameDavid,applicationnameJohn" >
    </authorization>
7) What is the difference between IEnumerator andEnumeration?
A)  IEnumerator is an interface. Enumeration is adatatype.
B)  Both are the same.
C)  IEnumerator is used to define a variable of anEnumeration datatype.
8) What is the fastest way to check whether a string is empty ornot in the following code?
A)  bool isEmpty = (str.Length == 0);
B)  bool isEmpty = (str == String.Empty);
C)  bool isEmpty = (str == "");
D)  bool isEmpty = ( str.Equals(""));
9) What is the output for the following code snipet?
A)  112
B)  123
C)  012
D)  122
interface IAddOne
{
int AddOne();
}
struct FixPoint:IAddOne
{
int _x;
public FixPoint( int x )
{
_x = x;
}
public int AddOne()
{
++_x;
return _x;
}
}
ArrayList pointList = new ArrayList(1);
FixPoint f = new FixPoint(0);
pointList.Add( f );
Console.Write( f.AddOne() );
Console.Write( ((IAddOne)pointList[0]).AddOne() );
FixPoint p = (FixPoint)pointList[0];
Console.Write( p.AddOne() );
10) When creating an MDI application, which of the followingsentences must be used to mark the form as the parent form?
A)  this.IsMdiContainer = true;
B)  this.MdiParent = this;
C)  this.MdiParent = null;
D)  this.IsMdiContainer = false;

11) There is a table name [Table1] in a database,it contains avarcharcolumn named [Col1] and a datetime column named [Col2],and astr which is a string variable in C# code.  WhichSql is right?
A)  strSql = "select * from [Table1] where[Col1]=" + str + " and 
    [Col2]<getdate()";
B)  strSql = "select * from [Table1] where[Col1]='" + str + "' and
    [Col2]<" +getdate();
C)  strSql = "select * from [Table1] where[Col1]='" + str + "' and
    [Col2]<getdate()";
D)  strSql = "select * from [Table1] where [Col1]=str and [Col2]<
    getdate()";   
12) uate these two SQL statements.  Whichstatement is the most correct?
SELECT last_name, salary , hire_date
FROM EMPLOYEES
ORDER BY salary DESC;
SELECT last_name, salary, hire_date
FROM EMPLOYEES
ORDER BY 2 DESC;
A)  The two statements produce identicalresults.
B)  The second statement returns a syntaxerror.
C)  There is no need to specify DESC because theresults are sorted in 
    descending order bydefault. 
D)  The two statements can be made to produceidentical results by
adding a column alias for the salary column in the second SQL
statement.
13) Which function will be run first?
<HTML>
<HEAD>
  <SCRIPTLANGUAGE="javascript">
  function startSub()
  {
    alert("Script Start!");
  }
  function anotherSub()
  {
    alert("Script Run!");
  }
  function endSub()
  {
    alert("Script End!");
  }
  </SCRIPT>
</HEAD>
<BODY >
<script>
  endSub();
</script>
</BODY>
</HTML>
A)  startSub
B)  endSub
C)  anotherSub
D)  onLoad

14) A java script provides 3 dialog boxes. In which dialogbox
    can the operator inputtext?: 
A)  alert
B)  confirm
C)  prompt
15) What is the result of “s”?
<script language=javascript>
var s = ""
var a = 1;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值