Skip to content

Desi banjara

learn and grow together

  • Azure
    • Azure Compute
      • Azure Logic Apps
      • Azure Mobile Apps
      • Azure App Service
      • Azure Serverless Computing
        • Azure Functions
    • Azure Networking services
      • Azure Networking – VNET
    • Azure Database Services
      • Azure SQL
      • Azure Data Factory
      • Azure Databricks
    • Azure Analytics Services
    • Azure Cognitive Services
    • Azure Data and Storage
    • Azure Devops
    • Azure landing zone
    • Azure IaaS
    • Azure Internet of Things (IoT)
      • Azure Machine Learning
      • Azure AI and ML services
    • Azure Migration
    • Microsoft Azure Log Analytics
  • Azure Security
    • Azure Identity and Access Management
    • Azure Active Directory
    • Azure Defender
    • Azure security tools for logging and monitoring
    • Azure Sentinel
    • Azure Sentinel – Data connectors
  • Agile Software development
    • Atlassian Jira
  • Amazon Web Services (AWS)
    • Amazon EC2
    • Amazon ECS
    • AWS Lambda
  • Google
    • Google Cloud Platform (GCP)
    • gmail api
    • Google Ads
    • Google AdSense
    • Google Analytics
    • Google Docs
    • Google Drive
    • Google Maps
    • Google search console
  • Software architecture
    • Service-oriented architecture (SOA)
    • Domain-Driven Design (DDD)
    • Microservices
    • Event-Driven Architecture
    • Command Query Responsibility Segregation (CQRS) Pattern
    • Layered Pattern
    • Model-View-Controller (MVC) Pattern
    • Hexagonal Architecture Pattern
    • Peer-to-Peer (P2P) pattern
    • Pipeline Pattern
  • Enterprise application architecture
  • IT/Software development
    • API development
    • ASP.Net MVC
    • ASP.NET Web API
    • C# development
    • RESTful APIs
  • Cybersecurity
    • Cross Site Scripting (XSS)
    • Reflected XSS
    • DOM-based XSS
    • Stored XSS attacks
    • Ransomware
    • cyber breaches
    • Static Application Security Testing (SAST)
  • Interview questions
    • Microsoft Azure Interview Questions
    • Amazon Web Services (AWS) Interview Questions
    • Agile Software development interview questions
    • C# interview questions with answers
    • Google analytics interview questions with answers
    • Javascript interview questions with answers
    • Python interview questions with answers
    • WordPress developer interview questions and answers
  • Cloud
    • Cloud computing
    • Infrastructure as a Service (IaaS)
    • Platform as a Service (PaaS)
    • Software as a Service (SaaS)
    • Zero Trust strategy
  • Toggle search form
  • What is the best practice for achieving the High availability of applications running on Azure VM having web tier and DB tier? Azure
  • Microsoft AI-900 Certification Exam Practice Questions Microsoft AI-900 Certification Exam
  • SQL Server Interview questions Interview questions
  • Microsoft Azure Log Analytics Microsoft Azure Log Analytics
  • Microsoft PL-900 Certification Exam Practice Questions – 2 PL-900: Microsoft Power Platform Fundamentals
  • What is OutSystems? Low-code development platform
  • Azure Services – Data and Storage Azure
  • Introduction to Graph Theory Graph theory

Top 20 beginner level C# interview questions

Posted on August 4, 2018 By DesiBanjara No Comments on Top 20 beginner level C# interview questions

Top 20 beginner level C# interview questions

  1. What is C#?

C# is a simple, modern, type-safe, managed and object oriented language, which is compiled by .Net framework for generating intermediate language (IL).

It is designed to be a platform-independent language although it is implemented primarily on Windows.

Its syntax is similar to C and C++ syntax.

C# does not support multiple inheritance.

You can user c# to develop any type of application by using .NET we require one .NET language to write the business logic of that application.

Several characteristics of C# are:

  1. Simple
  2. Type safe
  3. Flexible
  4. Object oriented
  5. Compatible
  6. Consistent
  7. Interoperable
  8. Modern

You can use Visual Studio Express (VCE), Visual Studio (VS), Visual Web Developer IDE’s.




 

  1. What are primitive data types in C#?

In C#, According to the type of the data and size of the data, data types are classified into five types. They are:

  • Numerical Data types
    1. Signed numerical data types: sbyte, short, int, long
    2. Unsigned Numerical data types: byte, ushort, uint, ulong
  • Floating float, double, decimal
  • Character related Data types
    1. Char
  • Logical Data Types
    1. Bool
  • General data types
    1. String
    2. Object

The most famous primitive data types are: int, string, object, short, char, float, double, char, bool. They are called primitive because they are the main built-in types, and could be used to build other data types.




 

  1. What are the two types of data types in C#?

There are two types of data type on C#: Value types and Reference types

Value Type:

A data type is a value type if it holds a data value within its own memory space. It means variables of these data types directly contain their values. They are derived from the class System.ValueType.

Example of value types: bool, byte, chae, decimal, double, enum, float, int, long, sbyte, short, strut, uint, ulong, ushort.

When you declare an int type, the system allocates memory to store the value.

In terms of memory allocation, Value types are stored in the Stack.

Reference type

A reference type doesn’t store the actual data directly. Instead, it stores the address where the value is being stored. In other words, a reference type contains a pointer to another memory location that holds the data. If the data in the memory location is changed by one of the variables, the other variable automatically reflects this change in value.

Example of built-in reference types: object, string and dynamic.

In terms of memory allocation, Reference type are stored in the Heap.




 

  1. Can we assign null value into value type variable?

No, but we can assign null values into reference type variable.




  1. How does C# differ from C++?

C# is a high level language that is component oriented while C++ is a low level and indeed platform neutral programming language.

  1. C# does not support #include statement. It uses only using statement.
  2. In C#, class definition does not use a semicolon at the end.
  3. C# does not support multiple inheritance.
  4. Casting in C# is much safer than in C++.
  5. In C# switch can also be used on string values.
  6. In C#, memory management is automatically handled by garbage collector. But in C++, the memory that is allocated in the heap dynamically has to be explicitly deleted.
  7. In C#, pointers can be used only in unsafe mode.

 



  1. Define namespace?

What are the namespaces in C#.NET?

Namespace is a logical grouping of classes. The namespace is a container which will be used to organize the hierarchal set of .Net classes.

Namespace is designed for providing a way to keep one set of class names separate from another. The class names declared in one namespace does not conflict with the same class names declared in another.

Example:

Using System;

Using System.Collection.Generic;

Using System.Windows.Forms;

 

  1. What is the use of using statement in C#?

In C#, we use “using” keyword for two different purpose.

  • “Using” keyword is used to include a namespace in the program. A program generally has multiple using statements.

 

  • The using statement is used to obtain a resource, execute a statement, and then dispose of that resource.

Example:

using (SqlConnection dbConn = new SqlConnection(conn)){     // Your code} // automatically does the .Dispose call as if it was in a finally block

 

  1. What is mean by operators in C#?

Operators, in C#, are symbols used within an expression or statement to specify the operations to be performed during evaluation of the expression. Operators are program elements that can be applied to one or more operands in an expression to perform computations. The operands used with the operator can be literals, fields, local variables and expressions.

There are three kinds of operators:

Unary operators,

Binary operators,

And conversion operators.

All operators must be declared as public and static.




  1. What is Jagged Array in C#?

A jagged array is an array whose elements are arrays. The elements of a jagged array can be of different dimensions and sizes. A jagged array is also called an “array of arrays.”

You can initialize a jagged array as –

int [ ][ ] myArray = new int [2][ ] {new int [ ]{10,11,12}, new int [ ] {8,9,10,11}};

Where, myArray is an array of two arrays of integers – myArray [0] is an array of 3 integers and myArray[1] is an array of four integers.

 

  1. In how many ways you can pass parameters to a method?

There are three ways we can pass parameters to a method:

Value parameters – This method copies the actual value of an argument into the formal parameter of the function. In this case, changes made to the parameter inside the function have no side effect on the argument.

Reference parameters – This method copies the reference to the memory location of an argument into the formal parameter. This means that changes made to the parameter affect the argument.

Output parameters – This method helps in returning more than one value.

  

  1. Can you return multiple values from a function in C#?

Yes, by using output parameters, we can return multiple values from a function in C#. A return statement can be used for returning only one value from a function. However, using output parameters, you can return two values from a function.

 

  1. What is the difference between ref and out parameters?

Reference parameter copies the reference to the memory location of an argument into the formal parameter. This means that changes made to the parameter affect the argument.

Output parameters are similar to reference parameters, except that they transfer data out of the method rather than into it.

 

  1. Which class act as a base class for all the data types in .net?

The Object Type is the ultimate base class for all data types in C# Common Type System (CTS). Object is an alias for System.Object class. The object types can be assigned values of any other types, value types, reference types. Predefined or user-defined types. However, before assigning values, it needs type conversion.

 

  1. What is boxing and Unboxing in C#?

Boxing: is the process of converting from VALUE type to REFERENCE type.

Ex: converting from int to object

Unboxing: is the process of converting from REFERENCE type to VALUE type.

Ex: converting from object to int

 

  1. What are dynamic type variables in C#?

You can store any type of value in the dynamic data type variable. Type checking for these types of variables takes place at runtime.

Syntax:

dynamic <variable_name> = value;

Example:

dynamic d = 20;

 

  1. What is the difference between dynamic type variables and object type variables?

Dynamic types are similar to object types except that type checking for object type variables takes place at compile time, whereas for the dynamic variables type checking take place at run time.

 

  1. What are nullable types in C#?

C# provides a special data types, the nullable types, to which you can assign normal range of values as well as null values.

 

  1. What is the use of NULL Coalescing Operator (??) in C#?

The Null coalescing operator is used with the nullable value types and reference types. It is a binary operator that simplifies checking for null values.

If the value of the first operand is null, then the operator returns the value of second operand, otherwise it returns the value of the first operand.

Example:  x ?? y

if x is null, it will return y else x

 

  1. What is the purpose of “is” operator in C#?

“is” operator determines whether an object is of certain type.

Ex-

If (David is Employee) // checks if David is an object of the Employee class.

 

  1. What is the purpose of “as” operator in C#?

“as” operator casts without raising an exception if the cast fails.

Example:

Object message = new StringReader (“desibanjara”);

StringReader newMessage = message as StringReader;

[amazon_link asins=’9351190900,1787287041,007070368X,8120352068,9352136640,8120349172,9386873583,9351343189,B016Z18MLG|1840787198,B016Z18MLG,0985580135,1119458684,1484230175,1119428114,1491987650,1491988533,1119449278′ template=’ProductGrid’ store=’desibanjara22-21|desibanjaraco-21′ marketplace=’IN|UK’ link_id=’c651b5ad-93d9-11e8-b332-e523a69d9d98′]

C# development, Interview questions, IT/Software development Tags:C#, C# development, Interview questions, IT/Software development

Post navigation

Previous Post: Interview question: How to sort an array in C#?
Next Post: Asp.Net WebApi Interview Questions

Related Posts

  • Interview question: What are primitive data types in C#? C# development
  • Object Oriented Programming (OOP) in C# C# development
  • C# interview Questions – What is struct in C#? C# development
  • Interview question: What are the types of arrays in C#? C# development
  • Interview question: Describe the difference between a Thread and a Process? C# development
  • C# Interview questions – How to get one/two year back from current date C# development

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.



Categories

  • Agile Software development
  • AI Writing & Automation
  • Amazon AWS Certification Exam
  • Amazon EC2
  • Amazon ECS
  • Amazon Web Services (AWS)
  • Apache Kafka
  • API development
  • API development
  • Apple Mac
  • Applications of Graph Theory
  • ARM templates
  • Artificial intelligence
  • ASP.NET Core
  • ASP.Net MVC
  • ASP.NET Web API
  • Atlassian Jira
  • Availability zones
  • AWS DevOps Engineer Professional Exam
  • AWS Lambda
  • AZ-300: Microsoft Azure Architect Technologies Exam
  • Azure
  • Azure Active Directory
  • Azure AD B2C
  • Azure AD Domain Services
  • Azure AI and ML services
  • Azure Analytics Services
  • Azure App Service
  • Azure Application Gateway
  • Azure Archive Storage
  • Azure Blob Storage
  • Azure Cache for Redis
  • Azure Cognitive Services
  • Azure Compute
  • Azure Container Instances (ACI)
  • Azure Core Services
  • Azure Cosmos DB
  • Azure Data and Storage
  • Azure Data Factory
  • Azure Data Lake Storage
  • Azure Database for MySQL
  • Azure Database for PostgreSQL
  • Azure Database Migration Service
  • Azure Database Services
  • Azure Databricks
  • Azure DDoS Protection
  • Azure Defender
  • Azure Devops
  • Azure Disk Storage
  • Azure ExpressRoute
  • Azure File Storage
  • Azure Firewall
  • Azure Functions
  • Azure HDInsight
  • Azure IaaS
  • Azure Identity and Access Management
  • Azure instance metadata service
  • Azure Internet of Things (IoT)
  • Azure Key Vault
  • Azure Kubernetes Service (AKS)
  • Azure landing zone
  • Azure Lighthouse
  • Azure Load Balancer
  • Azure Logic Apps
  • Azure Machine Learning
  • Azure Machine Learning
  • Azure Migration
  • Azure Mobile Apps
  • Azure Network Watcher
  • Azure Networking – VNET
  • Azure Networking services
  • Azure Pricing and Support
  • Azure Pricing Calculator
  • Azure Queue Storage
  • Azure regions
  • Azure Resource Manager
  • Azure Security
  • Azure Security Center
  • Azure Security Information and Event Management (SIEM)
  • Azure security tools for logging and monitoring
  • Azure Security, Privacy, Compliance, and Trust
  • Azure Sentinel
  • Azure Sentinel – Data connectors
  • Azure Serverless Computing
  • Azure Service Level Agreement (SLA)
  • Azure SLA calculation
  • Azure SQL
  • Azure SQL Database
  • Azure Storage
  • Azure Stream Analytics
  • Azure Synapse Analytics
  • Azure Table Storage
  • Azure Virtual Machine
  • Azure VNET
  • Azure VPN Gateway
  • Blogging
  • Business
  • C# development
  • C# interview questions with answers
  • Career success
  • CDA (Clinical Document Architecture)
  • ChatGPT
  • CI/CD pipeline
  • CISSP certification
  • CKEditor
  • Cloud
  • Cloud computing
  • Cloud Computing Concepts
  • Cloud FinOps
  • Cloud FinOps Optmisation
  • Cloud services
  • COBIT
  • Command Query Responsibility Segregation (CQRS) Pattern
  • Configure SSL offloading
  • Content Creation
  • Content management system
  • Continuous Integration
  • conversational AI
  • Cross Site Scripting (XSS)
  • cyber breaches
  • Cybersecurity
  • Data Analysis
  • Data Clean Rooms
  • Data Engineering
  • Data Warehouse
  • Database
  • DeepSeek AI
  • DevOps
  • DevSecOps
  • Docker
  • DOM-based XSS
  • Domain-Driven Design (DDD)
  • Dynamic Application Security Testing (DAST)
  • Enterprise application architecture
  • Event-Driven Architecture
  • GIT
  • git
  • gmail api
  • Google
  • Google Ads
  • Google AdSense
  • Google Analytics
  • Google analytics interview questions with answers
  • Google Cloud Platform (GCP)
  • Google Docs
  • Google Drive
  • Google Flights API
  • Google Maps
  • Google search console
  • Graph Algorithms
  • Graph theory
  • Healthcare Interoperability Resources
  • Hexagonal Architecture Pattern
  • HL7 vs FHIR
  • HTML
  • IBM qradar
  • Information security
  • Infrastructure as a Service (IaaS)
  • Internet of Things (IoT)
  • Interview questions
  • Introduction to DICOM
  • Introduction to FHIR
  • Introduction to Graph Theory
  • Introduction to HL7
  • IT governance
  • IT Infrastructure networking
  • IT/Software development
  • Javascript interview questions with answers
  • Kubernetes
  • Layered Pattern
  • Leadership
  • Leadership Quote
  • Life lessons
  • Load Balancing Algorithms
  • Low-code development platform
  • Management
  • Microservices
  • Microservices
  • Microsoft
  • Microsoft 365 Defender
  • Microsoft AI-900 Certification Exam
  • Microsoft AZ-104 Certification Exam
  • Microsoft AZ-204 Certification Exam
  • Microsoft AZ-900 Certification Exam
  • Microsoft Azure
  • Microsoft Azure certifications
  • Microsoft Azure Log Analytics
  • Microsoft Cloud Adoption Framework
  • Microsoft Exam AZ-220
  • Microsoft Exam AZ-400
  • Microsoft Excel
  • Microsoft Office
  • Microsoft Teams
  • Microsoft Teams
  • Microsoft word
  • Model-View-Controller (MVC) Pattern
  • Monitoring and analytics
  • NoSQL
  • OpenAI
  • OutSystems
  • Peer-to-Peer (P2P) pattern
  • Personal Growth
  • Pipeline Pattern
  • PL-100: Microsoft Power Platform App Maker
  • PL-200: Microsoft Power Platform Functional Consultant Certification
  • PL-900: Microsoft Power Platform Fundamentals
  • Platform as a Service (PaaS)
  • Postman
  • Project management
  • Python interview questions with answers
  • Rally software
  • Ransomware
  • Reflected XSS
  • RESTful APIs
  • Rich Text Editor
  • SC-100: Microsoft Cybersecurity Architect
  • Scrum Master Certification
  • Service-oriented architecture (SOA)
  • SIEM
  • Software architecture
  • Software as a Service (SaaS)
  • SonarQube
  • Splunk
  • SQL
  • SQL Azure Table
  • SQL Server
  • Startup
  • Static Application Security Testing (SAST)
  • Stored XSS attacks
  • System Design Interview
  • Table Storage
  • Test Driven Development (TDD)
  • TinyMCE
  • Top technology trends for 2023
  • Types of Graphs
  • Uncategorized
  • User Experience (UX) design
  • Version control system
  • virtual machine scale set
  • visual studio
  • WCF (Windows Communication Foundation)
  • Web development
  • Windows Hello
  • WordPress
  • WordPress developer interview questions and answers
  • Yammer
  • Zero Trust strategy



Recent Posts

  • Ace Your FAANG System Design Interview like Google & Amazon: The 8 Whitepapers You Must Read
  • From $0 to $10K/Month Writing Online – The Exact Roadmap to Build a Profitable Writing Career
  • How to Write an AI-Generated Article That Feels 100% Human Using ChatGPT
  • DeepSeek AI: The OpenAI Rival You Didn’t See Coming (But Should)
  • 10 Ways AI is Revolutionizing Healthcare (And Why Your Doctor Might Just Be a Robot Soon)
  • Azure SLA calculation Azure Service Level Agreement (SLA)
  • Exam AZ-900 – AZURE FUNDAMENTALS Azure
  • What is Azure App Services? Microsoft Azure
  • Microsoft AI-900 Certification Exam Practice Questions -2 Microsoft AI-900 Certification Exam
  • Interview question: What is Jagged Array in C#? C# development
  • Unlocking the Power of Yammer: A Comprehensive Guide on Implementation, Usage, and Customisation Microsoft
  • Azure Web Apps Azure
  • Sample Exam Questions 2: AZ-300: Microsoft Azure Architect Technologies AZ-300: Microsoft Azure Architect Technologies Exam

Copyright © 2025 Desi banjara.

Powered by PressBook News WordPress theme