Created
November 24, 2021 06:03
-
-
Save rozer007/2fd4e52d2847101b932120f3ea3b15b8 to your computer and use it in GitHub Desktop.
GENERIC , ENUMERATION AND STRUCTURE IN C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Q1 Can we create a object of enum without using new keyword ? | |
ans yes we can . | |
Q2 Can we inherit a structure in our class | |
ans NO we can't structure doesn't support inheritance. | |
Q3 why do we generic class or method? | |
ans Because the class or method can operate on various data type not only on specific type. | |
Q4 what will the output of this code: | |
public enum Temperature | |
{ | |
freeze, | |
low, | |
warm=10, | |
boil | |
} | |
Console.WriteLine((int)Temperature.boil); | |
a. 4 | |
b. 3 | |
c. 11 | |
d. none of the above | |
ans: c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Q1 What is the correct way of defining a generic class with only one variable? | |
a. class class_name<T> | |
b. class class_name<Tkey> | |
c. None of the above | |
d. Both a and b | |
ans d | |
Q2 what keyword is use to define enumeration in c# | |
a. enumer | |
b. enums | |
c. enum | |
d. enumeration | |
ans c | |
Q3 The default indexing of a enumeration start with? | |
a. 1 | |
b. 0 | |
c. Both a and b | |
d. none | |
ans b | |
Q4 What is the differnce in structure and class | |
a. struct can't create object whereas class can | |
b. Inheritance is possible in class whereas not in structure. | |
c. Both a nad b | |
d. none of the above | |
ans c | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment