This section of our 1000+ C# MCQs focuses on rounding functions in C# Programming Language.
1. Which among the given classes provides types of rounding functions?
a) Math
b) Process
c) System
d) Object
2. Which of these methods is a rounding function of Math class?
a) Max()
b) Min()
c) Abs()
d) Round()
3. Which of these classes contains only floating point functions?
a) Math
b) Process
c) System
d) Object
4. 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)
5. Which of these methods return a largest whole number less 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)
6. Which of the following functions return absolute value of a variable?
a) Abs()
b) Absolute()
c) absolutevariable()
d) None of the mentioned
7. What will be the output of the following C# code snippet?
public class A
{
public int x;
public int y;
public void display()
{
Console.WriteLine(x + " " + y);
}
}
class Program
{
static void Main(string[] args)
{
A obj1 = new A();
A obj2 = new A();
obj1.x = 1;
obj1.y = 2;
obj2 = obj1;
obj1.display();
obj2.display();
}
}
a) 1 2 0 0
b) 1 2 1 2
c) 0 0 0 0
d) Run time exception
1 2 1 2
8. What will be the output of the following C# code snippet?
class Program
{
static void 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
3
9. What will be the output of the following C# code snippet?
class Program
{
static void Main(string[] args)
{
double x = 3.14;
int y = (int) Math.Ceiling(x);
Console.WriteLine(y);
}
}
a) 0
b) 3
c) 3.0
d) 4
4
10. What will be the output of the following C# code snippet?
class Program
{
static void 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
3