NCERT Solutions Class 11 Computer Science Chapter 5 Introduction to Python

NCERT Solutions Class 11 Computer Science Chapter 5 Introduction to Python have been provided below and is also available in Pdf for free download. The NCERT solutions for Class 11 Computer Science have been prepared as per the latest syllabus, NCERT books and examination pattern suggested in Class 11 by CBSE, NCERT and KVS. Questions given in NCERT book for Class 11 Computer Science are an important part of exams for Class 11 Computer Science and if answered properly can help you to get higher marks. Refer to more Chapter-wise answers for NCERT Class 11 Computer Science and also download more latest study material for all subjects. Chapter 5 Introduction to Python is an important topic in Class 11, please refer to answers provided below to help you score better in exams

Chapter 5 Introduction to Python Class 11 Computer Science NCERT Solutions

Class 11 Computer Science students should refer to the following NCERT questions with answers for Chapter 5 Introduction to Python in Class 11. These NCERT Solutions with answers for Class 11 Computer Science will come in exams and help you to score good marks

Chapter 5 Introduction to Python NCERT Solutions Class 11 Computer Science

1. Python It is a general purpose interpreted, interactive, object oriented and high level
programming language. It was initially designed by Guido Van Rossum in 1991 and developed by Python Software Foundation.

2. Python Character Set Character set is a set of valid characters that represents any digit, alphabet and special symbol. The character used in a Python source program belongs to unicode standard.

3. Python Tokens A smallest individual unit in a program is known as token or lexical unit or lexical element.

The Python has following tokens:

(i) Identifiers Identifiers are names used to identify a variable, function, or other entities in a program.

(ii) Keywords Keywords are predefined reserved words that have some special or predefined meanings. These are reserved for special purpose and must not be used as identifier names.

(iii) Constants or Literals Literals refer to fixed values that the program may not alter (change) during the program execution.

Python allows several types of literals as follows
(a) Numeric literals
(b) String literals
(c) Boolean literals
(d) Special literal None
(e) Literal collections

(iv) Operators An operator is used to perform specific mathematical or logical operation on
values. The values that the operators work on are called operands.

Python supports two types of operators as follows
• Unary operators
• Binary operators

(v) Punctuators A punctuator is a token that has syntactic and semantic meaning to the compiler, but the exact significance depends on the context. Punctuators (separators) are used to separate line of codes, variables etc.

4. Expression is a combination of operators, constants and variables. Any part in a program which can have a value, is an expression. It will have operands and operators together to produce a value.

5. Statement in Python is a logical instruction which Python interpreter can read and execute. It could be an expression or assignment statement.

6. Comments are used to add a remark or a note in the source code that are ignored by the interpreter or compiler and are not executed by the computer.

7. A function is a self contained block of statements which are kept together to perform a specific task in related manner.

8. Blocks and indentation indicate the relationship between various statements and thus allow us to get a better picture of the overall organisation and structure of the solution given in the program. It improves the readability of the program.

9. Variables In a program, a variable is uniquely identified by a name (identifier). Variable refers to an object - an item or element that is stored in the memory. Value of a variable can be a string, numeric or any combination of alphanumeric characters.

10. Data Types Data type is a term that is used to show the kind of data values or the type of data that is expected to be handled. i.e. Data types are used to identify the type of data and associated operations to handle it.

There are different data types available in Python as

""NCERT-Solutions-Class-11-Computer-Science-Chapter-5-Introduction-to-Python

11. Mutable and Immutable Types Every variable in Python holds an instance of an object.

There are two types of objects in Python as follows

(i) Mutable Types The values of mutable types can be changed after it is created. These are list, dictionary and sets.

(ii) Immutable Types The values of immutable cannot be changed after it is created.These are integer, float, boolean, string and tuple.

12. Control Structure A control structure is a programming language construct which affects the flow of the execution of program.

13. Sequence Statements Sequence statements refer to the instructions that are executed in the sequence in which they are written in the program.

14. Selection Statements Selection statement is a control statement that allows statement choosing two or more execution paths in a program.
These statements allow a program to execute a statement or a set of statements depending upon a given condition.

• if Statement This statement is used to decide whether a certain statement or block of statements will be executed or not, i.e. if a certain condition is True, then a block of statement is executed otherwise not.

• if-else Statement This statement also tests a conditional expression. If the condition is True, the entire block of statements following the if will be executed. Otherwise, the entire block of statements following the else will be executed.

• if-elif-else Statement First of all, the first condition is evaluated, if it is true then respective statements are processed.
Otherwise, the next condition is evaluated to process another statements. This process is continued for several times.

• nested if Statement Nested means if statements or if-else statements are placed in the statement block of if statement or else statement.

15. Iterative Statements Iteration is the repetition of a process in order to generate an outcome. Iterative statements or loops enable a program with a cyclic flow of logic.

• while Loop This loop tests for its ending condition before executing the statements enclosed in the loop body even the first time.

• for Loop This loop encloses one or more statements that form the body of the loop, the statements in the loop repeat continuously a certain number of times.
This loop is also known as entry control loop, as condition is checked before entering into the scope of the loop.

16. Jump Statements These statements allow altering the flow of a program by performing jumps to specific locations. The jump statement defined in Python are

• break Statement This statement alters the normal flow of execution as it terminates the current loop and resumes execution of the statement following that loop.

• continue Statement When a continue statement is encountered, the control skips the execution of remaining statements inside the body of the loop for the current iteration and jumps to the beginning of the loop for the next iteration.
 

Direction (Q. Nos. 1-15) Each of the question has four options out of which only one is correct.

Select the correct option as your answer.

1. Which of the following is not a valid identifier?
(a) _Num
(b) Sum123
(c) num^2
(d) name_1
Answer : C

2. Which of the following is a keyword that has pre-defined meaning?
(a) python
(b) data type
(c) global
(d) variable
Answer : C

3. What is the output of following code?
i=2
while (i<10):
  if(i==6):
     break
  print(i)
  i=i+2
(a) 2
     4
(b) 2
     3
     4
(c) 2
     3
     4
     6
(d) 2
     4
     6
Answer : A

4. Which statement is used for the condition a loop is to be repeated 30 times?
(a) for i in range (0, 30) :
(b) for i in range (0, 30, +1):
(c) for i in range (1, 31, 1):
(d) All of these
Answer : D

5. What is the output of following code?
mul=3
value=10
for i in range (1, 6, 2):
if (value% mul==0):
     print(value*mul)
else:
     print(value+mul)
(a) 13
     14
     15
(b) 13
     13
     13
(c) 3
     10
     13
(d) Error
Answer : B

6. Evaluate the expression and identify the correct answer.
A = 5 * 3 / /4 + 6 / /8 + 7 − 3 + 9 / /3 + 7
(a) 17
(b) 20
(c) 27
(d) 14
Answer : A

7. What is the output of following code?
n=4
f=1
while (n>0):
     f=f*n
     n=n−1
print(f)
(a) 24
(b) 120
(c) 10
(d) Error
Answer : A

8. What is the output of following code?
n = 156
f = 0
x = 0
while (n > 3) :
 r = n% 100
  if (r % 2 ! = 0):
       f + = r
else :
       x + = r
    n/=100
print(f − x)
(a) 56
(b) − 56
(c) 55
(d) 155
Answer : B

9. Identify the output of following code.
a=3
while (a<12) :
     print(a, end= ‘ ’)
     a = a + 2
(a) 3 4 5 6 7 8 9 10 11 12
(b) 3 4 5 6 7 8 9 10 11
(c) 3 5 7 9 11
(d) 5 7 9 11
Answer : C

10. Identify the output of following code.
for i in range (− 7, − 20, − 2):
        print (i+2)
(a) − 7               (b) − 20
     − 9                     − 18
     − 11                   − 16
     − 13                   − 14
     − 15                   − 12
     − 17                   − 10
     − 8
(c) None
(d) Error
Answer : C

11. What is the output of following code?
x=1
for i in range (1, 7, 2) :
        x + = i + 2
print(x)
(a) 16
(b) 9
(c) 25
(d) Error
Answer : A

12. Identify the output of following code.
i=1
while (i < 10) :
   print(i)
    i = i * 3
(a) 3
     9
(b) 0
     3
     9
(c) 1
     3
     9
(d) Error
Answer : C

13. What will be the output of the following Python code?
i = 1
while (i < 6):
         print(i)
         i+= 2
         if i = = 4:
                  break
else:
         print(2)
(a) 1
     3
     5
     2
(b) 1
     2
     3
(c) 1
     3
     5
(d) 1
     2
     3
     5
     2
Answer : A

14. What will be the output of the following Python code?
for i in range(8):
    if i = = 4:
         break
else:
         print(i+3)
else:
         print(1)
(a) 2
     4
     6
     8
(b) 3
     4
     5
     6
     1
(c) 3
     4
     5
     6
(d) Error
Answer : C

15. What will be the output of the following Python code snippet?
x = ‘ARIHANT’
for i in range(len(x)):
         x[i].lower()
print(x)
(a) ARIHANT
(b) arihant
(c) Arihant
(d) Error
Answer : A

 

NCERT Solutions for Class 11 Computer Science Chapter 5 Introduction to Python Very Short Answer type Questions

Question 1: Is Python a high-level Language ?
Answer: Yes, Python is a high-level Language.

Question 2: Is Python interpreted ?
Answer: Yes, Python is a interpreted language.

Question 3: Is Python Object-Oriented Language ?
Answer: Yes, Python is a Object-Oriented Language.

Question 4: How many modes are available in Python ?
Answer: interactive mode and script mode.

Question 5: Can Python be easily integrated with C+ + ?
Answer: Yes, Python can be easily integrated with C + +.

Question 6: Is Python supports GUI applications?
Answer: Yes, Python supports GUI applications.

Question 7: Does Python support automatic garbage collection ?
Answer: No, Python does not support automatic garbage collection.

Question 8: Does Python support Hyper Text Markup Language?
Answer: No, Python does not support Hyper Text Markup Language.

Question 9: “Python is Scalable”, is this statement true?
Answer: True.

Question 10: Can we connect Python to database ?
Answer: Yes, we can connect with all major commercial databases.

 

NCERT Solutions for Class 11 Computer Science Chapter 5 Introduction to Python Short Answer type Questions 

Question 1: Define Python ?
Answer: Python is a high-level, interpreted, interactive and object oriented-scripting language.

Question 2: Why Python is interpreted ?
Answer: Python is interpreted because it processed at runtime by the interpreter and you do not need to compile your program before executing it. This is similar to PERL and PHP.

Question 3: Is there a tool to help find bugs or perform static analysis ?
Answer: Yes,
1. Pychecker is a static analysis tool that finds bugs in Python source code and warns about code complexity and style.
2. Pylint is another tool that checks if a module statisfies a coding standards, and also makes it possible to write plug-ins to add a custom feature.

Question 4: Who developed Python?
Answer: Python was developed by Guido van Rossum in the late eighties and early nineties at the National Research Institute for Mathematics and Computer Science in the Netherlands.

Question 5: Why Python is Easy-to-learn?
Answer: Python has relatively few keywords, simple structure, and a clearly defined syntax. This allows the student to pick up the language in a relatively short period of time.

Question 6: Write any feature of Python library.
Answer: Python library is very portable and cross-platform compatible on UNIX, Windows, and Macintosh.

Question 7: Write any one similarity between Python and OOPs
Answer: Python supports most of the OOP concepts like encapsulation, inheritance and polymorphism.

Question 8: Is Python compiler language or interpreter language?
Answer: It is normally interpreted by another computer program. However subsets of the language can be compiled.


NCERT Solutions for Class 11 Computer Science Chapter 5 Introduction to Python Long Answer type Questions  

Question 1: What is the Python programming language?
Answer: Python is an interpreted, interactive, object- oriented programming language. It is often compared to Tel, Perl, Scheme or Java. It is a scripting language like Php or Asp for developing applications. Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. Python’s simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse. The Python interpreter and the extensive standard library are available in source or binary form without charge for all major platforms, and can be freely distributed.

Question 2: What is Python ? State some programming language features of Python.
Answer:
1. Python is a modern powerful interpreted language with objects, modules, threads,exceptions, and automatic memory managements.
2. Python was introduced to the world in the year 1991 by Guido van Rossum Salient features of Python are :
- Simple & Easy : Python is simple language & easy to learn.
- Free/open source : Everybody can use python without purchasing license.
- High level language : When coding in Python one need not worry about lowlevel details.
- Portable : Python codes are Machine & platform independent.
- Extensible: Python program supports usage of C/ C + + codes.
- Embeddable Language : Python code can be embedded within C/C+ + codes & can be used a scripting language.
- Standard Library : Python standard library contains prewritten tools for programming.
- Built-in Data Structure : Contains lots of data structure like lists, numbers & dictionaries.

Question 3: Distinguish Java with Python
Answer: Java v/s Python :
1. Python programs run slower than the Java codes, but Python saves much time and space. Python programs are 3-5 times smaller than Java programs.
2. Python is a dynamic typed language. Python programmers don’t need to waste time in declaring variable types as in Java.
3. Python is much more easy to learn than Java.

Question 4: Explain the disadvantages of Python.
Answer: Disadvantages of Python are :
- Python is not the best for memory intensive tasks.
- Python is interpreted language and is slow compared to C/C+ + or java.
- Python is not a great choice for a high graphic 3D game that takes up a lot of CPU.
- Python is evolving continuously with constant evolution there is little substantial documentation available for the language.

Question 5: Compare C + + v/s Python.
Answer: C+ + v/s Python
1. Comparison is same as that between Java and Python except the program length in python is 5-10 times shorter than that in C + + .
2. Python programmers can complete a task in 2 months that takes a year in C + +.

Question 6: How do we make Python Scripts Executable ?
Answer: Python scripts can be executed in two ways :
1. Open the script1.Py in IDE Editor and run the script in the frontmost window of the Python IDE by hitting the run all button.
2. Using command prompt by making sure PATH is appropriate directly type script name. > > > python Script1.Py

 

NCERT Solutions Class 11 Computer Science Chapter 5 Introduction to Python

The above provided NCERT Solutions Class 11 Computer Science Chapter 5 Introduction to Python is available on our website www.studiestoday.com for free download in Pdf. You can read the solutions to all questions given in your Class 11 Computer Science textbook online or you can easily download them in pdf. The answers to each question in Chapter 5 Introduction to Python of Computer Science Class 11 has been designed based on the latest syllabus released for the current year. We have also provided detailed explanations for all difficult topics in Chapter 5 Introduction to Python Class 11 chapter of Computer Science so that it can be easier for students to understand all answers. These solutions of Chapter 5 Introduction to Python NCERT Questions given in your textbook for Class 11 Computer Science have been designed to help students understand the difficult topics of Computer Science in an easy manner. These will also help to build a strong foundation in the Computer Science. There is a combination of theoretical and practical questions relating to all chapters in Computer Science to check the overall learning of the students of Class 11.

 

Where can I download latest NCERT Solutions for Class 11 Computer Science Chapter 5 Introduction to Python

You can download the NCERT Solutions for Class 11 Computer Science Chapter 5 Introduction to Python for latest session from StudiesToday.com

Are the Class 11 Computer Science Chapter 5 Introduction to Python NCERT Solutions available for the latest session

Yes, the NCERT Solutions issued for Class 11 Computer Science Chapter 5 Introduction to Python have been made available here for latest academic session

How can I improve my scores by reading NCERT Solutions in Class 11 Computer Science Chapter 5 Introduction to Python

Regular revision of NCERT Solutions given on studiestoday for Class 11 subject Computer Science Chapter 5 Introduction to Python can help you to score better marks in exams

Are there any websites that offer free NCERT solutions for Chapter 5 Introduction to Python Class 11 Computer Science

Yes, studiestoday.com provides all latest NCERT Chapter 5 Introduction to Python Class 11 Computer Science solutions based on the latest books for the current academic session

Are NCERT solutions for Class 11 Chapter 5 Introduction to Python Computer Science available in multiple languages

Yes, NCERT solutions for Class 11 Chapter 5 Introduction to Python Computer Science are available in multiple languages, including English, Hindi

What questions are covered in NCERT Solutions for Chapter 5 Introduction to Python?

All questions given in the end of the chapter Chapter 5 Introduction to Python have been answered by our teachers