This set of C# test focuses on “Introduction of Overloaded Operators”.
1. Which of the following keyword is used to overload user defined types by defining static member functions?
a) op
b) opoverload
c) operator
d) operatoroverload
2. Which of the following statements are correct in nature?
a) The conditional logical operators cannot be overloaded
b) The array indexing operator can be overloaded
c) A public or nested public preference type does not overload the equality operator
d) None of the mentioned
3. Arrange the following overloaded operators in increasing order of precedence?
%, <<, &, /, +
a) ‘%’ < ‘<<‘ < ‘+’ < ‘-‘ < ‘&’ < ‘/’
b) ‘<<‘ < ‘&’ < ‘%’ < ‘-‘ < ‘/’ < ‘+’
c) ‘&’ < ‘-‘ <‘%’ < ‘<<‘ < ‘/’ < ‘+’
d) ‘/’ < ‘-‘ < ‘%’ < ‘+’ < ‘<<‘ < ‘&’
4. Operators that can be overloaded are?
a) ||
b) ‘+=’
c) +
d) []
5. Which statements are correct about operator overloading?
a) Mathematical or physical modeling where we use classes to represent objects such as vectors, matrices, complex-numbers etc
b) Graphical programs where coordinate related objects are used to represent positions on the screen
c) Financial programs where a class represents an amount of money
d) All of the mentioned
6. Correct way to define operator method or to perform operator overloading is?
a)
public static op(arglist)
{
}
b)
public static retval op(arglist)
{
}
c)
public static retval operator op(arglist)
{
}
d) All of the mentioned
7. Correct method to define + operator is?
a) public sample operator +(int a, int b)
b) public abstract operator +(int a, int b)
c) public static sample operator +(int a, int b)
d) public abstract sample operator +(int a, int b)
8. Choose the correct statement among the below mentioned statements.
a) Forgetting to declare an operator method as public
b) Forgetting to declare an operator method as static
c) Forgetting to return a bool type value while overloading a relational operator
d) All of the mentioned
9. What is the vector in operator overloading?
a) class
b) method()
c) data type
d) none of the mentioned
10. Choose the wrong statement from the given set of statements?
a) All operators in C#.NET cannot be overloaded
b) We can use the new modifier to modify a nested type if the nested type is hiding another type
c) Operator overloading permits the use of symbols to represent computations for a type
d) In case of operator overloading all parameters must be of different type than the class or struct that declares the operators