C#

C# Obective Questions And Answers

More interview questions and answers

Does C# support multiple-inheritance? 1.No 2.Yes

1.NO

What is MSIL? 1.Multi Socket Interface Library 2.Microsoft Intermediate Language 3.Microsoft Interface Language 4.Microsoft Integer Long

2.Microsoft Intermediate Language

Whict is true for C#? 1.C# supports interfaces. 2.C# also provides support for structs. 3.C# provides component-oriented features 4.All 5.None

4.All 

An assembly is> 1.A collection of files that appear to the programmer to be a single DLL or EXE. 2.properties of c# 3.events Of c# 4.declarative syntax of Java

1.A collection of files that appear to the programmer to be a single DLL or EXE

Which Of follwing is currect syntax? 1.class R4R { static void Main( ) { System.Console.WriteLine("R4R"); } } 2.class R4R { static void Main( ) { System.out.WriteLine("R4R"); } } 3.class R4R { static void Main( ) { System.print.WriteLine("R4R"); } } 4.class R4R { static void Main( ) { System.Console.out("R4R"); } } 5.class R4R { static void Main( ) { System.Console.out("R4R"); } }

1.class R4R
{
static void Main( )
{
System.Console.WriteLine("R4R");
}
}

What will output of following class R4R { static void Main( ) { /* System.Console.WriteLine("R4R"); */ } } 1.No any output. 2.Compile time error. 3.Runtime erro 4 .None of above.

1.No any output

What will output of following ? using System.Console; class R4R { static void Main( ) { WriteLine("R4R"); } } 1. error CS0138 2. R4R 3. No any output 4. None

1. error CS0138 2

Which of the follwing is true? 1.byte-->> 1(siz)-->>Byte(as int.net)-->> Unsigned (values 0-255). 2.char-->> 2-->> Char -->>Unicode-->> characters. 3.bool -->>1 -->>Boolean -->>true or false. 4.sbyte-->> 1 SByte-->> Signed -->>(values -128 to 127). 5.short-->> 2-->> Int16-->> Signed -->> short-->> values -32,768 to 32,767

1,2,3,4,5

class R4R { static void Main( ) { short x; int y = 500; x = y; System.Console.WriteLine("Output:{0}", x); } } 1.error 2.Output:500 3.Outpu:{500} 4.None

1.error

class R4R { static void Main( ) { short s = 7; System.Console.WriteLine("Initialized: {0}",s); s = 5; System.Console.WriteLine("After assignment: {0}",s); } } 1. error 2. 2 Initialized:5 3. After assignment:7 4. both 2,3 5. None

4. both 2,3 

class R4R { static void Main( ) { short s; System.Console.WriteLine("Initialized: {0}",s); s = 5; System.Console.WriteLine("After assignment: {0}",s); } } 1. error 2. 2 Initialized:5 3. After assignment:7 4. both 2,3 5. None

1. error

Which of following is correct: 1. enum Day { Sunday= 01, Monday= 02, Tuesday= 03, Wednesday=04, Thursday= 05, Friday= 06, Saturday=07 } 2. Day enum { Sunday= 01, Monday= 02, Tuesday= 03, Wednesday=04, Thursday= 05, Friday= 06, Saturday=07 } 3. Day { Sunday= 01, Monday= 02, Tuesday= 03, Wednesday=04, Thursday= 05, Friday= 06, Saturday=07 } 4.enumeration Day { Sunday= 01, Monday= 02, Tuesday= 03, Wednesday=04, Thursday= 05, Friday= 06, Saturday=07 }

1. enum Day
{
Sunday= 01,
Monday= 02,
Tuesday= 03,
Wednesday=04,
Thursday= 05,
Friday= 06,
Saturday=07
}

What is output of following : class R4R { enum Day { Sunday= 01, Monday= 02, Tuesday= 03, Wednesday=04, Thursday= 05, Friday= 06, Saturday=07 } static void Main( ) { System.Console.WriteLine("First of Weak Day: {0}", (int) Day.Sunday); System.Console.WriteLine("Last of Weak Day: {0}", (int) Day.Saturday); } } 1. First of Weak Day:01 2. Last of Weak Day:07 3. 1,2 4. error 5. None

3.1,2

Which of the following is true for string r4r = "R4R"; 1.r4r is an object which store string R4R. 2.string is keyword in C#. 3.This syntax is wrong string is not any keyword in c#. 4.string used to store set of characters into any string type object.

1,2,4

What is output of following : class R4R static void Main( ) { Int string=0; System.Console.WriteLine("Outpt: {0}",string++); } } 1.Outpt:0 2.Outpt:1 3.1,2 4.error 5.None

4.error

How many statements are into following code? int x; x = 23;int y = x; 1.1 2.2 3.3 4.4 5.5

3.3

Choose correct one 1.int x; 2 x = 23; 3 int y = x; 4 int string=10; 1.1,2,3,4 2.1,2,3 3.1,3 4. None 5. All

3.1,3

using System; class R4R { static void Main( ) { int x = 10; int y; y = x++; Console.WriteLine("After postfix: {0}, {1}", x, y); x = 20; y = ++x; Console.WriteLine("After prefix: {0}, {1}", x, valueTwo); } } 1.After postfix: 10, 10 2.After prefix: 20, 20 3 both 4 none

4 none 

using System; class R4R { static void Main( ) { int x = 10; int y; y = x++; Console.WriteLine("After postfix: {0}, {1}", x, y); x = 20; y = ++x; Console.WriteLine("After prefix: {0}, {1}", x, valueTwo); } } 1.After postfix: 11, 10 2.After prefix: 21, 21 3 both 4 none

3 both

using System; class R4R { static void Main( ) { int x = 10; int y; y = x++; int xy = x > y ? x : y; Console.WriteLine("output: {0}, {1},{2}", x,y,xy); } } 1. output: 10, 10,10 2. output: 11, 10,10 3. output: 11,10,11 4 none

3. output: 11,10,11

How you can change the page title by changing the using C# 1.void buttonSet_Click(Object sender, EventArgs earg) { Header.Title :Msg.Text; } 2.void buttonSet_Click(Object sender, EventArgs earg) { Msg.Text= Header.Title; } 3.void buttonSet_Click(Object sender, EventArgs earg) { Msg.Text: Header.Title; } 4.None

1.void buttonSet_Click(Object sender, EventArgs earg) 
{ 
Header.Title :Msg.Text; 
}

Which is used to add event code(on C# Code) for TextBox control in Source view ( ASP.NET) 1. MsgSent.Text = Msg.Text; 2. MsgSent.Text = Msg.Text 3. Both 4. None

1. MsgSent.Text = Msg.Text;

C# Obective Questions And Answers