AmbitionBox

Discover Best Places to work in India

C# Programming

C# Programming Questions and Answers

Showing 171 - 174 of 174 questions

171

Which of these methods is a rounding function of Math class?

a

Max()

b

Min()

c

Abs()

d

Round()

correct answer d

Round() rounds up a variable to nearest integer

172

What will be the output of the given code snippet?

class Program

{

staticvoid Main(string[] args)

     {

          double x =3.14;

          int y =(int) Math.Abs(x);

          Console.WriteLine(y);

     }

}

 

 

 

a

0

b

3

c

3.0

d

3.1

correct answer b

Answer: Option (B)

173

Which among the given classes provides types of rounding functions?

a

Math

b

Process

c

System

d

Object

correct answer a

Answer: Option (A)

174

What will be the output of the given code snippet?

class Program

{

     staticvoid Main(string[] args)

     {

          double x =3.14;

          int y =(int) Math.Floor(x);

          Console.WriteLine(y);

     }

}

 

 

 

 

a

0

b

3

c

3.0

d

4

correct answer b

double Floor(double X) returns the largest whole number less than or equal to variable X. Here, the smallest whole number less than 3.14 is 3.
Output: 3

Select a company to compare with

vs

Similar Companies