Bird
0
0

Given this code snippet, what will be printed?

medium📝 Predict Output Q13 of 15
Selenium Python - Data-Driven Testing
Given this code snippet, what will be printed?
from openpyxl import load_workbook
wb = load_workbook('data.xlsx')
sheet = wb.active
print(sheet['A2'].value)
Assuming cell A2 contains the text "TestUser".
Adata.xlsx
BTestUser
Csheet['A2']
DNone
Step-by-Step Solution
Solution:
  1. Step 1: Understand openpyxl cell access

    sheet['A2'].value reads the content of cell A2 in the active sheet.
  2. Step 2: Check given cell content

    Cell A2 contains "TestUser", so print outputs this string.
  3. Final Answer:

    TestUser -> Option B
  4. Quick Check:

    sheet['A2'].value = "TestUser" [OK]
Quick Trick: sheet['A2'].value reads cell A2 content [OK]
Common Mistakes:
  • Printing the cell object instead of its value
  • Confusing filename with cell content
  • Expecting None if cell has text

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes