Select an option to see the answer and solution.
Functions and Methods in C Sharp
practice.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
54
Questions
3/3
Page
Pick an option on a question to see the right answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
class box
{
public int width;
public int height;
public int length;
public int volume1;
public void volume()
{
volume1 = width * height * length;
}
public void volume(int x)
{
volume1 = x;
}
}
class Program
{
static void Main(string[] args)
{
box obj = new box();
obj.height = 1;
obj.length = 5;
obj.width = 5;
obj.volume(5);
Console.WriteLine(obj.volume1);
Console.ReadLine();
}
}
a) 0Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
class Program
{
static void Main(string[] args)
{
int x, y = 1;
x = 10;
if(x != 10 && x / Convert.ToInt32(0) == 0)
Console.WriteLine(y);
else
Console.WriteLine(++y);
Console.ReadLine();
}
}Select an option to see the answer and solution.
class equality
{
public int x;
public int y;
public Boolean isequal()
{
return (x == y);
}
}
class Program
{
static void Main(string[] args)
{
equality obj = new equality();
obj.x = 5;
obj.y = 5;
Console.WriteLine(obj.isequal());
Console.ReadLine();
}
}Select an option to see the answer and solution.
class box
{
int width;
int height;
int length;
int volume;
void volume(int height, int length, int width)
{
volume = width * height * length;
}
}
class Prameterized_method
{
public static void main(String args[])
{
box obj = new box();
obj.height = 1;
obj.length = 5;
obj.width = 5;
obj.volume(3, 2, 1);
Console.WriteLine(obj.volume);
Console.ReadLine();
}
}Select an option to see the answer and solution.
class equality
{
int x;
int y;
boolean isequal()
{
return(x == y);
}
}
class Output
{
public static void main(String args[])
{
equality obj = new equality();
obj.x = 5;
obj.y = 5;
Console.WriteLine(obj.isequal());
}
}Select an option to see the answer and solution.