MCQOPTIONS
Saved Bookmarks
This section includes 10 Mcqs, each offering curated multiple-choice questions to sharpen your Attributes knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
With which of the following can the ref keyword be used? 1.Static data 2.Instance data 3.Static function/subroutine 4.Instance function/subroutine |
| A. | 3, 4 |
| B. | 1, 2 |
| C. | 2, 4 |
| D. | 1, 3 |
| Answer» B. 1, 2 | |
| 2. |
Which of the following is the necessary condition for implementing delegates? |
| A. | Inheritance |
| B. | Class declaration |
| C. | Exceptions |
| D. | Run-time Polymorphism |
| Answer» C. Exceptions | |
| 3. |
With which of the following can the ref keyword be used? |
| A. | 1, 2 |
| B. | 3, 4 |
| C. | 1, 3 |
| D. | 2, 4 |
| Answer» C. 1, 3 | |
| 4. |
Suppose a Generic class called SortObjects is to be made capable of sorting objects of any type ( Integer , Single , Byte etc.). Which of the following programming constructs should be used to implement the comparision function? |
| A. | Namespace |
| B. | Interface |
| C. | Encapsulation |
| D. | Delegate |
| Answer» E. | |
| 5. |
Which of the following are the correct ways to declare a delegate for calling the function func() defined in the sample class given below? |
| A. | delegate d(int i, Single j); |
| B. | delegate void d(int, Single); |
| C. | delegate int d(int i, Single j); |
| D. | delegate void (int i, Single j); |
| Answer» D. delegate void (int i, Single j); | |
| 6. |
Which of the following statements are correct about a delegate? |
| A. | 1 and 2 only |
| B. | 1, 2 and 3 only |
| C. | 2, 3 and 4 only |
| D. | All of the above |
| Answer» D. All of the above | |
| 7. |
Which of the following is the correct way to call subroutine MyFun() of the Sample class given below? |
| A. | delegate void del( int i); Sample s = new Sample(); del d = new del( ref s.MyFun); d( 10 , 1.1 f); |
| B. | delegate void del( int i, Single j); del d; Sample s = new Sample(); d = new del( ref s.MyFun); d( 10 , 1.1 f); |
| C. | Sample s = new Sample(); delegate void d = new del( ref MyFun); d( 10 , 1.1 f); |
| D. | delegate void del( int i, Single]); Sample s = new Sample(); del = new delegate ( ref MyFun); del( 10 , 1.1 f); |
| Answer» C. Sample s = new Sample(); delegate void d = new del( ref MyFun); d( 10 , 1.1 f); | |
| 8. |
Which of the following is the correct way to call the function MyFun() of the Sample class given below? |
| A. | delegate void del( int i); Sample s = new Sample(); deld = new del( ref s.MyFun); d( 10 ); |
| B. | delegate int del( int i); Sample s = new Sample(.); del = new delegate ( ref MyFun); del( 10 ); |
| C. | Sample s = new Sample(); delegate void del = new delegate ( ref MyFun); del( 10 ); |
| D. | delegate int del( int i); del d; Sample s = new Sample(); d = new del( ref s.MyFun); d( 10 ); |
| Answer» E. | |
| 9. |
Which of the following statements are correct about the delegate declaration given below? |
| A. | 1, 2 and 3 only |
| B. | 1, 3 and 5 only |
| C. | 2 and 4 only |
| D. | 4 only |
| Answer» C. 2 and 4 only | |
| 10. |
In which of the following areas are delegates commonly used? |
| A. | 1 and 2 only |
| B. | 1 and 5 only |
| C. | 1, 2 and 3 only |
| D. | 4 and 5 only |
| Answer» E. | |