1. what is C#.NET?
Answer:C#.net is a modern object oriented programming language. It is a complete object oriented programming language which is designed for supporting the main features of .NET Framework. C#.net is an object oriented language which supports the concepts like class, object, inheritance and polymorphism etc.
2. what are the features of C#.NET?
Answer:Some Basic features that make the C#.net so popular in the market are as follows:
- It is easy to understand.
- It is Object-Oriented.
- It provides the supports Graphical User Interface.
- It is most popular language to develop the windows application.
- It is user-friendly language
- It is a structured language.
3. How to execute C#.NET application?
Answer:You can execute a project by any of the following ways:
- Select Debug-> Start Debugging from menu bar.
- Click on the buttonfrom the standard toolbar.
- Press key F5.
4. what is common language runtime?
Answer:CLR is a very important part of the .NET framework which is basically used for executing the application written in any .NET language. It provides the common way to compile the code for language which we use
5. what is base class library?
Answer:Base class library is also an important part of .NET framework which can be used by the all.NET languages. It provides a common library which contains common functions, methods and classes which are same for all .NET languages.
6. what is keyword in C#.NET?
Answer:Every programming language contains some predefined words reserved for its use. These words are known as keywords. One cannot use these keywords as the identifier. Identifier is a name given to the several entities in a program. C#.NET contains some reserved words having some special meaning called keywords.
7. what are identifiers in C#.NET?
Answer:Identifiers are the name given to the various programming elements like variables, array, functions and structures etc. In simple words, identifiers are used to give the name for elements or it is used to identify the elements of the program which we use in the program uniquely.
8. give the name of all data type in C#.NET?
Answer:In C#.Net data types are categorized into three parts which are given below:
- Value Type
- Reference Type
- Pointer Type
9. what is value type in C#.net?
- Value type data types are those data types which contains the actual data value.
- These data types are of fixed length and stored on the stack of memory.
- These data types are stored the copy of the value.
- They are derived from the System.ValueType Class.
10. what is user defined data type?
Answer:User-Defined Types: User-Defined types are those value types which are defined by the users. There are two types of User-Defined types present in C# given below in the table:
11. what is reference type in C#.net?
- Reference Type data types are those data types which contains the reference of the value.
- These data types are of varied length and stored on the heap in memory.
- These data types do not contain copy of value like Value Type. On the other side these contain address of the value.
12. what is pointer type in C#?
- Pointer type data type is only used in the context of unsafe code.
- Pointer Types variables are basically used to store the memory address of variable of any other data type.
- We are giving here the syntax of pointer type data type:
datatype * identifier;
13. what is variables in C#.net?
Answer:A Variable is a name given to storage area of any value in the program. Variable’s name is used to refer the data value stored at particular memory location. The value stored in any variable can be changed at the run time.
14. what is local variable?
Answer:Local Variables are those variables whose scope is within the method where they have been declared.
15. what is static variable?
Answer:Static Variables are those variables which retain their value throughout the program. We can access the static variable with the class name.
16. what is constant?
Answer:Like variables constants are also used to store the data values but the values stored in the constants are fixed that cannot be altered at the time of execution of program.
17. what is literals?
Answer:These fixed values assigned to a constant are known as the ‘Literals’.
18. what are the types of literals in C#.net?
Answer:Literals in C#.Net can be classified into the following categories:
- Boolean Literals
- Integer Literals
- Floating Point Literals
- Character Literals
- String Literals
- The null Literals
19. what is Boolean literal?
Answer:Boolean data type can contains only two literal values that are ‘True’ and ‘False’. No other value can be assigned to Boolean data type.
20. what is integer literal?
Answer:Integer Literals can be specified as the number without any fractions. Integer Literal can be of type int, uint, long or ulong. To specify the uint, long and ulong we used suffix as u/U, l/L and ul/UL respectively, No suffix is used for the int .
21. what is floating point literal?
Answer:Floating-point literals require the use of the decimal point followed by the number’s fractional component. Floating Point Literals can be of type floats and double. To specify the float literal suffix f/F is used and for specify the double literal suffix d/D is used.
22. what is character literal?
Answer:Character literals are enclosed in the single quotes. Like ‘a’ or ‘C’. Character literal can be a simple character or an escape sequence.
23. what is escapes sequence in C#.net?
Answer:Escape sequences are the special characters which have some meaning and started with the backslash.
24. write the all escapes sequence characters in C#.net?
Answer:Following table contains the various character escape sequences with their meanings:
25. what is string literal?
Answer:A string literal is a set of characters enclosed by double quotes. A string literal have also a format like “hello”.
26. what is null literal?
Answer:A null literal contains a null value. The type of a null-literal is the null type.
27. what is type conversion?
Answer:Type conversion is a way to convert one data type into another data type.
28. what are the type of type conversion?
Answer:In C#.Net type conversion can be done in two ways:
- Implicit Type Conversion
- Explicit Type Conversion
29. what is implicit type conversion?
Answer:Implicit type conversion is a way in which one data type is converted into another data type automatically. No data loss occurs in the Implicit Type conversion so it is a type safe conversion. Implicit Type Conversion is basically used where smaller data type is converted into larger data type.
30. what is explicit type conversion?
Answer:Explicit Data Type Conversion is a way in which one data type is converted into another data type with the help of some predefined functions. Explicit type conversion is done with the help of casting. In this type of conversion data loss is occur because the conversion is done forcefully. So it is not a type safe conversion.
31. what is control statement?
Answer:Control statements are the statements that control the program’s flow of execution. These statements are executed sequentially in the same order as they appear in the program but in many situations we have to change the order of execution on the basis of certain conditions.
32. what is selection statement?
Answer:A selection statement is a control statement that allows for choosing between two or more execution paths in a program on the basis of some condition.
33. what is Using System in C#.net?
Answer:This line indicates that the program is using the ‘System’ Namespace.
34. what is namespace?
Answer:A namespace is a collection of classes.
35. what is class?
Answer:A class contains any number of member functions and data members. A class is a blue print for object. It is also called single unit.
36. what is Console.WriteLine() method?
Answer:This line indicates that WriteLine() method belongs to the Console class of System namespace which is used to print the message at the output screen.
37. what is Console.ReadLine() method?
Answer:This line indicates that ReadLine() method belongs to the Console class which is used to taking input from the user or we can say it is an input function.
38. what is operators?
Answer:Operators allow the processing on the primitive data types and objects. Operators take one or more operand as input and give a result after applying operation over them. Like in “a+b”, ‘a’ and ‘b’ are the operands and ‘+’ is an operator which performs the add operation on ‘a’ and ‘b’ operands.
39. List all the operators in C#.net?
Answer:Operators can be divided into several categories as given below in the table:
40. what is the working of bitwise operator?
Answer:Bitwise operators are used to perform operation on the binary representation of a numeric value.
41. write the truth table of logical And operator?
Answer:Logical And Operator (&&):
42. what are the possible value for bool data type.
43. what is nested if?
Answer:A nested if statement contains various structures like if..else statement inside if, if statement inside else etc.
44. what is iteration statements?
Answer:Iteration statements enable the user to perform the same set of statements repeatedly until a specific condition is met. Iteration statements also known as looping statements.
45. give the example of entry level loops?
Answer:While loop and for loop are the entry level loops.
46. what are the jump statements?
Answer:Jump statements enable user to jump to another section of code either on the basis of any condition or without any condition. Jump statement is basically used for the branching which causes the immediate transfer of the control of program to the other section of code.
47. write all the jump statements in C#.net?
Answer:There are five Jump statements present in the C#.net as given below:
48. what is break statement?
Answer:The break statement terminates the closest enclosing loop or switch case statements and program’s control jump on the statement immediately following the loop or switch-case statement.
49. what is continue statement?
Answer:The continue statement forces the program control to go directly to the condition and then continue the next iteration. It means that continue statement stops the current iteration and starts the next iteration.
50. what is goto statement?
Answer:goto statement is a statement that is used when we want to jump on the specific section of code followed by a label. The goto statement is most often used when there is a critical condition and programmer does not find the way to get outside the loop. It is widely used in nested loops.
51. what is jagged array?
Answer:We have array of array, which is called jagged array. Jagged array is an array of array in which each row of jagged array contains its own array and the length of each array can be different.
52. what is param array?
Answer:Sometime on dealing with the method you are not sure about the number of parameters so in that case Param array is used. Param array is used to passing unknown number of parameter to a method.
53. what is enumeration?
Answer:The most basic user defined data type is Enumeration. It arranges a list of items in a sequence and associates a symbolic number to each element. We can say Enumeration is a user defined data type which provides a way for associating a number with a name.
54. what is structure?
Answer:Structure is a user defined data type that is very similar to the class. Structure is a collection of values of dissimilar and similar data types. Structure are basically used where we have to store complete information for any object like ‘student’ so all the information of a student like student-name, age, class, phone number etc. can be stored in a structure type variable.
55. what is method?
Answer:The code that is designed to perform some specific task is known as Method. A method is a basic part of the program. It can solve a certain problem, eventually take parameter and return result.
56. what is pass by value?
Answer:To pass a parameter by value, you simply write the name of parameter. When you pass a parameter by value, the method cannot change the value of the variable. When user pass a variable by a value, just a copy of the variable specified in calling method is passed to the called method, not the actual variable.
57. what is pass by reference?
Answer:To pass the parameter by reference you have to use the ‘ref’ keyword before the parameter’s name. When user pass the parameter by reference the memory address of the variable passed to the method. Thus the method can modify the value of the variable passed by reference.
58. what is return statement?
Answer:Return statement returns the value to the calling method. Return statement is a jump statement that terminates the execution of a method and returns the control back to calling method. Return statement cannot use if we declare the return type of the method as void. You have to declare the return type other than void (int,float etc.) for returning the value from the function.
59. what is recursion?
Answer:A method can also call itself. So the process in which a method calls itself is known as recursion.
60. what is the use of properties?
Answer:There is a situation when we declare all the members of class as private. Then problem is that how can we access these private fields? This can be done by the use of ‘Properties’.
61. what is indexer?
Answer:Indexer allows instance of a class or structure to be indexed as array. The main use of indexers is to support the creation of specialized arrays that are subject to one or more constraints.
62. what is delegates?
Answer:Delegates are the objects which refer to a method. These are like the Pointer to a function in C and C++. Once a delegate refers to a method, the method can be called through that delegate. The main advantage of the delegate is that it allows you to call a method but methods that are actually invoked through delegates can be determined at run time not at compile time.
63. what is multicast delegate?
Answer:Multicasting is the ability to create a chain of methods that will be called automatically when a delegate is invoked. A single delegate that encapsulates more than one method of same signature is known as Multicast Delegate.
64. what is using keyword?
Answer:‘using’ keyword enable the user to use the member present inside a namespace. The namespace used by the .NET Framework C# library is System. All the member that are present in System namespace are used by the using keyword as given below:
65. what is nested namespace?
Answer:One namespace can be nested within another. When referring to a nested namespace from code outside the nested namespaces, both the outer namespace and the inner namespace must be specified, with the two separated by a period.
66. what is global namespace?
Answer:When you don’t declare a namespace for your program, the default Global namespace is used in that case. It means it is not necessary to declare namespace for the program the compiler will consider the default global namespace itself.
67. what is event?
Answer:Events are the certain actions that happen during the execution of program for which the application wishes to be notified about, so it can respond. An event can be a mouse click, keystroke or alarm.
68. what is object?
Answer:Object is instance of class which can access all the members of class. A class is an abstract concept means it is not exist in really but object is a realistic concept which contains all properties of the class. For example if vegetable is a class then potato, leady-finger, bringle etc are its object.
69. what is constructor?
Answer:A constructor is a special method of class that is used to initialize the data members or variables of class. It is executed when the instance or object of the class is created in which it is declared. It has the name as that of class in which it is declared.
70. what is destructor?
Answer:Destructors are just opposite to the constructor. These are executed when an object is about to be destroyed (destroyed by the garbage collector) at the ending of the scope of class. It has the name as that of class in which it is declared but prefixes it with the (~) tilde sign.
71. what is static member of class?
Answer:Static members of class are of two types: static variables and static methods. Static members are accessed using the class name in which they are declared. Static members are associated with the class itself instead of the object of class.
72. what is encapsulation?
Answer:Encapsulation is simple concept which prevents the access to data that is not essential. It is a process of binding the variable and methods together required by an object in a single unit that is class.
73. what is abstraction?
Answer:Abstraction is the process of providing the essential features of an object without providing its background details or explanation.
74. what is the working of private access specifier?
Answer:The members of private access specifer are accessible only inside their own class. A private method or variable cannot be called outside from the same class. It hides its member variable and method from other class and methods.
75. what is the scope of protected access specifier?
Answer:Protected members are accessible in its own class and class derived from its base class. It plays a crucial role in the concept of inheritance.
76. Define internal access specifier?
Answer:Internal members are accessible classes of the same assembly. The variable or classes that are declared with internal can be access by any member within application.
77. what is inheritance?
Answer:The process of sub-classing to a class extends its functionality that is known as Inheritance. The original or existing class is known as base, parent or super class and the class which inherits the functionality of base class is known as the derived, child or sub class.
78. what is interface?
Answer:An Interface is a type whose all members are public and abstract by default. An Interface contains only declaration of members; these members are further defined in the base class. A class can implement more than one interface.
79. what is polymorphism?
Answer:Polymorphism means one name, many forms. Polymorphism is the ability for classes to provide different implementation to the method that are called by same name.
80. what is method overloading?
Answer:Method overloading is a concept where a class can have more than one method with the same name and different parameters.
81. what is operator overloading?
Answer:Operator overloading is a process in which more than one meaning is given to the operator without changing its syntax. The compiler distinguishes between the different meanings of an operator by examining the types of its operands.
82. what is abstract class?
Answer:A class that provides no implementation or incomplete implementation of its functionalities and leaves the task to implement its functionalities to its derived class is known as Abstract class.
83. what is virtual function?
Answer:When you have a function defined in a class that you want to be implemented in an inherited class(es), you use virtual functions. The virtual functions could be implemented differently in different inherited class and the call to these functions will be decided at runtime.
84. what is collection?
Answer:The .NET Framework Class Library provides a number of classes as a collection of different data types. Collection classes normally used to hold collection of values or object in memory. These collection classes provide a mechanism for inserting and retrieving the collection of elements. These classes allocate memory dynamically to the collection of elements. These classes support the stack, queue, array-list and hash-table etc.
85. what is ArrayList class in collection?
Answer:ArrayList class is similar to array but it can store element of any data type. Unlike the array the size of array list is not fix it changes dynamically. An Array List can be constructed as follows:
ArrayList list = new ArrayList();
86. what is HashTable?
Answer:Hashtable store items as key-value pair. Each item in Hashtable is uniquely identified by a key. A Hashtable stores a key and its value as Object Type. Here is the syntax to construct a Hashtable:
Hashtable h1 = new Hashtable();
87. what is SortedList class?
Answer:Sorted List maintains a sorted list of key/value pairs that can be accessed either key or index. The sorted list is similar to the Hashtable; difference is that items are stored according to the key. Here is a syntax to construct a SortedList:
SortedList s1=new SortedList();
88. what is exception?
Answer:An exception can be considered as an error which is caused due to a run time error in a program. When the compiler encounters with the error such as dividing by zero, it creates an exception object and informs us that an error has occurred.
89. what is exception handling?
Answer:If we want that the program remains continue executing the remaining code, we have to catch the exception object thrown by the error condition and display an appropriate message for taking corrective action. This process is known as the exception handling.
90. what is try block?
Answer:The code that may be throw exception which we want to handle is put in the try block. It is followed by one and more catch block.
91. what is catch block?
Answer:The code to handle the thrown exception is put in the catch block just after the try block.
92. what is finally block?
Answer:finally block is always executed whether the exception is thrown or not by the try block.
93. what is throw in exception handling?
Answer:Any method can throw the exception using throw statement when any unexpected event is occur.
94. what are standard exceptions?
Answer:The exceptions which are pre-defined and provide us with the help of some classes called Exception classes by .NET Class Library are known as Standard Exceptions.
95. what is windows form?
Answer:Windows Forms are the interface that are used for designing the visual interface for a Windows application. We can add the controls and any other items from the toolbox to window form by dragging and dropping them or by double clicking on them.
96. what is C#.net control?
Answer:A control is a component which can be used to take input from the user or can be used to display some information to the user. Each control has certain properties, methods and events defined to make it suitable to perform a particular task.
97. what is checkbox control?
Answer:The CheckBox control is a small rectangle with a corresponding text displayed at the right side of it. This text works as a Label for the checkbox. When you want the user to have multiple options to choose from the existing list you use the CheckBox control.
98. what is PictureBox control?
Answer:PictureBox control is used to add the picture on the Windows form. You can place a PictureBox control on the form by drag and drop it from the toolbox.
99. what is Timer control?
Answer:Timer controls are controls that are used to generate periodic events. These controls are called components and they do not appear in a Window at run time. At design time they appear in the component tray below the form in which they are added.
100. what is Menu control?
Answer:A menu control provides a list of options to the user to choose from. It hides these options when they are not needed and thus saves the space in the Windows application.