C# programming language

Jan 11 • General • 3070 Views • 5 Comments on C# programming language

Q.1 Define C# programming Language?

Ans. It is also known as C sharp programming lang. It is a multi-paradigm programming language encompassing strong typing, imperative, declarative, functional, generic, object-oriented, component-oriented programming desciplines. It is developed by Microsoft within its NET initiatives and later approved as std. by ECMA and ISO. It is designed for common lang. infrastructure.

Q.2 Explain the syntax of C# programming language?


  • Semicolon is used to represent the end of the sentence.
  • Curly braces are used for group statements.
  • Equal to (=) sign is used to assign the value & successive equal to sign (==) are used to comparison.
  • Array is declared using square bracket.

Q.3 Explain boxing & unboxing in C#?

Ans. boxing is a operation of converting a value type object into a value of corresponding reference type.  It is implicit in C#.

Unboxing is operation of converting a value of reference type to a value of value type. It is exciplicit type in C#.

Q.4 what do u mean by Generics in C#?

Ans. It was added in 2.0 version of C# lang. It use type parameters, which make it possible to design classes and methods that do not  specify the type used until the class or method is instantiated. Advantage is that user can create classes using generic type parameters and method that can be used without incurring the cost of run time casts or boxing operations.

Q.5 Write a program to print “HELLO” in C#?

Ans. using system;

class program


static void Main()





Q.6 Compare C# & JAVA?

Ans.                Data Types                                      JAVA                               C#

  • single root type system                                        No                                Yes
  • Signed Integer                                                     Yes                               Yes
  • Unsigned integer                                                  No                                Yes
  • Character                                                            Yes                                Yes
  • Date/time                                                  Yes, reference type       Yes, value type
  • IEEE 754 binary 32 floating point no.                   Yes                                Yes
  • IEEE 754 binary 64 floating point no.                   Yes                                 Yes
  • Boolean type                                                        Yes                                Yes

Q.7 Explain code comments in C#?

Ans. C# uses double slash (//) to indicate rest of the line as comment. This is inherited from C++.

public class AB


// a comment

public static void Bar(int firstpara) {}  // a comment


multi-line comment starts with slash- asterisk (/*) and end with asterisk- slash (*/). It is inherited from std. C

public class AB


/* A multi-line comment

comment */

public static void Bar(int firstpara) {}


Q.8 Explain preprocessor of C#?

Ans. C# features “preprocessor directive” based on C preprocessor that allows the user to define symbols but not macros. Conditionals such as #if, #endif and #else are also provided. Directives such as #region give hints to programmer for code folding

public class AB


#region constructors

public AB() {}

public AB(int firstpara) {}



Q.9 Explain common type system of C#?

Ans. C# has a unified type system. This Common type system is also known as unified type system. Unified type system implies that all types, include primitives such as integers, such subclasses of the system object class.

Common Type System separates data types into 2 categories

  1. Value types
  2. Reference types

Q.10 Explain Design goal of C#?


  • It is intended to simple, modern, general purpose and object oriented programming.
  • It is developed to design software component suitable for deployment in distributed environments.
  • Support for internationalization us very important.
  • Source code of C# is portable.

Tell us Your Queries, Suggestions and Feedback

Your email address will not be published.

5 Responses to C# programming language

  1. Ritika says:

    many students who have not done an additional course from C#, could use these questions as a magic potion to get a brush up!

  2. Ankita Prajapati says:

    This article is beneficial for those who want to know which type of questions ..

  3. sakshi chaudhary says:

    this post has questions and answers including basic concept of C programming language,which is very helpful to clear the queries related to the concept..!!!!

  4. saurabh singh says:

    I Think this post is helpful to learn basic concepts of ” C# Programming language”.

  5. Siddhant Tripathi says:

    Introduction to the C# programming language concepts.

« »