C# Interview Questions - 2 | Snaprecruit.com

C# Interview Questions - 2 | Snaprecruit.com

C SHARP interview questions part 2

C SHARP interview questions part 2

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

Total Questions: 20

1. Correct the output for the C#.NET code given below? enum letters{ a, b, c} letters l;l = letters.a;Console.writeline(l);

Correct Answer is : 105.8546

2. Correct output for the C#.NET code given below is? enum colors { red, black, pink } colors s = colors.black; type t; t = c.GetType(); string[] str; str = Enum.GetNames(t); Console.WriteLine(str[0]);

Correct Answer is : 90

3. Choose the correct statement about enum used in C#.NET ?

Correct Answer is : -84

4. Which among the following differentiates enum in C#.NET from enum in C language?

Correct Answer is : ‘*’ > ‘/’ > ‘%’ > ‘+’

5. Which of these clauses will be executed even if no exceptions are found?

Correct Answer is : -2 -2 -2

6. A single try block must be followed by which of these?

Correct Answer is : My name

7. Which of these exceptions will occur if we try to access the index of an array beyond its length?

Correct Answer is : A

8. Which of the following keywords is used by the calling function to guard against the exception that is thrown by called function?

Correct Answer is : foreach (int j in i);

9. Which of these classes is related to all the exceptions that are explicitly thrown?

Correct Answer is : 89

10. Select a convenient declaration and initialization of a floating point number:

Correct Answer is : ‘a’ is a reference to an object of a class that compiler drives from ‘System.Array’ class

11. Number of digits upto which precision value of float data type is valid ?

Correct Answer is : Allows unlimited elements as well as rows which had ‘0’ or are empty in nature

12. Valid Size of float data type is ?

Correct Answer is : ’a’ represents rectangular array of 2 columns and 3 arrays

13. Correct way to define a value 6.28 in a variable ‘pi’ where value cannot be modified ?

Correct Answer is : Code runs successfully and prints given on console

14. Select correct set of code to display the value of given variable ‘c’ as ‘25.302’.

Correct Answer is : Declaring array in C# the square bracket([]) comes after the type but not after identifier

15. Minimum and Maximum range of values supported by ‘float’ data type are ?

Correct Answer is : Linker

16. Why does a float variable stop incrementing at number ‘16777216’ in given code in C#? float a = 0 ; while (true) { a++; if (a > 16777216) break; }

Correct Answer is : [assembly: AssemblyDescription(“Csharp”)].

17. Select the output of the following set of code ? static void Main(string[] args){ int x = 1; float y = 2. 4f; short z = 1; Console. WriteLine((float) x + y * z - (x + = (short) y) ); Console. ReadLine();} a) 0.4000004 b) 0.4000023 c) 0.0400021 d) 0.4000001

Correct Answer is : By name

18. A float occupies 4 bytes. If the hexadecimal equivalent of these 4 bytes are A, B, C and D, then when this float is stored in memory in which of the following order do these bytes gets stored ?

Correct Answer is : [Serializable()] class sample

19. The Default value of Boolean Data Type is ?

Correct Answer is : Namespace

20. Select the output choice for the following set of code: public static void Main(string[] args) { double ZERO = 0; Console.WriteLine("RESULT OF DIVISION BY ZERO IS :{0}", (0 / ZERO)); Console.ReadLine(); }

Correct Answer is : The CLR can change the behaviour of the code depending on attributes applied to it

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon