C#.NET TECHNICAL QUESTIONS

1. Which of the following statements are correct about the C#.NET code snippet given below?
Answer : proc1() can initialize i as well as j.
2. Which of the following statements is correct about the C#.NET program given below?
Answer : The program will output: Base Derived
3. Which Gang of Four design pattern is shown below?
Answer : Singleton
4. Which of the following statements is correct about the C#.NET code snippet given below?
Answer : func() cannot be considered overloaded because: return value cannot be used to distinguish between two overloaded functions.
5. Which of the following ways to create an object of the Sample class given below will work correctly?
Answer : Sample s3 = new Sample(10, 1.2f, 2.4);
6. Which of the following statements are correct about the C#.NET code snippet given below?
Answer : proc1() can initialize i as well as j.
7. Write a program to show difference between value type parameter and refere
Output :
Enter a number: 9
Value Type
---------------------------------
Previous Value: 9
Current Value: 9
---------------------------------
Reference Type
---------------------------------
Previous Value: 9
Current Value: 10
8. Write a program in which accept two argument as parameter from the user and returns four output value as add, subtract, multiplication and division.
Output :
Enter 1st number 7
Enter 2nd number 9
7 +9 = 16
7 - 9 = -2
7 * 9 = 63
7 / 9 = 0.7777778
9. What is the output of the short program below? Explain your answer.
Answer The output will be:
location is null
1/1/0001 12:00:00 AM
10. What is the output of the program below? Explain your answer.
Answer : This program will output the number 10 ten times.
Here’s why: The delegate is added in the for loop and “reference” (or perhaps “pointer”
would be a better choice of words) to i is stored, rather than the value itself.
Therefore, after we exit the loop, the variable i has been set to 10, so by the time each delegate is invoked, the value passed to all of them is 10.