Page 12 - IPP-11
P. 12
(b) Write any two names of IDE for Python language. (1)
Ans. PyScripter, Spyder
(c) Identify the valid identifiers from the following—
f@name, as, _tax, roll_no, 12class, totalmarks, addr1 (2)
Ans. Valid identifiers: _tax, roll_no, totalmarks, addr1
(d) Explain the various merits of Python programming language. (3)
Ans. Merits of Python language are:
(i) Platform-independent: It is platform-independent and can run across different platforms like
Windows, Linux/Unix, Mac OS X and other operating systems. Thus, we can say that Python is a
portable language.
(ii) Readability: Python programs use clear, simple, concise and English-like instructions that are easy
to read and understand even by non-programmers or people with no substantial programming
background.
(iii) Object-Oriented Language: It is an interactive, interpreted and Object-Oriented Programming
Language.
(iv) Higher Productivity: Since Python is a simple language with small codes and extensive libraries, it
offers higher productivity to programmers than languages like C++ and Java. So, we write less and
get more done.
(v) Less Learning Time: Because of a simple and shorter code, lesser time is required to understand and
learn Python programming.
(vi) GUI Programming: Python supports GUI applications that can be created and ported to many system
calls, libraries and Windows systems such as Windows MFC (Microsoft Foundation Class Library),
Macintosh and the X Window system of UNIX.
(vii) Ample Availability of Libraries: It provides large standard libraries to solve a task.
(viii) Syntax Highlighting: It allows to distinguish between input, output and error messages by different
colour codes.
(e) What do you mean by data types? What are Python’s built-in core data types? Write one example of
each. (3)
Ans. Data type: In Python, each value is an object and has a data type associated with it. Data type of a value
refers to the value it is and the allowable operations on those values. Built-in core/fundamental data
types available in Python are:
Number: Number data type stores numerical values, such as 123, –78, 45, 2000.87, etc.
Strings: A string is a sequence of characters that can be a combination of letters, numbers and special
symbols, enclosed within quotation marks, single or double or triple (‘ ‘ or “ “ or ‘’’ ‘’’).
>>>str = "India"
>>>print(str) #Output: India
bool (Boolean): Boolean data type represents one of the two possible values, True or False. Any expression
which can be True or False has the data type bool.
QUESTION 3
(a) What is difference between equality (==) and identity (is) operator? (1)
Ans. Equality (==) compares values while identity (is) compares memory address of variables/objects.
(b) Reema is confused between 3*2 and 3**2. Help her to know the difference between the two
expressions. (1)
Ans. The statement 3*2 multiplies 3 by 2 and produces the result 6 while 3**2 calculates 3 raised to the power
2 and produces the result 9.
1
( mark for each expression)
2
2