C# Interview Questions

使用DeepSeek、MCP和AKShare实现智能金融问答系统技术方案 DeepSeek是由深度求索公司开发的大规模语言模型,最新版本DeepSeek-V3采用混合专家(MoE)架构,拥有671B参数,激活37B参数,在多项基准测试中表现优异3。要使用DeepSeek的API服务:访问DeepSeek平台注册账号获取API Key(形如AKShare是基于Python的金融数据接口库,提供股票、基金、期货、宏观经济等领域的海量数据。主要特点包括:免费开源,数据源丰富支持多种数据格式(DataFrame/JSON)持续更新维护安装命令。 阅读详情

This is a list of questions I have gathered from other sources and created myself over a period of time from my experience, many of which I felt where incomplete or simply wrong.  I have finally taken the time to go through each question and correct them to the best of my ability.  However, please feel free to post feedback to challenge, improve, or suggest new questions.  I want to thank those of you that have contributed quality questions and corrections thus far.

There are some question in this list that I do not consider to be good questions for an interview.  However, they do exist on other lists available on the Internet so I felt compelled to keep them easy access.

General Questions

  1. Does C# support multiple-inheritance?
    No.
      
  2. Who is a protected class-level variable available to?
    It is available to any sub-class (a class inheriting this class).
      
  3. Are private class-level variables inherited?
    Yes, but they are not accessible.  Although they are not visible or accessible via the class interface, they are inherited.
      
  4. Describe the accessibility modifier “protected internal”.
    It is available to classes that are within the same assembly and derived from the specified base class.
      
  5. What’s the top .NET class that everything is derived from?
    System.Object.
      
  6. What does the term immutable mean?
    The data value may not be changed.  Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.
      
  7. What’s the difference between System.String and System.Text.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.
      
  8. What’s the advantage of using System.Text.StringBuilder over System.String?
    StringBuilder is more efficient in cases where there is a large amount of string manipulation.  Strings are immutable, so each time a string is changed, a new instance in memory is created.
      
  9. Can you store multiple data types in System.Array?
    No.
      
  10. What’s the difference between the System.Array.CopyTo() and System.Array.Clone()?
    The Clone() method returns a new array (a shallow copy) object containing all the elements in the original array.  The CopyTo() method copies the elements into another existing array.  Both perform a shallow copy.  A shallow copy means the contents (each array element) contains references to the same object as the elements in the original array.  A deep copy (which neither of these methods performs) would create a new instance of each element's object, resulting in a different, yet identacle object.
      
  11. How can you sort the elements of the array in descending order?
    By calling Sort() and then Reverse() methods.
      
  12. What’s the .NET collection class that allows an element to be accessed using a unique key?
    HashTable.
      
  13. What class is underneath the SortedList class?
    A sorted HashTable.
      
  14. Will the finally block get executed if an exception has not occurred?­
    Yes.
      
  15. What’s the C# syntax to catch any possible exception?
    A catch block that catches the exception of type System.Exception.  You can also omit the parameter data type in this case and just write catch {}.
      
  16. Can multiple catch blocks be executed for a single try statement?
    No.  Once the proper catch block processed, control is transferred to the finally block (if there are any).
      
  17. Explain the three services model commonly know as a three-tier application.
    Presentation (UI), Business (logic and underlying code) and Data (from storage or other sources).
      

     

Class Questions

  1. What is the syntax to inherit from a class in C#?
    Place a colon and then the name of the base class.
    Example: class MyNewClass : MyBaseClass
      
  2. Can you prevent your class from being inherited by another class?
    Yes.  The keyword “sealed” will prevent the class from being inherited.
      
  3. Can you allow a class to be inherited, but prevent the method from being over-ridden?
    Yes.  Just leave the class public and make the method sealed.
      
  4. What’s an abstract class?
    A class that cannot be instantiated.  An abstract class is a class that must be inherited and have the methods overridden.  An abstract class is essentially a blueprint for a class without any implementation.
      
  5. When do you absolutely have to declare a class as abstract?
    1. When the class itself is inherited from an abstract class, but not all base abstract methods have been overridden.
    2.  When at least one of the methods in the class is abstract.
      
  6. What is an interface class?
    Interfaces, like classes, define a set of properties, methods, and events. But unlike classes, interfaces do not provide implementation. They are implemented by classes, and defined as separate entities from classes.
      
  7. Why can’t you specify the accessibility modifier for methods inside the interface?
    They all must be public, and are therefore public by default.
      
  8. Can you inherit multiple interfaces?
    Yes.  .NET does support multiple interfaces.
      
  9. What happens if you inherit multiple interfaces and they have conflicting method names?
    It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay.
    To D Investigate
      
  10. What’s the difference between an interface and abstract class?
    In an interface class, all methods are abstract - there is no implementation.  In an abstract class some methods can be concrete.  In an interface class, no accessibility modifiers are allowed.  An abstract class may have accessibility modifiers.
      
  11. What is the difference between a Struct and a Class?
    Structs are value-type variables and are thus saved on the stack, additional overhead but faster retrieval.  Another difference is that structs cannot inherit.
      

Method and Property Questions

 

 

  1. What’s the implicit name of the parameter that gets passed into the set method/property of a class?
    Value.  The data type of the value parameter is defined by whatever data type the property is declared as.
      

     

  2. What does the keyword “virtual” declare for a method or property?
    The method or property can be overridden.
      
  3. How is method overriding different from method overloading?
    When overriding a method, you change the behavior of the method for the derived class.  Overloading a method simply involves having another method with the same name within the class.
      

     

  4. Can you declare an override method to be static if the original method is not static?
    No.  The signature of the virtual method must remain the same.  (Note: Only the keyword virtual is changed to keyword override)
      

     

  5. What are the different ways a method can be overloaded?
    Different parameter data types, different number of parameters, different order of parameters.
      
  6. If a base class has a number of overloaded constructors, and an inheriting class has a number of overloaded constructors; can you enforce a call from an inherited constructor to a specific 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.

Events and Delegates

  1. What’s a delegate?
    A delegate object encapsulates a reference to a method.
      
  2. What’s a multicast delegate?
    A delegate that has multiple handlers assigned to it.  Each assigned handler (method) is called.

XML Documentation Questions

 

 

  1. Is XML case-sensitive?
    Yes.
      
  2. What’s the difference between // comments, /* */ comments and /// comments?
    Single-line comments, multi-line comments, and XML documentation comments.
      
  3. How do you generate documentation from the C# file commented properly with a command-line compiler?
    Compile it with the /doc switch.

Debugging and Testing Questions

 

 

  1. What debugging tools come with the .NET SDK?
    1.   CorDBG – command-line debugger.  To use CorDbg, you must compile the original C# file using the /debug switch.
    2.   DbgCLR – graphic debugger.  Visual Studio .NET uses the DbgCLR.
      

     

  2. What does assert() method 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.
      

     

  3. What’s the difference between the Debug class and Trace class?
    Documentation looks the same.  Use Debug class for debug builds, use Trace class for both debug and release builds.
      

     

  4. Why are there five tracing levels in System.Diagnostics.TraceSwitcher?
    The tracing dumps can be quite verbose.  For applications that are constantly running you run the risk of overloading the machine and the hard drive.  Five levels range from None to Verbose, allowing you to fine-tune the tracing activities.
      

     

  5. Where is the output of TextWriterTraceListener redirected?
    To the Console or a text file depending on the parameter passed to the constructor.
      

     

  6. How do you debug an ASP.NET Web application?
    Attach the aspnet_wp.exe process to the DbgClr debugger.
      

     

  7. What are three test cases you should go through in unit testing?
    1.       Positive test cases (correct data, correct output).
    2.       Negative test cases (broken or missing data, proper handling).
    3.       Exception test cases (exceptions are thrown and caught properly).
      

     

  8. 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.
      

     

ADO.NET and Database Questions

 

 

  1. What is the role of the DataReader class in ADO.NET connections?
    It returns a read-only, forward-only rowset from the data source.  A DataReader provides fast access when a forward-only sequential read is needed.
      
  2. 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.  OLE-DB.NET is a .NET layer on top of the OLE layer, so it’s not as fastest and efficient as SqlServer.NET.
      

     

  3. What is the wildcard character in SQL?
    Let’s 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%’.
      

     

  4. Explain ACID rule of thumb for transactions.
    A transaction must be:
    1.       Atomic - it is one unit of work and does not dependent on previous and following transactions.
    2.       Consistent - data is either committed or roll back, no “in-between” case where something has been updated and something hasn’t.
    3.       Isolated - no transaction sees the intermediate results of the current transaction).
    4.       Durable - the values persist if the data had been committed even if the system crashes right after.
      

     

  5. What connections does Microsoft SQL Server support?
    Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server username and password).
      

     

  6. Between Windows Authentication and SQL Server Authentication, 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.
      

     

  7. What does the Initial Catalog parameter define in the connection string?
    The database name to connect to.
      

     

  8. What does the Dispose method do with the connection object?
    Deletes it from the memory.
    To D answer better.  The current answer is not entirely correct.
      

     

  9. What is a pre-requisite for connection pooling?
    Multiple processes must agree that they will share the same connection, where every parameter is the same, including the security settings.  The connection string must be identical.

Assembly Questions

 

 

  1. 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.
      
  2. What are the ways to deploy an assembly?
    An MSI installer, a CAB archive, and XCOPY command.
      
  3. What is a satellite assembly?
    When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies.
      
  4. What namespaces are necessary to create a localized application?
    System.Globalization and System.Resources.
      
  5. What is the smallest unit of execution in .NET?
    an Assembly.
      
  6. When should you call the garbage collector in .NET?
    As a good rule, you should not call the garbage collector.  However, you could call the garbage collector when you are done using a large object (or set of objects) to force the garbage collector to dispose of those very large objects from memory.  However, this is usually not a good practice.
      
  7. How do you convert a value-type to a reference-type?
    Use Boxing.
      
  8. What happens in memory when you Box and Unbox a value-type?
    Boxing converts a value-type to a reference-type, thus storing the object on the heap.  Unboxing converts a reference-type to a value-type, thus storing the value on the stack.
安装破解IAR EWARM 8.2,提供注册机 IAR Embedded Workbench for ARM(IAR for ARM)是一款微处理器的集成开发环境软件,该集成开发环境中包含了IAR的C/C++编译器、 汇编工具、链接器、库管理器、文本编辑器、工程管理器和C-SPY调试器,支持ARM,AVR,MSP430等芯片。   一、安装 双击运行安装程序,点击Install IAR Embedded Workbench for ARM... 阅读详情

相关推荐

保姆级教程:用再生龙Clonezilla Live给Ubuntu系统做全盘备份与恢复(含BIOS设置避坑)

本文提供了一份详细的Clonezilla Live教程,指导Ubuntu用户如何轻松完成全盘备份与恢复。从启动盘制作、BIOS设置避坑到备份参数解析和恢复操作,涵盖了所有关键步骤和常见问题解决方案,帮助用户高效保护系统数据。

weixin_42116058的博客 641

Learning MySQL and MariaDB

PART II Database Structures To start, let ’s create a database that will contai...

congfen4131的博客 549

STM32 野火MINI 用FontCvtST.exe 生成.c文件 写汉字到文本框 按钮上

STM32 野火MINI 用FontCvtST.exe 生成.c文件 写汉字到文本框 按钮上 参考了好多大神博客,自己写的过程中发现,还有些小细节。 一、打开Notepad写需要的字 另存为 UTF-16LE 也就是Unicode。 二、打开FontCvtST转 删掉所有字 读入test.txt里的字 选择刚才的test.txt 另存为.c文件 改个英文名 复制到RTOS的例程文件夹下 三、打开GUIBuilder 画一个这样的 保存之前要注意路径配置要在当前位置,否则存不上 生成的D

weixin_41376117的博客 1935

便携式文件加密器注册码_使用便携式文件加密工具安全地存储私人文件

便携式文件加密器注册码If you work on multiple computers, you probably cart your data and portable programs around on a USB flash drive. Wouldn’t it be handy to have an easy-to-use portable method of storing and ...

cum44153的博客 966

11n、11ac、11ax和11be MCS表(全网最全)

1、无线协商速率介绍及计算 2、附11n、11ac、11ax 完整MCS速率表

weixin_41500064的博客 2万+

Windows升级保留个人文件和应用灰色?改注册表版本指纹

Windows 升级安装并非简单跳过下一步,安装程序会先读取注册表中 HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion 下的 EditionID、ProductName、CompositionEditionID 等版本指纹,与目标镜像 install.wim/esd 记录的版本类型做双向匹配。若当前系统被识别为 LTSC、精简版或跨版本降级,兼容性扫描会判定升级路径不可用,于是“保留个人文件和应用”变灰,只能全新安装。理解版本指纹与升级可行性表的匹配机制,可

weixin_31986143的博客 371

Fortran出错[已解决]:there is no data-edit-descriptor to match a data-item in the I/O list, unit -5

问题 如题,对于代码 1 logical a 2 a=1 3 write(*,'("nih hao 1",l4)')a 4 write(*,'("this is some different2")')a 5 end 运行时出现了如下错误: forrtl: severe (105): there is no data-edit-descriptor to match a dat...

jslove1997的博客 2421

第三天:Python基础语法详解

Python代码规范与注释最佳实践 摘要: 本文深度解析Python缩进规则与代码结构的技术规范,包括缩进的底层原理、语法规则和错误处理。详细阐述Python注释系统,涵盖行内注释、文档字符串和类型注释等多种形式,并提供工业级代码组织方案。研究显示,良好的缩进可提升40%的代码识别速度,降低50%的认知负荷。文章还对比了Sphinx、pdoc等主流文档生成工具,给出企业级项目中的注释编写原则和模板建议,帮助开发者构建更可维护的Python代码。

本博客聚焦 YOLOv11 全流程落地,涵盖架构优化、数据集处理、训练技巧与多场景部署,兼及国产数据库、Java 开发与 AI 模型应用,内容兼顾理论与工程实践,为开发者提供系统干货,助力高效提升技术能力。 1011

Using the SQL*Loader Utility

Using the SQL*Loader Utility The SQL*Loader utility, which comes with the Oracle database server, is commonly used by DBAs to load external data into an Oracle database. SQL*Loader is an immensely

juliaputao的专栏 1144

使用MATLAB和Simulink来设计并仿真一个智能家居多传感器数据融合系统

智能家居多传感器数据融合系统旨在通过集成来自多种不同类型的传感器的数据,以提供更精确和可靠的环境信息或用户状态监测。例如,将温度、湿度、光照强度、运动检测等多种传感器的数据结合起来,可以更好地了解家庭内部的状态,并做出相应的调整或响应。在这个教程中,我们将使用MATLAB和Simulink来设计并仿真一个智能家居多传感器数据融合系统。

amy_mhd的博客 189

实时系统vxWorks - 虚拟机环境搭建

概述VxWorks 操作系统是美国WindRiver公司于1983年设计开发的一种嵌入式实时操作系统(RTOS),是嵌入式开发环境的关键组成部分。良好的持续发展能力、高性能的内核以及友好的...

不只会拍照的程序猿 7853

C# Interview Question

General Questions1.   Does C# support multiple-inheritance? No.  2.   Who is a protected class-level variable available to? It is available to any sub-class (a class inheriting this class).  3. 

饭后爱 的 软件测试专栏 1106

使用Mask2Former和X-Decoder训练自定义数据集及结果复现报告

本报告记录了使用MMDetection框架中的Mask2Former和X-Decoder模型在自定义数据集上的训练过程。报告包含环境配置、数据集准备、模型训练与优化(解决了Mask2Former的PQ值异常问题)、性能评估等关键环节。详细展示了从数据集转换(将客户提供的COCO格式数据适配MMDetection框架)、配置文件修改、到最终模型训练和评估的全流程。特别针对Mask2Former训练中的PQ值异常问题提供了解决方案,并对比了两种模型在自定义数据集上的表现。报告还包含完整的代码实现和技术细节。

huanghm88的专栏 1094

C# developer interview questions

 C# developer interview questions  A representative of a high-tech company in United Kingdom sent this in today noting that the list was used for interviewing a C# .NET developer. Any corrections

emily_0828的专栏 625

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

Interview questions : Advanced C# questions

1. What's 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 immut...

donggan0667的博客 217

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

c# interview examination questions

What is the difference between Finalize() and Dispose()?Dispose() is called by as an indication for an object to release any unmanaged resources it has held.Finalize() is used for the same pur...

a859501的博客 233

C# Interview Questions and Answers

What's C# ?C# (pronounced C-sharp) is a new object oriented language from Microsoft and is derived from C and C++. It also borrows a lot of concepts from Java too including garbage collection. Is it...

weixin_30847865的博客 1014

2021 Top 100 C#/.NET Interview Questions And Answers

文章目录1. What is the difference between “dispose” and “finalize” variables in C#?2. What does “Jagged Arrays” mean?3. What is a Class and an Object?4. Explain Code compilation in C#5. What is the difference between Virtual method and Abstract method?6. What

Jack @ 优快云 1万+

C# Basic Interview Questions

What is the implicit name of the parameter passed into a property’s ’set’ method?‘value’. And it’s data type depends on whatever variable we’re changing. How do you inherit from a class in C#? Pla...

weixin_34221036的博客 107

无涯教程-C# Interview Questions函数

亲爱的读者,这些C#面试问题是专门设计的,旨在让您了解在C#主题的面试过程中可能遇到的问题的性质。根据我的经验,好的面试官很难在你的面试过程中提出任何特定的问题,通常问题从主题的一些基本概念开始,之后他们继续基于进一步的讨论和你回答−的内容What is C#?C#是由Microsoft开发的一种现代的、通用的、面向对象的编程语言。C#是为公共语言基础结构(CLI)设计的,CLI由可执行代码和运行时环境组成,允许在不同的计算机平台和体系结构上使用各种高级语言。交错数组是数组的数组。

无涯教程 500

(C#) Interview Questions.

(Note: Most are collected from Internet. 绝大部分内容来自互联网) 1. What's the difference between Hashtable and Dictionary? Hashtable and Dictionary are collection of data structures to hold data as key-value...

weixin_30485799的博客 225

C# Interview Questions:C#-English Questions

This is a list of questions I have gathered from other sourcesand created myselfover a period of time from my experience, many of whichI felt where incomplete or simply wrong. I have finally taken...

weixin_30276935的博客 165

转:C# Interview Questions

转自: http://blogs.crsw.com/mark/articles/252.aspx C# Interview Questions This is a list of questions I have gathered from other sourcesand created myselfover a period of time from my experience, ...

weixin_30505043的博客 119
上一篇: 【.NET 学习笔记】修饰符
下一篇: Delegate: What is this? ----什么是Delegate(委托)
浩西
博客等级 码龄19年 47粉丝 48原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值