Bird
0
0

Which of the following return types is acceptable for a @DataProvider method in Selenium Java?

easy📝 Conceptual Q2 of 15
Selenium Java - TestNG Integration
Which of the following return types is acceptable for a @DataProvider method in Selenium Java?
Aint
BList<String>
CString[]
DObject[][]
Step-by-Step Solution
Solution:
  1. Step 1: Understand DataProvider return types

    A DataProvider method must return either an Object[][] or an Iterator to supply multiple sets of parameters.
  2. Step 2: Analyze options

    Object[][] returns Object[][] which is valid. Options B and C return collections or arrays of single types, not Object arrays. int is a primitive type, invalid as a DataProvider return.
  3. Final Answer:

    Object[][] -> Option D
  4. Quick Check:

    DataProvider must return Object[][] or Iterator [OK]
Quick Trick: DataProvider returns Object[][] or Iterator only [OK]
Common Mistakes:
  • Returning a single-dimensional array instead of Object[][]
  • Returning a List without wrapping elements in Object[]
  • Using primitive types as return values

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes