C# Questions & Answers – Introduction of Overloaded Operators

This section of our 1000+ C# multiple choice questions focuses on Overloaded Operators in C# Programming Language.

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
View Answer

Answer: c
Explanation: None.

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
View Answer

Answer: a
Explanation: None.

3. Arrange the following overloaded operators in increasing order of precedence?

advertisement
advertisement
 %, <<, &, /, +

a) ‘%’ < ‘<<‘ < ‘+’ < ‘-‘ < ‘&’ < ‘/’
b) ‘<<‘ < ‘&’ < ‘%’ < ‘-‘ < ‘/’ < ‘+’
c) ‘&’ < ‘-‘ <‘%’ < ‘<<‘ < ‘/’ < ‘+’
d) ‘/’ < ‘-‘ < ‘%’ < ‘+’ < ‘<<‘ < ‘&’
View Answer

Answer: b
Explanation: None.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

4. Operators that can be overloaded are?
a) ||
b) ‘+=’
c) +
d) []
View Answer

Answer: c
Explanation: None.

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
View Answer

Answer: d
Explanation: None.
advertisement

6. Correct way to define operator method or to perform operator overloading is?
a)

  1.    public static op(arglist)
  2.    {
  3.  
  4.    }

b)

advertisement
  1.    public static retval op(arglist)
  2.    {
  3.  
  4.    }

c)

  1.    public static retval operator op(arglist)
  2.    {
  3.  
  4.    }

d) All of the mentioned
View Answer

Answer: c
Explanation: None.

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)
View Answer

Answer: c
Explanation: None.

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
View Answer

Answer: d
Explanation: None

9. What is the vector in operator overloading?
a) class
b) method()
c) data type
d) none of the mentioned
View Answer

Answer: c
Explanation: It is a data type of class. It is defined as public static Vector operator + (Vector a, Vector b).

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
View Answer

Answer: d
Explanation: None.

Sanfoundry Global Education & Learning Series – C# Programming Language.

To practice all areas of C# language, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.