Welcome to the Interfaces,Inheritance and Polymorphism MCQs Page
Dive deep into the fascinating world of Interfaces,Inheritance and Polymorphism with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Interfaces,Inheritance and Polymorphism, a crucial aspect of C# programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Interfaces,Inheritance and Polymorphism, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within C# programming.
Check out the MCQs below to embark on an enriching journey through Interfaces,Inheritance and Polymorphism. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of C# programming.
Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Interfaces,Inheritance and Polymorphism. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!
Interfaces,Inheritance and Polymorphism MCQs | Page 12 of 20
Explore more Topics under C# programming
class Program
{
static void Main(string[] args)
{
Console.WriteLine( vol(10));
Console.WriteLine( vol(2.5f, 5));
Console.WriteLine( vol( 5l, 4, 5));
Console.ReadLine();
}
static int vol(int x)
{
return(x * x * x);
}
static float vol(float r, int h)
{
return(3.14f * r * r * h);
}
static long vol(long l, int b, int h)
{
return(l * b * h);
}
}
98.125
100
class overload
{
public int x;
int y;
public int add(int a)
{
x = a + 1;
return x;
}
public int add(int a, int b)
{
x = a + 2;
return x;
}
}
class Program
{
static void Main(string[] args)
{
overload obj = new overload();
overload obj1 = new overload();
int a = 0;
obj.add(6);
obj1.add(6, 2);
Console.WriteLine(obj.x);
Console.WriteLine(obj1.x);
Console.ReadLine();
}
}
8
static void Main(string[] args)
{
int i = 5;
int j = 6;
add(ref i);
add(6);
Console.WriteLine(i);
Console.ReadLine();
}
static void add(ref int x)
{
x = x * x;
}
static void add(int x)
{
Console.WriteLine(x * x * x);
}
25
class maths
{
public int x;
public double y;
public int add(int a, int b)
{
x = a + b;
return x;
}
public int add(double c, double d)
{
y = c + d;
return (int)y;
}
public maths()
{
this.x = 0;
this.y = 0;
}
}
class Program
{
static void Main(string[] args)
{
maths obj = new maths();
int a = 4;
double b = 3.5;
obj.add(a, a);
obj.add(b, b);
Console.WriteLine(obj.x + " " + obj.y);
Console.ReadLine();
}
}
class maths
{
public static void fun1()
{
Console.WriteLine("method 1 :");
}
public void fun2()
{
fun1();
Console.WriteLine("method 2 :");
}
public void fun2(int k)
{
Console.WriteLine(k);
fun2();
}
}
class Program
{
static void Main(string[] args)
{
maths obj = new maths();
maths.fun1();
obj.fun2(20);
Console.ReadLine();
}
}
20
method 1:
method 2:
class maths
{
public int fun1(int k)
{
k = 20;
return k;
}
public Single fun1(float t)
{
t = 3.4f;
return t;
}
}
class Program
{
static void Main(string[] args)
{
maths obj = new maths();
int i;
i = obj.fun1(30);
Console.WriteLine(i);
Single j;
j = obj.fun1(2.5f);
Console.WriteLine(j);
Console.ReadLine();
}
}
3.4f
class maths
{
public int fun(int k, int y)
{
return k + y;
}
public int fun1(int t, float z)
{
return (t+(int)z);
}
}
class Program
{
static void Main(string[] args)
{
maths obj = new maths();
int i;
int b = 90;
int c = 100;
int d = 12;
float l = 14.78f;
i = obj.fun(b, c);
Console.WriteLine(i);
int j = (obj.fun1(d, l));
Console.WriteLine(j);
Console.ReadLine();
}
}
class maths
{
public int fun(int k, int y, int n)
{
Console.WriteLine(k + " " + y + " " + n);
return (k);
}
public int fun1(int t,float z)
{
Console.WriteLine(t + " " + z);
return t;
}
}
class Program
{
static void Main(string[] args)
{
maths obj = new maths();
int b = 90;
int c = 100;
int d ;
float l;
int i = obj.fun(b, c, 12);
int j = (obj.fun1(12, 14.78f));
Console.ReadLine();
}
}
12, 14.78
Suggested Topics
Are you eager to expand your knowledge beyond C# programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!