Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. Are the given codes :
1. Myclass class; Myclass class2 = null;
2. int i; int j = 0;
Correct Answer is : 1
2. What is the output of following set of code ?
int a,b; a = (b = 10) + 5;
Correct Answer is : Runtime error
3. What will be output of the following conversion ?
static void Main(string[] args) { char a = 'A'; string b = "a"; Console.WriteLine(Convert.ToInt32(a)); Console.WriteLine(Convert.ToInt32(Convert.Tochar(b))); Console.ReadLine(); }
Correct Answer is : A
4. Select output of the given set of Code :
static void Main(string[] args){ String name = "Dr.Gupta"; Console.WriteLine("Good Morning" + name);}
Correct Answer is : TypeB
5. Select output for the following set of code.
static void Main(string[] args) { int a = 5; int b = 10; int c; Console.WriteLine(c = a-- - ++b); Console.WriteLine(b); Console.ReadLine(); }
Correct Answer is : throws
6. elect output for the following set of code .
static void Main(string[] args) { const int a = 5; const int b = 6; for (int i = 1; i <= 5; i++) { a = a * i; b = b * i; } Console.WriteLine(a); Console.WriteLine(b); Console.ReadLine(); }
Correct Answer is : Throwable
7. Select output for the following set of code.
static void Main(string[] args) { string Name = "He is playing in a ground."; char[] characters = Name.ToCharArray(); StringBuilder sb = new StringBuilder(); for (int i = Name.Length - 1; i >= 0; --i) { sb.Append(characters[i]); } Console.Write(sb.ToString()); Console.ReadLine(); }
Correct Answer is : float somevariable = (float) 12.502D
8. How many Bytes are stored by ‘Long’ Data type in C# .net?
Correct Answer is : Upto 7 digit
9. Choose “.NET class” name from which data type “UInt” is derived ?
Correct Answer is : 4 Bytes
10. Correct Declaration of Values to variables ‘a’ and ‘b’?
Correct Answer is : const float pi = 6.28F
11. Which data type should be more preferred for storing a simple number like 35 to improve execution speed of a program?
Correct Answer is : 1.5 * 10-45 to 3.4 * 1038
12. Which Conversion function of ‘Convert.TOInt32()’ and ‘Int32.Parse()’ is efficient?
1) Int32.Parse() is only used for strings and throws argument exception for null string
2) Convert.Int32() used for data types and returns directly ‘0’ for null string
Correct Answer is : Mantissa is different for ‘16777216’ and ‘16777217’
13. Correct Set of Code for given data ‘a’ and ‘b’ to print output for ‘c’ as 74 ?
Correct Answer is : Depends on big endian or little endian architecture
14. Default Type of number without decimal is?
Correct Answer is : FALSE
15. Correct output for code is?
static void Main(string[] args) { float a = 10.553f; long b = 12L; int c; c = Convert.ToInt32(a + b); Console.WriteLine(c); }
Correct Answer is :
16. What will be the output of the given code snippet?
interface calc { void cal(int i); } public class maths :calc { public int x; public void cal(int i) { x = i * i; } } class Program { public static void Main(string[] args) { display arr = new display(); arr.x = 0; arr.cal(2); Console.WriteLine(arr.x); Console.ReadLine(); } }
Correct Answer is : No ease of doing it. C# don’t provides specifier like %x or %O to be used with ReadLine() OR WriteLine().We have to write our
17. Choose the correct output of the given code snippet?
interface i1{ void fun();}interface i2{ void fun();}public class maths :i1, i2{ void i1.fun() { Console.WriteLine("i1.fun"); } void i2.fun() { Console.WriteLine("i2.fun"); }}class Program{ static void Main(string[] args) { Sample obj = new Sample(); i1 i = (i1) obj; i.fun(); i2 ii = (i2) obj; ii.fun(); }}
Correct Answer is : hello printed infinite times
18. Correct way to implement the interface given below?
interface abc { string name { get; set; } }
Correct Answer is : 1.1
19. Choose the correct output of the following code snippet?
interface i1 { void f1(); } interface i2 :i1 { void f2(); } public class maths :i2 { public void f2() { Console.WriteLine("fun2"); } public void f1() { Console.WriteLine("fun1"); } } class Program { static Void Main() { maths m = new maths(); m.f1(); m.f2(); } }
a) fun2
b) fun1
c) fun1
fun2
d) fun2
fun1
Correct Answer is : Print 5 infinite times
20. In order to avoid ambiguity among an interface derived from two base interfaces with same method name(and signature), the right code among the following given codes is?