Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. Select the correct statement from the following?
Correct Answer is : B C
2. What will be the output for the given set of code?
class A { public int i; public void display() { Console.WriteLine(i); } } class B: A { public int j; public void display() { Console.WriteLine(j); } } class Program { static void Main(string[] args) { B obj = new B(); obj.i = 1; obj.j = 2; obj.display(); Console.ReadLine(); } }
Correct Answer is : Exception occurred
3. What will be the output for the given set of code?
class A { public virtual void display() { Console.WriteLine("A"); } } class B: A { public override void display() { Console.WriteLine(" B "); } } class Program{ static void Main(string[] args) { A obj1 = new A(); B obj2 = new B(); A r; r = obj1; r.display(); r = obj2; r.display(); Console.ReadLine(); }}
Correct Answer is : CLR
4. The modifier used to hide the base class methods is?
Correct Answer is : B 0
5. What will be the output for the given set of code?
class a { public void fun() { Console.WriteLine("base method"); } } class b: a { public new void fun() { Console.WriteLine(" derived method "); } } class Program { static void Main(string[] args) { b k = new b(); k.fun(); Console.ReadLine(); } }
Correct Answer is : 2
6. Which of these data types can be used for a method having a return statement in it?
Correct Answer is : compile time error
7. What is the process of defining more than one method in a class differentiated by parameters known as?
Correct Answer is : 24 bytes
8. Which of these methods is executed first before execution of any other thing that takes place in a program?
Correct Answer is : Compile time error
9. Which of these can be used to differentiate two or more methods having same name?
Correct Answer is : console.writeline(a + ” ” + base.a);
10. What will be the output of the program?
class box { int width; int height; int length; int volume; void volume(int height, int length, int width) { volume = width * height * length; } } class Prameterized_method{ public static void main(String args[]) { box obj = new box(); obj.height = 1; obj.length = 5; obj.width = 5; obj.volume(3, 2, 1); Console.WriteLine(obj.volume); Console.ReadLine(); } }
Correct Answer is : Output : a
11. What will be the output of the given code snippet?
class equality { int x; int y; boolean isequal() { return(x == y); } } class Output { public static void main(String args[]) { equality obj = new equality(); obj.x = 5; obj.y = 5; Console.WriteLine(obj.isequal()); } }
Correct Answer is : base.a();
12. What will be the output of the given code snippet?
class equality { public int x; public int y; public Boolean isequal() { return (x == y); } } class Program { static void Main(string[] args) { equality obj = new equality(); obj.x = 5; obj.y = 5; Console.WriteLine(obj.isequal()); Console.ReadLine(); } }
Correct Answer is : 45293
13. What will be the output of the given code snippet?
class box{ public int width; public int height; public int length; public int volume1; public void volume() { volume1 = width * height * length; } public void volume(int x) { volume1 = x; }} class Program{ static void Main(string[] args) { box obj = new box(); obj.height = 1; obj.length = 5; obj.width = 5; obj.volume(5); Console.WriteLine(obj.volume1); Console.ReadLine(); }}
Correct Answer is : compile time error
14. What will be the output of the given code snippet?
class Program{ static void Main(string[] args) { int x, y = 1; x = 10; if(x != 10 && x / Convert.ToInt32(0) == 0) Console.WriteLine(y); else Console.WriteLine(++y); Console.ReadLine(); }}
Correct Answer is : base
15. Which of following statements are correct about functions?
Correct Answer is : 16, 11
16. What is output of the code?
static void Main(string[] args){ Mul(); m(); Console.ReadLine();}static void Mul(){ Console.WriteLine("4");}static void m(){ Console.WriteLine("3"); Mul();}
Correct Answer is : Variable
17. When a function fun() is to receive an int, a single & a double and it is to return a decimal, then the correct way of defining this function is?
Correct Answer is : a = 15, b = 10
18. How many values does a function return?
Correct Answer is : Good Morning Dr.Gupta
19. Output for the following set of code :
static void Main(string[] args) { int y = 3; y++; if (y <= 5) { Console.WriteLine("hi"); Main(args); } Console.ReadLine(); }
Correct Answer is : -6, 11
20. Which return statement correctly returns the output: