adplus-dvertising

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.

frame-decoration

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 8 of 20

Q71.
Which among the following cannot be used as a datatype for an enum in C#.NET?
Discuss
Answer: (b).double
Q72.
Choose the correct output for the C#.NET code given below?
enum days:int
{
    sunday = -3,
    monday,
    tuesday
}
Console.WriteLine((int)days.sunday);
Console.WriteLine((int)days.monday);
Console.WriteLine((int)days.tuesday);
Discuss
Answer: (c).-3 -2 -1
Q73.
Choose the correct statement about the C#.NET code given below?
enum color:byte
{
    yellow = 500,
    green = 1000,
    pink = 1300
}
Discuss
Answer: (d).When the valid range of byte exceeds, the compiler will report an error
Discuss
Answer: (d).An enum can have Single and Double values
Q75.
Choose the correct output for given set of code?
enum per
 {
     a, 
     b, 
     c, 
     d, 
 }
 per.a = 10;
 Console.writeline(per.b);
Discuss
Answer: (d).compile time error
Q76.
Choose the correct output for given set of code?
enum color:int
{
    red,
    green,
    blue = 5,
    cyan,
    pink = 10,
    brown
}
console.writeline((int)color.green);
console.writeline((int)color.brown);
Discuss
Answer: (c).1 11
Q77.
Correct the output for the C#.NET code given below?
enum letters
{
    a,
    b,
    c
} 
letters l;
l = letters.a;
Console.writeline(l);
Discuss
Answer: (c).a
Q78.
Correct output for the C#.NET code given below is?
enum colors
 {
     red,
     black,
     pink
 }
 colors s = colors.black;
 type t;
 t = c.GetType();
 string[] str;
 str = Enum.GetNames(t);
 Console.WriteLine(str[0]);
Discuss
Answer: (c).red
Discuss
Answer: (b).Values of the enum elements cannot be populated from database
Discuss
Answer: (b).In C, language variables of enum types can be used interchangeably with integers using type casts while enum variables cannot be used as a normal integers in C#.NET

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!