C SHARP interview questions part 28

C SHARP interview questions part 28

Take as many assements as you can to improve your validate your skill rating

Total Questions: 20

1. 406; b = a; c = a; a = b; b = c; } a) c = a, b = c b) a = c, b = a c) b = a, c = a d) All of the mentioned

Correct Answer is : All of the mentioned

2. Types of ‘Data Conversion’ in C#?

Correct Answer is : Both Code 1 declares the objects of nullable of type Nullable defined in the System namespace & Code 2 declares a nullable type in much shorter and in more commonly used way using ‘?’

3. ’Implicit Conversion’ follows the order of conversion as per compatibility of data type as :

Correct Answer is : sizeof(type)

4. For the given set of code select the relevant solution for conversion of data type. static void Main(string[] args) { int num1 = 20000; int num2 = 50000; long total; total = num1 + num2; Console.WriteLine("Total is : " +total); Console.ReadLine(); }

Correct Answer is : 96

5. The subset of ‘int’ data type is :

Correct Answer is : 36952

6. Disadvantages of Explicit Conversion are?

Correct Answer is : Polymorphism

7. For the given set of code, is conversion possible? static void Main(string[] args) { int a = 76; char b; b = (char)a; Console.WriteLine(b); Console.ReadLine(); } a) Compiler will generate runtime error b) Conversion is explicit type c) Compiler will urge for conversion from ‘integer’ to ‘character’ data type d) None of the mentioned

Correct Answer is : 100 150 1000

8. Predict the relevant output for the given set of code. static void Main(string[] args){ float sum; int i; sum = 0.0F; for (i = 1; i <= 10; i++) { sum = sum + 1 /(float)i; } Console.WriteLine("sum =" +sum); Console.ReadLine();} a) 2.000 b) 2.910 c) 2.928 d) 3.000

Correct Answer is : All of the mentioned

9. Why are generics used?

Correct Answer is : None of the mentioned

10. Which of these is an correct way of defining generic method?

Correct Answer is : By default methods are virtual

11. Select the type argument of open constructed type?

Correct Answer is : All of the mentioned

12. Choose the correct way to call subroutine fun() of the sample class? class a{ public void x(int p, double k) { Console.WriteLine("k : csharp!"); }}

Correct Answer is : An abstract inherited property cannot be overridden in a derived class

13. Which among the given operators is referred to as ‘address of’ operator?

Correct Answer is : 60

14. Choose the correct statement among the given statements?

Correct Answer is : 1200

15. What is the size of a char pointer?

Correct Answer is : 30

16. After incrementing a float pointer ptr by 1 it would be incremented by __________

Correct Answer is : 75

17. What will be the output of the given code segment? class UnsafeCode{ unsafe static void Main() { int n = 10; void* p = &n; Console.WriteLine(*p); Console.ReadLine(); } }

Correct Answer is : scores had greater value : 13

18. Which among the following is referred as an array of pointers?

Correct Answer is : private

19. Among the given pointer which of following cannot be incremented?

Correct Answer is : static

20. How many values can be returned from a function simultaneously using pointers?

Correct Answer is : protected

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon