Chapter 4 – Very Able Variables | Python Class 7 MCQs, Exercises & Programs – Set 1

CHAPTER 4 – VERY ABLE VARIABLES

MULTIPLE CHOICE QUESTIONS

  1. Which of the following is a valid variable name in Python?
    a. 2value
    b. _value2
    c. value-2
    d. my value

  1. What will be the output of the following code?
x = 15
y = 4
print(x % y)

a. 3
b. 4
c. 15
d. 11


  1. If we write the following program:
a = "10"
b = "20"
print(a + b)

What will be the output?
a. 30
b. 1020
c. Error
d. None


  1. What will the following program display if the input is 7?
num = int(input("Enter a number: "))
print(num * 2)

a. 7
b. 14
c. num*2
d. Error


  1. Which operator is used for exponentiation in Python?
    a. ^
    b. **
    c. //
    d. %


FILL IN THE BLANKS

  1. A variable in Python is created when we assign a __________ to it.
  2. The function __________ is used to accept input from the user.
  3. Integer type variables are declared without any special keyword; for example, x = __________.
  4. The __________ operator is used for floor division in Python.
  5. Python keywords like __________ cannot be used as variable names.


DESCRIPTIVE QUESTIONS

  1. Define a variable. Give two examples of valid and invalid variable names.

  1. Explain the difference between integer division (//) and normal division (/). Give an example of each.

  1. Write a Python program that takes two numbers as input and displays their sum, difference, product, and quotient.

  1. What is type casting? Write a program that takes a string input "25" and converts it into an integer.

  1. List any 5 rules for naming variables in Python.
Answer Key

MULTIPLE CHOICE QUESTIONS

  1. b. _value2
  2. a. 3
  3. b. 1020
  4. b. 14
  5. b. **

FILL IN THE BLANKS

  1. value
  2. input()
  3. 10 (or any integer value)
  4. //
  5. if, while, for (any Python keyword is valid as example)

DESCRIPTIVE QUESTIONS

  1. Define a variable with examples
  • A variable is a named memory location used to store data.
  • Valid: age, _marks
  • Invalid: 1value, my-name

  1. Difference between integer division and normal division
  • / → Normal division (always returns float), e.g., 7/2 = 3.5
  • // → Floor division (integer part only), e.g., 7//2 = 3

  1. Program for sum, difference, product, quotient
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
print("Sum =", a + b)
print("Difference =", a - b)
print("Product =", a * b)
print("Quotient =", a / b)

  1. Type casting example
s = "25"
num = int(s)
print(num)   # Output: 25 as integer

  1. Five rules for naming variables

Case-sensitive (Namename)

Must start with a letter or underscore

Cannot start with a digit

No spaces allowed

Cannot use special characters (like !, @, #, -)

Cannot use Python keywords (like if, for, while)

Leave a Reply

Discover more from Abhyas

Subscribe now to keep reading and get access to the full archive.

Continue reading