0% found this document useful (0 votes)
3 views5 pages

PARTB Unit3 Notes Python Programming

The document contains important questions and answers related to Python programming for Class 11, including multiple choice, short answer, and long answer questions. It covers topics such as data types, operators, type casting, and features of Python. Additionally, it includes competency-based questions and practice programs for students to enhance their understanding of the subject.

Uploaded by

pieeeditz
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views5 pages

PARTB Unit3 Notes Python Programming

The document contains important questions and answers related to Python programming for Class 11, including multiple choice, short answer, and long answer questions. It covers topics such as data types, operators, type casting, and features of Python. Additionally, it includes competency-based questions and practice programs for students to enhance their understanding of the subject.

Uploaded by

pieeeditz
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CLASS 11: ARTIFICIAL INTELLIGENCE

Unit 3: Python Programming


IMPORTANT QUESTIONS FROM CBSE HANDBOOK.
WRITE ALL THE QUESTIONS AND ANSWER IN YOUR NOTEBOOK.

A. Multiple Choice Questions


A. Multiple choice questions
1. Identify the datatype L = “45”
a. String b. int c. float d. tuple

2. Which of the following function converts a string to an integer in python?


a. int(x) b. long(x) c. float(x) d. str(x)

3. Which special symbol is used to add comments in python?


a. $ b. // c. /*.... */ d. #

4. Which of the following variable is valid?


a. Str name b. 1str c. _str d. #Str

5. Elements in the list are enclosed in _____ brackets


a. ( ) b. { } c. [ ] d. /* */

6. Index value of last element in list is ____________________


a. 0 b.-10 c. -1 d.10

7. What will be the output of the following code?


a = [10,20,30,40,50]
print(a[0])
a.20 b.50 c. 10 d.40

8. Name the function that displays the data type of the variable.
a. data( ) b. type( ) c. datatype( ) d. int( )

9. Which library helps in manipulating csv files?


a. files [Link] c. math d. print

10. Which keyword can be used to stop a loop?


a. stop b. break c. brake d. close

B. Short answer questions:


1. input() function accepts the value as string only. How can you convert string
to int?
Ans: Using int( ) function together with input( ), we can convert string to int.
2. What are variables? What are the rules of declaring variables in Python?

Ans: Named labels whose value can be used and processed during program run.
Generally, keywords (list given above) are not used as variables. Variable names
cannot start with digit and also it can’t contain any special characters except
underscore.

3. What do you mean by type casting?

Ans: A variable of particular datatype can be converted into another datatype using
some functions. The explicit conversion of an operand to a specific type is called type
casting.
4. “Python supports dynamic typing”, True or False. Justify your answer.
Ans: True
A variable pointing to a value of certain data type can be made to point to a
value/object of another data type. This is called Dynamic Typing. Python supports
Dynamic Typing.

5. Name any four features of python language.


Ans: ❖ High Level language
❖ Interpreted Language
❖ Free and Open Source
❖ Platform Independent (Cross-Platform)

6. Give examples for keywords.


Ans: and, as, continue, if, not try, del, pass

7. Expand CSV.
Ans: Comma Separated Values

C. LONG ANSWER QUESTIONS.


1. Define an operator and provide examples of different operators along with their
functions.
Ans: Operators are symbols or keywords that perform operations on operands to produce
a result. Python supports a wide range of operators:
• Arithmetic operators (+, -, *, /, %)
• Relational operators (==, !=, <, >, <=, >=)
• Assignment operators (=, +=, -=)
• Logical operators (and, or, not)
• Bitwise operators (&, |, ^, <<, >>)
• Identity operators ( is, is not)
• Membership operators (in, not in)
2. Describe the data types supported by Python, providing relevant examples.
Ans:

COMPETENCY BASED QUESTIONS:


1. Help Priya to differentiate the given information into various datatypes of
Python. Name of the student, email id, student id, marks in 5 subjects which
can be changed at any point, 3 extra subjects chosen which cannot be
changed later.
Ans: The different datatypes of Python for the given information are:
• Name of the student-String type
• Email id-String type
• Student id-Integer type
• Marks in 5 subjects which can be changed at any point-List type
• Extra 3 subjects which cannot be changed later-Tuple type.
2. For any analysis to be done, a huge amount of data needs to be collected
and stored in a proper format. Rohan has stored the information in a
delimited file that stores tabular data which is separated by comma. Which
type of file is Rohan using?
Ans: CSV file (Comma Separated Values)
3. Rohit wants to input the data about the runs scored by his 50 classmates.
Which is the most appropriate loop to be used in this case?
Ans: ‘for’ loop

PRACTICE PROGRAMS:
1. Write a Tipper program where the user inputs the total restaurant bill. The
program should then display two amounts: 15 percent tip and 20 percent tip.

Ans:

2. Write a program to check whether the user is eligible for driving license or
not.
Ans:
3. Write a program to accept the Basic salary from the user and calculate the Net
Salary.
Ans:

4. Write a program to display the first ten even natural numbers (use for loop).
Ans:

You might also like