Bird
0
0

Which of the following is the correct syntax to declare a class SmartDevice implementing interfaces IPhone and ICamera?

easy📝 Syntax Q3 of 15
C Sharp (C#) - Interfaces

Which of the following is the correct syntax to declare a class SmartDevice implementing interfaces IPhone and ICamera?

Aclass SmartDevice : IPhone, ICamera {}
Bclass SmartDevice implements IPhone, ICamera {}
Cclass SmartDevice inherits IPhone, ICamera {}
Dclass SmartDevice extends IPhone, ICamera {}
Step-by-Step Solution
Solution:
  1. Step 1: Recall C# interface implementation syntax

    In C#, a class implements interfaces using a colon followed by interface names separated by commas.
  2. Step 2: Match syntax to options

    class SmartDevice : IPhone, ICamera {} uses correct syntax: colon and comma-separated interfaces.
  3. Final Answer:

    class SmartDevice : IPhone, ICamera {} -> Option A
  4. Quick Check:

    Interface implementation syntax = colon + comma list [OK]
Quick Trick: Use colon and commas to implement multiple interfaces [OK]
Common Mistakes:
MISTAKES
  • Using 'implements' keyword (Java style)
  • Using 'inherits' or 'extends' for interfaces
  • Using semicolons instead of commas

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Sharp (C#) Quizzes