Robotics & Artificial Intelligence
Assertion (A): Variable is a named memory location which contains a value.
Reason (R): When you create a variable, it reserves some space in the memory.
Based on the above discussion, choose an appropriate statement from the options given below:
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true and R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
- Both A and R are false.
Answer
Both A and R are true and R is the correct explanation of A.
Reason — A variable is a named memory location which contains a value. When a variable is created, the system reserves some space in the memory to store its value, and this memory location is identified by the variable name. Hence, R correctly explains why A is true.
Related Questions
Predict the output when executed:
Given: list1 = ['Robotics', 2026, 'ICSE', 'Edition']
Statement Output print(list1) print(list1[0]) print(list1[1:3]) print(list1[2:]) Predict the output when executed:
Statement Output a = 24
m = float(a)
print(m)b = 32.86
n = int(b)
print(n)c = 3
p = complex(c)
print(p)In Python programming, it is an unordered collection data type that is iterable, mutable and has no duplicate elements. It is represented by { } where the values are enclosed in curly braces.
Read the above paragraph and answer the following questions:
(a) Name the data type that is used in Python.
(b) What will happen, if duplicate elements are present in this data types and executed?
Write short notes on Indentation.