Dot Net Ad
Dot Net Ad
a) string
b) delegate
c) enum
d) int
class SampleClass
Console.WriteLine("Addition is {0}",(num1+num2));
Console.WriteLine("Multiplication is {0}",(Val1*Val2));
class Program
testDelegate += SampleClass.GetMul;
Console.ReadLine();
Ans: Addition is 8
Multiplication is 16
Final Result 8
using System;
class Program
Console.WriteLine(fruit2);
Console.ReadLine();
Ans : Benene
using System;
class DynamicDemo
{
static void Main(string[] args)
val2 = val1;
Console.WriteLine("val1={0},val2={1}",val1.GetType(),val2.GetType());
Console.ReadLine();
Ans : val1=System.Int32,val2=System.Int32
5 ) The class which doesn't allow objects creation, but represents as parent class of child classes, is
known as ____________
a) Static
b) Sealed
c) Abstract
d) Partial
Ans: Abstract
a. Application which refers private assembly will have its own copy of the assembly
b. There will be only one copy of the assembly and it will be stored in Global assembly cache
options:
a) only a
b) only b
c) Both a and b
d) Neither a nor b
class Program {
num[0] = 11;
int[] numbers = { 1, 2, 3 };
Method(numbers);//line2
Console.WriteLine(numbers[0]);
Ans : 11
using System;
class A
public A()
class B : A
public B()
{
Console.Write("Class B" + " ");
class ConstructorChainDemo
options:
a) class A class B
b) class B class A
c) class B
d) class A
Ans: class A
9) Consider the following languages specifications which must be met by a programming component
to be re-used across multiple languages:
c) Attributes
d) JIT Compiler
Ans: CLS
b) static polymorphism
c) abstract class
d) encapsulation
using System;
class StaticDemo
static StaticDemo()
number = number + 1;
public StaticDemo()
number = number + 1;
class NormalConstructionProgram
}
options:
a) 100
b) 101
c) 102
d) 103
Ans: 102
d) a generic declared to hold integer values can hold both integer and string values
13) ___________ class is used to find out object's metadata i.e, methods, fields, properties at
a) System.Type
b) System.Reflection
c) System.Assembly
d) System.String
Ans: System.Type
class Test
public Test()
}
public Test(int num2)
Console.Write(num2);
class program
Ans : 10 10
using System.Collections;
using System;
{
ArrayList fruits = new ArrayList(){"Apple", "Banana", "Orange" };
fruits.Insert(2, "Grapes");
fruits.Add("Bilberry");
Console.WriteLine(item);
class Program
num[0]=11;
Method(numbers);
Console.WriteLine(numbers[0]);
Options:
a) 11
b) 1
d) 11 2 3
Answer: 11
18) Identify the keyword used to specify that the class cannot participate in inheritance?
a) abstract
b) sealed
c) virtual
d) override
Answer: b) Sealed
num1 += num;
obj1.Display(10);
obj2.Display(20);
}
Answer: Value of num1 is 65 Value of num1 is 85
class Program
second = first;
foreach(int j in second)
Console.WriteLine(j);
Answer: Prints 6 7
21) Which access specifier can be accessed anywhere in the Assembly but not outside the Assembly?
a) internal
b) public
c) private
d) protected
Answer: a) internal
using System;
class Employee
int id;
public int Id
Options:
a) Automatic properties
c) Abstraction
d) Asymmetric property
enum Numbers
One=100,
Two, Three
class Program
Console.WriteLine((int)Numbers. Three );
Answer : 102
Console.WriteLine(num.GetValueOrDefault()
Answer: 0(zero)
{
static void Method(int[] num) {
num(0] = 11
Method(numbers)
Console.WriteLine(number[0]);
}}
Answer = 1 1
class Demo (
static int x;
int y
Demo(){
X++;
Y++;
Answer = 1 1 2 1
second = first;
foreach(int j in second)
Console.WriteLine(j);
}}}
Answer – 6,7
class Program{
a = a +1:
b= b+ 2;
c = a + b;
d = c -1;
}}
Answer – 10 20 33 32
public Test()
Console.Write(num1+" ");
Console.Write(num2);
class Program
}}
Answer – 10 10
30)using System;
num1 += num;
}}
Obj1.Display(10);
Obj2.Display(20);
}}
class NamedParameterExample
32)using System;
Class DynamicDemo
Dynamic val2=”jyothi”;
Val2=val1;
Console.WriteLine(“val1={0},val2={1}”,val1.GetType(),val2.GetType());
Answer- val1=System.Int32,val2=System.Int32
33)using System;
using System.Collections;
namespace ConsoleApplicationDemo
class Program
myList.Add(32);
myList.Add(12);
myList.Add(22);
myList.Sort();
for(int index=0; index<myList.Count; index++)
Console.Write(myList[index] + "\t");
Answer: 12 22 32
34)using System;
namespace Test_App
class SampleClass
Console.WriteLine("Hello Customer");
sc.GreetUser();
Console.ReadLine();
class SampleClass
{
public void GreetUser()
35) ______________ class is used to find out object's Metadata i.e, methods, fields, properties at
runtime
a) System Type
b) System Reflection
c) System Assembly
d) System String
36) Which of the following Attribute should be used to indicate the property must NOT be serialized
while using .JSON serializer ?
a) XMLIgnore
b) IgnoreDataMember
c) IgnoreProperty
d) JsonIgnore
Answer: JsonIgnore
try
int num1=5;
Console.WriteLine(num1);
try
int num3= 5;
int num4= 0;
Console.WriteLine(num4);
Console.WriteLine("Inner Catch");
Console.WriteLine("Outer Catch");
a) XML
b) Binary
c) JSON
Answer: Binary
a) Dynamic Polymosphism
b) static polymosphism
c) abstract class
d) encapsulation
a) List
b) ArrayList
c) Hash Table
d) String Collection
Answer: List
int index;
try{
Console.Write("Enter a number: ");
index = Convert.ToInt32(Console.ReadLine());
arr[index]= value;
catch (FormatException e)
catch (IndexOutOfRangeException e)
Console.Write("Remaining program");
class ConstructorDemo
public ConstructorDemo()
number=number+1;
Console.Write(number+"\t");
{
number+=num;
Console.Write(number+"\t");
class NormalConstructorProgram