python fundamentals class 11 Question And Answers

python fundamentals class 11 solutions

python fundamentals
python fundamentals

Computer science with python

python fundamentals class 11 notes

cbse class 11 computer science notes 2021

Question And Answer

python fundamentals

Q 1. What is the difference between a keyword and an identifier ?

ans. Keyword is a special word that has a special meaning and purpose. Keywords are reserved and are a few. For example, if, elif, else etc. are keywords.

Identifier is a user-defined name given to a part of a program viz. variable, object, function etc. Identifiers are not reserved. These are defined by the user but they can have letters, digits and a symbol underscore. They must begin with either a letter or underscore. For instance, _chk, chess, trial etc. are identifiers in Python.

Q 2. What are literals in Python ? How many types of literals are allowed in Python ? (python fundamentals)

ans. Literals mean constants i.e., the data items that never change their value during a program run. Python allows five types of literals :
(i) String literals
(ii) Numeric literals
(iii) Boolean literals
(iv) Special Literal None
(V) Literal Collections like tuples, lists etc.

Q 3. How many ways are there in Python to represent an integer literal ?

ans. Python allows three types of integer literal :
(a) Decimal (base 10) integer literals
(b) Octal (base 8) integer literals
(c) Hexadecimal (base 16) integer literals

Q 4. How many types of strings are supported in Python ?

ans. Python allows two string types :
(i) Single-line Strings Strings that are terminated in single line
(ii) Multi-line Strings Strings storing multiple line of text.

Q 5. How can you create multi-line strings in Python ?

ans. Multi-line strings can be be created in two ways :
(a) By adding a backslash at the end of normal single-quote or double-quote strings e.g.,
Text = “Welcome /

(b) By typing the text in triple quotation marks. (No backlash needed at the end of line) e.g.,
Str1 = ”’ Welcome

Q 7. What factors guide the choice of identifiers in programs ?

(i) An identifier must start with a letter or underscore followed by any number of digits and/or letters.
(ii) No reserved word or standard identifier should be used.
(iii) No special character (other than underscore) should be included in the identifier.

Q 8. What is None literal in Python ?

ans. Python has one special literal called None.
The None literal is used to indicate something that has not yet been created in simple words, or absence of value. It is also used to indicate the end of lists in Python.

Q 9. Identify the types of following literals ?
23.789 23789 True “True’ “True”
False ”’False”’ 0XFACE 0o213 0o789


1. 23.789 Floating point
2. 23789 integer
3. True Boolean
4. “True’ String
5. “True” String
6. False Boolean
7. ”’False”’ String
8. 0XFACE Integer (Hexadecimal)
9. 0o213 Integer(Octal)
10. 0o789

Invalid token (beginning with 0 means 0 means it is octal number but digits 8 and 9 are invalid digits in octal numbers)

11. None None

Q 10. What is the difference between an expression and a statement in Python ?



Legal combination of symbols
Represents something
Python evaluates it
End result is a value
Example :
(3 + 5)/ 4


Programming instruction as per Python syntax
Does something
Python executes it
Need not result in a value
Examples :
if a > 0 :

Q 12. Which of the following are syntactically correct strings? state reasons.

(a) “This course is great!”
(b) ‘She shouted “Hello!” very loudly.’
(c) “Goodbye’
(d) ‘This course is great!’
(e) “Hello
(f) “I liked the movie ‘Bruce Almighty’ very much.”
Strings(a), (b), (d) and (f) are syntically correct.
String (c) is incorrect
string (e) is invalid

Q 13. What is the error in following Python Program with one statement ?
print(“My name is”, name)
Suggest a solution.

ans. The above statement is trying to print the value an undefined variable name. The solution to above problem is to define the variable name before using it, i.e.,
name = ‘Tanya’
print(“My name is”, name)

Q 14. What will be the output produced by following code ?
value = ‘simar’
age = 17
print(name, “, you are”, 17, “now but”, end = ‘ ‘)
print(“you will be”, age + 1, “next year”)

Simar, you are 17 now but you will be 18 next year.

Q 15. Predict the output of following :
x, y = 7, 2
x, y, x = x + 1, y +3, x + 10
print(x, y)

17 5



A data item that never changes its value during a program run.


Name given by user for a part of the program.


Reserved word having special meaning and purpose.

Lexical Unit

Other name of token.




The smallest individual unit in a program.

String literal

Sequence of character enclosed in any type of quotes.


Named stored location whose value can be manipulated during program run.


Legal combination of symbols that represent value.

Python fundamentals in details