Skip to content

Desi banjara

  • Microsoft AZ-204 Certification Exam Practice Questions – 1 Microsoft AZ-204 Certification Exam
  • “You yourself, as much as anyone in the entire universe, deserve your love and affection.” Buddha Motivational & Inspirational Quotes
  • Azure SQL Database Microsoft Azure
  • I just wanted to take the time and say Happy Birthday to my mom. I don’t know where I would be today without her. I love her to death. We don’t always agree on things, we don’t always get along, and we haven’t always had the greatest bond. But at the end of the day that’s my mother & I love her with everything in me, even though I don’t always show it. Thank you for everything mamma and I hope your day is as special as you are. Birthday Wishes For Mom
  • Even when I don’t see you, the thought of you makes me feel loved. Often, I catch myself doing something right and realize that it was you who taught me to do it. I owe so much to you, Mom! Happy birthday! Birthday Wishes For Mom
  • You have always stood by me, encourage and supported me. May you have the best birthday. Wishing you a very happy birthday. Birthday Wishes
  • Motivational & Inspirational Success Quotes Inspirational Quotes
  • Asp.Net WebApi Interview Questions – Cont. ASP.NET Web API

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

  • Top 20 GIT Interview Questions GIT
  • Interview question: What is boxing and Unboxing in C#? C# development
  • Interview question: In how many ways you can pass parameters to a method? C# development
  • Interview question: What is the use of “using” keyword in C#? C# development
  • Interview question: What are dynamic type variables in C#? C# development
  • Interview question: In c#, How can we create a function which can accept varying number of arguments? C# development

Leave a Reply Cancel reply

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



Archives

  • February 2023
  • February 2022
  • June 2021
  • March 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • July 2020
  • June 2020
  • April 2020
  • December 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • June 2018
  • May 2018
  • April 2018
  • January 2018
  • September 2017
  • August 2017
  • July 2017
  • June 2017
  • May 2017
  • April 2017
  • August 2015
  • May 2015
  • April 2014
  • November 2013

Categories

  • Acer
  • Amazon AWS Certification Exam
  • Amazon Kindle
  • Android phones
  • ASP.Net MVC
  • ASP.NET Web API
  • AWS DevOps Engineer Professional Exam
  • AZ-300: Microsoft Azure Architect Technologies Exam
  • Azure Active Directory
  • Azure App Services
  • Azure Data Factory
  • Azure Logic Apps
  • Azure Mobile Apps
  • Azure Virtual Machine
  • Best Wishes Messages
  • birthday messages for boyfriend
  • Birthday messages For Girlfriend
  • Birthday Wishes
  • Birthday Wishes For Mom
  • Business
  • C# development
  • Cameras
  • Canon
  • Cloud
  • Cloud services
  • digital-cameras
  • Diwali
  • Entrepreneurship
  • eReaders
  • Family Quotes
  • Family Quotes
  • Friendship Quotes
  • Gadgets
  • Games
  • Get Well Soon Messages
  • GIT
  • Good Morning Wishes
  • Google
  • Gratitude Quote
  • Guru Nanak Jayanti
  • Halloween
  • Happiness Quote
  • Happy Diwali Wishes
  • Happy Independence Day Wishes
  • Happy New Year Wishes
  • HTC
  • HTC One
  • HTML
  • I Miss You Messages
  • Inspirational Quotes
  • Inspirational Travel Quotes
  • Interview questions
  • IT/Software development
  • Leadership Quote
  • Life lessons
  • Love Quotes
  • Love shayari
  • Messages
  • 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 Exam AZ-220
  • Microsoft Excel
  • Microsoft Office
  • Microsoft word
  • Mobile phones
  • Motivational & Inspirational Quotes
  • Nature Quotes
  • Nexus
  • Nikon
  • Pixels
  • PL-200: Microsoft Power Platform Functional Consultant Certification
  • PL-900: Microsoft Power Platform Fundamentals
  • postman
  • Quotes
  • Robin Sharma
  • Samsung Galaxy S5
  • Self improvement quotes
  • Self-Confidence Quote
  • SonarQube
  • Sony PlayStation 4
  • SQL
  • SQL Server
  • Success Quotes
  • Travel Quotes
  • Uncategorized
  • Uplifting Quotes
  • WCF (Windows Communication Foundation)
  • Web development
  • Wishes
  • Wishes for Newborn Baby

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org



Recent Posts

  • Azure Data Factory
  • What is Azure Active Directory?
  • Azure Virtual Machine
  • Azure Logic Apps
  • Azure Mobile Apps

Recent Comments

  • Yosianus on Error while sending json model in POST request to web API service using postman
  • “People are like stained-glass windows. They sparkle and shine when the sun is out, but when the darkness sets in their true beauty is revealed only if there is light from within.” Elisabeth Kübler-Ross Motivational & Inspirational Quotes
  • Microsoft AZ-220 Certification Exam Practice Questions – Part 4 Microsoft Exam AZ-220
  • Motivational & Inspirational Success Quotes Inspirational Quotes
  • Don’t count candles See the light, Don’t count years Enjoy your life! Birthday Wishes
  • Happy birthday, On this special day May gladness fill Your every hour With joy to light your way. Birthday Wishes
  • Your age doesn’t matter, the only thing that matters is how you feel! Congrats on your big day – make it special! Birthday Wishes
  • “To my mind, the greatest reward and luxury of travel is to be able to experience everyday things as if for the first time, to be in a position in which almost nothing is so familiar it is taken for granted.” – Bill Bryson Quotes
  • I feel embarrassed today because there is no gift I can buy that matches the gift of life you have given to me. Here’s a birthday wish to a mother who never gave up, from a daughter who is forever grateful for the support. Birthday Wishes For Mom

Copyright © 2023 Desi banjara.

Powered by PressBook News WordPress theme