Class 11 Computer Science
Ch 7 Python Fundamental
Check Point 7.1
Sumita Arora Book Exercise Solution
1. What is meant by a token? Name the token available in Python.
Answer: A token is the smallest individual unit of a program. It is also called Lexical Unit.
There are five types of tokens: –
2. What are keywords? Can keywords be used as identifiers?
Answer: Keywords are reserved words of Python programming language. It has a special meaning in the program. There are 33 keywords in python.
No keywords cannot be used as Identifiers.
3. What is an identifier? What are the identifier-forming rules of Python?
Answer: Identifier is a naming word given by a programmer to variables, lists, tuples, strings, dictionaries, functions, classes, objects, etc. It is known as the fundamental building block of a program.
Identifier Naming Rules are –
- a) Identifier is the combination of alphabets, digits, and underscores _
- b) Any number of characters you can use.c) Identifier is case sensitive, i.e. python is case sensitive language.
- d) Identifiers only start with either alphabet or a digit.
- e) A keyword cannot be an Identifier.
- f) Blank space & special symbols are not allowed in the identifier name.
- g) Cannot start with a digit.
4. Is Python case-sensitive? What is meant by the term case sensitive?
Answer: Yes. Python is case sensitive language.
Case sensitive means it treats upper and lower case characters differently.
5. Which of the following are valid identifiers and why / why not?
Data_rec, _data, 1 data, data1, my.file, elif, switch, lambda, break?
Data_rec : This is a valid identifier.
_data : This is a valid identifier.
1 data : This is NOT VALID identifier, because It start with digit and having space also.
Data1 : This is a valid identifier.
my.file : This is NOT VALID identifier, because . (dot) is a special symbol, which not allowed. Only underscore _ is allowed.
elif : This is NOT VALID identifier, because elif is a keyword.
switch : This is a valid identifier.
lambda : This is NOT VALID identifier, because lambda is a keyword.
break : This is NOT VALID identifier, because break is a keyword.