Bird
0
0

Which of the following is the correct syntax to declare a public method named Show in C#?

easy📝 Syntax Q3 of 15
C Sharp (C#) - Classes and Objects
Which of the following is the correct syntax to declare a public method named Show in C#?
Apublic Show void() { }
Bpublic void Show() { }
Cvoid public Show() { }
Dvoid Show public() { }
Step-by-Step Solution
Solution:
  1. Step 1: Understand method declaration syntax

    In C#, the access modifier comes first, then return type, then method name with parentheses.
  2. Step 2: Check each option

    public void Show() { } follows correct order: public void Show() { }. Others have wrong order or misplaced keywords.
  3. Final Answer:

    public void Show() { } -> Option B
  4. Quick Check:

    Access modifier + return type + method name = correct syntax [OK]
Quick Trick: Access modifier comes before return type in method declaration [OK]
Common Mistakes:
MISTAKES
  • Placing void before public
  • Misordering method name and return type
  • Missing parentheses after method name

Want More Practice?

15+ quiz questions · All difficulty levels · Free

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