AmbitionBox

Discover Best Places to work in India

C# Programming

C# Programming Questions and Answers

Showing 51 - 60 of 174 questions

51

Number of digits upto which precision value of float datatype is valid ?

 

a

Upto 6 digit

b

Upto 8 digit

c

Upto 9 digit

d

Upto 7 digit

correct answer d

Answer: Option (D)

52

Select appropriate difference between decimal, float and double data type in C# ?
1) Float and Double are floating binary point types while decimal is a floating decimal point type.
2) Precision difference for float is ‘7’ digit for double is ’15’ to ’16’ digit and for decimal is ’28’ to ’29’ digits.
3) Some values which cannot be exactly represented hence for those values float and double are more appropriate.

a

1

b

1, 2

c

1, 2, 3

d

2, 3

correct answer c

Answer: Option (C)

53

Select the output of the following set of code ?

staticvoid Main(string[] args)

{

      int x =1;

     float y =2. 4f;

     short z =1;

     Console.WriteLine((float) x + y * z -(x +=(short) y));

     Console.ReadLine();

}

 

 

 

 

a

0.4000004

b

0.4000023

c

0.0400021

d

0.4000001

correct answer d

Answer: Option(D)

Output : 0.4000001

54

The Default value of Boolean DataType is ?

a

0

b

True

c

False

d

1

correct answer c

Answer: Option(C)

By Definition.

55

Which of the following format specifiers is used to print hexadecimal values and return value of output as Octal equivalent in C# ?

 

a

%hx for small case letters and %HX for capital letters

b

%x for small case letters and %X for capital letters

c

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
own function

d

%Ox for smallcase letters and %OX for capital letters

correct answer c

Answer: Option(C)

Explained in answer itself.

56

A float occupies 4 bytes. If the hexadecimal equivalent of these 4 bytes are A, B, C and D, then when this float is stored in memory in which of the following order do these bytes gets stored ?

a

ABCD

b

DCBA

c

0 * ABCD

d

Depends on big endian or little endian architecture

correct answer d

“Little Endian” means that the lower-order byte of the number is stored in memory at the lowest address, and the high order byte at the highest address. For example, a 4 byte Integer
ABCD will be arranged in memory as follows:
Base Address + 0 Byte 0 .
Base Address + 1 Byte 1 .
Base Address + 2 Byte 2 .
Base Address + 3 Byte 3 .
Intel processors (those used in PC’s) use “Little Endian” byte order.
“Big Endian” means that the high-order byte of the number is stored in memory at the lowest address, and the low-order byte at the highest address. The same 4 byte integer would be stored as:
Base Address + 0 Byte 3 .
Base Address + 1 Byte 2 .
Base Address + 2 Byte 1 .
Base Address + 3 Byte 0

57

Select the output choice for the following set of code:

publicstaticvoid Main(string[] args)

{

     double ZERO =0;

     Console.WriteLine("RESULT OF DIVISION BY ZERO IS :{0}", (0/ ZERO));

     Console.ReadLine();

}

 

 

a

None of the mentioned

b

exception arguement is thrown

c

NaN

d

0

correct answer c

Answer: Option (C)

58

Correct statement about constructors in C#.NET is ?

 

a

Constructors cannot be overloaded

b

Constructors allocate space for object in memory

c

Constructors are never called explicitly

d

Constructors have same name as name of the class

correct answer c,d

Answer: Option (C) and Option (D)

59

Which of the following statements is correct about constructors in C#.NET?

a

A constructor cannot be declared as private

b

A constructor cannot be overloaded

c

A constructor can be a static constructor

d

None of the mentioned

correct answer c

Static constructor is a constructor which can be called before any object of class is created or any static method is invoked.Static constructor is implicitly called by .net CLR.

60

What is the return type of constructors?

a

int

b

float

c

void

d

None of the mentioned

correct answer d

Constructors do not have any return type not even void included in it.

Select a company to compare with

vs

Similar Companies