1. Define variable and constant.
A variable can be defined as a meaningful name that is given to a data storage location in the computer memory that contains a value. Every variable associated with a data type determines what type of value can be stored in the variable, for example an integer, such as 100, a decimal, such as 30.05, or a character, such as 'A'.
2. What is a data type? How many types of data types are there in .NET ?
A data type is a data storage format that can contain a specific type or range of values. Whenever you declare variables, each variable must be assigned a specific data type. Some common data types include integers, floating point, characters, and strings. The following are the two types of data types available in .NET:
3. Mention the two major categories that distinctly classify the variables of C# programs.
Variables that are defined in a C# program belong to two major categories: value type and reference type. The variables that are based on value type contain a value that is either allocated on a stack or allocated in-line in a structure. The variables that are based on reference types store the memory address of a variable, which in turn stores the value and are allocated on the heap. The variables that are based on value types have their own copy of data and therefore operations done on one variable do not affect other variables. The reference-type variables reflect the changes made in the referring variables.
4. Which statement is used to replace multiple if-else statements in code.
In Visual Basic, the Select-Case statement is used to replace multiple If - Else statements and in C#, the switch-case statement is used to replace multiple if-else statements.
5. What is the syntax to declare a namespace in .NET?
In .NET, the namespace keyword is used to declare a namespace in the code.
6. What is the difference between constants and read-only variables that are used in programs?
Constants perform the same tasks as read-only variables with some differences. The differences between constants and read-only are