AmbitionBox

Discover Best Places to work in India

C# Programming

C# Programming Questions and Answers

Showing 1 - 5 of 5 questions

1

Which of these method returns a smallest whole number greater than or equal to variable X?

a

double Ciel(double X)

b

double Floor(double X)

c

double Max(double X)

d

double Min(double X)

correct answer a

Ciel(double X) returns the smallest whole number greater than or equal to variable X.

2

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

3

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)

4

Which among the given classes provides types of rounding functions?

a

Math

b

Process

c

System

d

Object

correct answer a

Answer: Option (A)

5

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