1.When a new value is stored in a variable, its previous value gets __________.
(a) Accepted
(b) Overwritten
(c) Overlapped
(d) None of these
Answer: (b) Overwritten ✓
2.The data type for 12.4 should be __________.
(a) Int
(b) Float
(c) Str
(d) None of these
Answer: (b) Float ✓
3.Which of the following data types is not supported in Python?
(a) Char
(b) Float
(c) Int
(d) None of these
Answer: (a) Char ✓
4.>>> print('10'+'20') will give the output __________.
(a) 30
(b) 1020
(c) 2010
(d) None of these
Answer: (b) 1020 ✓
5.Values are assigned to variables using the __________ operator.
(a) String
(b) Print()
(c) Assignment
(d) None of these
Answer: (c) Assignment ✓
B. Write 'T' for true and 'F' for false in the given circles:
1.A variable name can consist of letters, digits, and underscore.
Answer: T
2.In Python, only one type of data can be stored in memory.
Answer: F
3.To evaluate an arithmetic expression, it is not necessary to use the print() function.
Answer: T
4.The string values cannot be multiplied together.
Answer: F
5.In Python, data types represent the type of data stored in a variable.
Answer: T
C. Fill in the blanks:
1.The __________ key is pressed to execute a Python program.
Answer: Enter
2.A __________ is the name of the memory location that stores the data.
Answer: variable
3.Python was created by __________.
Answer: Guido van Rossum
4.Python __________ cannot be used as a variable name.
Answer: keywords
5.In the interactive mode of Python, the instructions are executed __________.
Answer: immediately
D. Answer the following questions:
1.What is variable?
Answer: A variable is a named memory location that stores a value or data in a program. The value stored in a variable can be changed during the execution of the program.
2.Write any three features of the Python language.
Answer:
Python is simple and easy to learn with readable syntax.
It is an interpreted language (code executes line by line).
It is dynamically typed (no need to declare data types explicitly).
3.What are data types? Explain any two data types in Python.
Answer: Data types define the kind of value a variable can hold and the operations that can be performed on it.
int: Used for whole numbers (e.g., 10, -5).
float: Used for decimal or floating-point numbers (e.g., 3.14, -0.5).
4.Explain the different working modes of Python.
Answer:
Interactive Mode: Code is typed and executed line by line in the Python shell (>>> prompt). Results are shown immediately.
Script Mode: Complete program is written in a .py file and executed all at once.
5.Discuss the rules for naming the variables.
Answer:
Variable names can contain letters (a-z, A-Z), digits (0-9), and underscore (_).
Must start with a letter or underscore (cannot start with a digit).
Cannot be a Python keyword (like if, for, while).
Case-sensitive (Age and age are different).
6.What is the use of print() function?
Answer: The print() function is used to display output (values, messages, variables) on the screen or console. It is essential for showing results in programs.
.jpg)
No comments:
Post a Comment