1) Write a program in C# to print “HELLO WORLD”?

2) Write a program in C# to print “TutorialandExample” using namespace?

Here, namespace is used to group related classes.

3) What are the types of C# operators?

The types of C# operators are:

  • Arithmetic Operators
  • Logical Operators
  • Relational Operators
  • Bitwise Operators
  • Unary Operators
  • Assignment Operators
  • Ternary Operators
  • Misc Operators

4) Write a program in C# to check the number is EVEN or ODD?

5) What are the types of Generic delegates in C#?

There are three types of Generic delegates in C#:

  • Action
  • Func
  • Predicate

6) What are the types of comment in C#?

There are three types of comment in C#:

    • Single line.

Example: // Single Line Comment.

    • Multiple line.

Example: /* Multiple Line Comment.*/

    • XML comments.

Example: /// XML Comment.

7) What is difference between “is” and “as” operators in c#?

Difference between “is” and “as” operators in C# is:

is operator: It is used to check the compatibility of an object.

It returns the result as Boolean.

as operator: It is used for casting of object to a type.

8) What are the different types of constructors in C#?

There are five types of constructor in C#:

  • Copy constructor
  • Static constructor
  • Private constructor
  • Parameterized constructor
  • Default constructor

9) What is the use of Break statement in C#?

C# Break: It is used to break loop or switch statement.

Example of Break statement:

10) What will be the output of the following code snippet?

11) What is the name of a method which has the same name as that of class and used to destroy objects?


12) List out the characteristics of C#?

The characteristic of C# is:

  • Compatible
  • Simple
  • Consistent
  • Type safe
  • Scalable and Updateable
  • Interoperability
  • Object oriented
  • Modern programming language

13) Name the applications created by the C# .NET?

The applications created by C# .NET are:

  • Web applications.
  • Console applications.
  • Web services.
  • Windows applications.

14) What are the features of namespace?

The features of namespaces are:

  • They are implicitly public.
  • It is not a type.
  • The interfaces, classes, enums, struts and delegates are allowed.
  • It may be nested.

15) What are the types of literals supported by C#?

The types of literals supported by C# are:

  • Single character literals
  • Integer literals
  • String literals
  • Boolean literals
  • Real literals
  • Backslash character literals

16) What is C#?

C# is an object oriented programming language. It is a type-safe and managed language that is compiled by .NET framework.

17) What are the features of C#?

The features of C# are:

  • Indexers
  • Standard Library
  • Boolean Conditions
  • Assembly Versioning
  • Easy-to-use Generics
  • Properties and Events
  • Simple Multithreading
  • Conditional Compilation
  • Integration with Windows
  • LINQ and Lambda Expressions
  • Automatic Garbage Collection
  • Delegates and Events Management

18) What are the advantages of C#?

The advantages of C# are:

  • Easy to learn
  • Component oriented
  • structured language
  • object oriented language
  • Part of .Net Framework
  • It produces efficient programs
  • Compiled on a variety of computer platforms

19) Who is the developer of C#?

Anders Hejlsberg is the developer of C#.

20) Name some of the components of the .Net framework?

The components of the .Net framework are:

  • LINQ
  • ADO.Net
  • Windows Forms
  • Common Type System
  • Metadata and Assemblies
  • ASP.Net and ASP.Net AJAX
  • Common Language Runtime
  • Windows Workflow Foundation
  • Common Language Specification
  • Windows Presentation Foundation
  • Windows Communication Foundation
  • The .Net Framework Class Library

21) What are the different types of IDE available for C#?

The different types of IDE available for C# are:

  • Visual Studio 2010
  • Visual Web Developer
  • Visual C# 2010 Express

22) How to compile a C# program by using command-line?

For Compile: Type csc FileName.cs in the command prompt.

23) What is the extension supported by C#?

C# supports .cs extension only.

24) What is “using” in C#?

using is a keyword that is used for including the namespaces in the program. It is the first statement in any C# program.

25) What are the reserved keywords and contextual keywords available in C#?

The reserved keywords and contextual keywords available in C# are:

Reserved Keywords:

private protected throw void
readonly ref true unchecked
return public while typeof
sealed this sbyte unsafe
short switch sizeof ulong
static struct ushort uint
string stackalloc volatile virtual

Contextual Keywords:

alias get orderby set
ascending group partial (type) add
descending into partial(method) select
dynamic join remove from

26) What are the types of variables used in C#?

The types of variables used in C# are:

  • Value types
  • Pointer types
  • Reference types

27) What is the use of “sizeof” method in C#?

sizeof method is used to get the exact size of a type or a variable on a particular platform.

28) What is Object Type?

Object Type: It is the base class of all data types in C# CTS (Common Type System).

29) What is boxing?

boxing: When a value type is converted to object type.

30) What is unboxing?

unboxing: When an object type is converted to a value type.

31) What is Type Casting?

Type Casting: It is used for converting one type of data to another type.

There are two forms of Type Casting are:

  • Implicit type conversion
  • Explicit type conversion

32) How to convert value types into String type in C#?



33) What is the syntax for declaring nullable data types?

Syntax for declaring nullable data types are:

  1. < data_type>? <variable_name> = null;

34) What are nullable types?

nullable types: It is a special type of data type that is used to assign normal range of values as well as null values.

35) What is Null Coalescing Operator?

Null Coalescing Operator: This operator is used for converting an operand to the type of another nullable value type operand. This operator is used with the nullable value types and reference types.

The Null Coalescing Operator is denoted by: ??.

36) Can we return multiple values from a function in C#?

Yes, we can return multiple values from a function by using output parameters.

37) Which class acts as a base class for all arrays in C#?

The Array class is acts as a base class for all arrays in C#.

38) Can we use multiple inheritance in C#?


39) What is early binding?

early binding: It is the mechanism of linking a function with an object during compile time. It is also known as static binding.

40) Which class acts as a base class for all the data types in .net?

Object Type is the base class for all data types in .net.

41) In how many ways you can pass parameters to a method?

Three ways to pass parameters to a method are:

  • Value parameters
  • Output parameters
  • Reference parameters

42) How the exception handling is done in C#?

By using try…catch block.

43) Can we execute multiple catch blocks in C#?


44) Can we override private virtual method in C#?


45) What are the types of delegates in C#?

The types of delegates in C# are:

  • Single Delegate
  • Generic Delegate
  • Multicast Delegate

46) How encapsulation is implemented in C#?

By using access specifiers.

47) Which method is used to sort an array in C#?

By using Array.sort(array) function.

48) What are the Predefined Attributes of .Net framework?

There are three Predefined Attributes of .Net framework are:

  • Obsolete
  • Conditional
  • AttributeUsage

Pin It on Pinterest

Share This