AmbitionBox

Discover Best Places to work in India

C# Programming

C# Programming Questions and Answers

Showing 1 - 8 of 8 questions

1

What is the Size of ‘Char’ datatype?

a

8 bit

b

12 bit

c

16 bit

d

20 bit

correct answer c

Answer: Option (C)

2

Choose the output for the following set of code.

staticvoid Main(string[] args)

{

     char c = 'g'

     string s = c.ToString();

     string s1 ="I am a human bein"+ c;

     Console.WriteLine(s1);

     Console.ReadLine();

}

 

a

I am a human bein c

b

I am a human being

c

I am a human being c

d

I am a human bein

correct answer b

‘g’is stored in character variable ‘c’ which later on is converted to string using method Convert.Tostring() and hence appended at last of the string in s1.
Output: I am a human being.

3

Select the correct differences between char and varchar datatypes?

1. varchar is non unicode and char is unicode character datatype

2. char is ‘n’ bytes whereas varchar is actual length in bytes of data entered in terms of storage size

3. varchar is variable in length and char is the fixed length string

4. For varchar, if a string is less than the maximum length then it is stored in verbatim without any extra characters while for char if a string is less than the set length it is padded with extra characters to equalize its length to given length

a

1,3,4

b

2,3,4

c

1,2,4

d

3,4

correct answer d

Answer: Option (D)

4

Which of the following will be the correct output for the C#.NET code snippet given below?

String s1 = "Nagpur";
String s2;
s2 = s1.Insert(6, "Mumbai"); 
Console.WriteLine(s2);
a

NagpurMumbai

b

NagpuMumbair

c

Mumbai

d

Nagpur

correct answer a

Answer: Option A

Explanation:

No answer description available for this question.

5

The string built using the String class are immutable (unchangeable), whereas, the ones built- using the StringBuilder class are mutable.

a

True

b

False

c
d
correct answer a

Answer: Option A

Explanation:

No answer description available for this question.

6

Which of the following will be the correct output for the C#.NET code snippet given below?

String s1 = "ALL MEN ARE CREATED EQUAL";
String s2;
s2 = s1.Substring(12, 3); 
Console.WriteLine(s2);
a

ARE

b

CRE

c

CR

d

CREATED

correct answer b

Answer: Option B

Explanation:

No answer description available for this question.

 

7

What will be the output of the C#.NET code snippet given below?

namespace IndiabixConsoleApplication
{
    class SampleProgram
    {
        staticvoid Main(string[ ] args)
        {
            string str= "Hello World!";
            Console.WriteLine( String.Compare(str, "Hello World?" ).GetType() );
        }
    }
}
a

0

b

1

c

Hello World?

d

System.Int32

correct answer b

Answer: Option D

Explanation:

No answer description available for this question.

 

8

Which of the following will be the correct output for the C#.NET code snippet given below?

String s1="Kicit";
Console.Write(s1.IndexOf('c') + " "); 
Console.Write(s1.Length);
a

3 6

b

2 5

c

3 5

d

2 6

correct answer b

Answer: Option B

Explanation:

No answer description available for this question.

 

Select a company to compare with

vs

Similar Companies