Variables Questions and Answers

Take Exam

Python Programming - Variables Questions with Answers help understand how data is stored and referenced in Python. These Python Variables Questions are key for Infosys, Accenture, and SSC exams testing programming basics and naming conventions

Variables

Showing 10 of 24 questions

21. Which of these is a valid way to assign multiple variables in one line?

  • a, b, c = 1, 2, 3
  • a = b = c = 1
  • a = 1; b = 2; c = 3
  • All of the above
Show Answer Report

22. What does the += operator do?

  • Addition only
  • Assignment only
  • Addition and assignment
  • Comparison
Show Answer Report

23. How do you make a variable available inside a function without passing it as parameter?

  • global keyword
  • local keyword
  • import keyword
  • extern keyword
Show Answer Report

24. What is the output of: x = "hello"; print(x[1])?

  • h
  • e
  • l
  • o
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test