0% found this document useful (0 votes)
37 views8 pages

Python Question Paper

The document outlines a comprehensive curriculum for a Programming in Python course, detailing various topics covered in five units, including algorithms, data types, control flow, functions, and object-oriented programming. It includes both theoretical questions and practical programming tasks to assess students' understanding and application of Python concepts. The questions are categorized by Bloom's taxonomy levels, indicating the complexity and depth of knowledge required for each topic.

Uploaded by

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

Python Question Paper

The document outlines a comprehensive curriculum for a Programming in Python course, detailing various topics covered in five units, including algorithms, data types, control flow, functions, and object-oriented programming. It includes both theoretical questions and practical programming tasks to assess students' understanding and application of Python concepts. The questions are categorized by Bloom's taxonomy levels, indicating the complexity and depth of knowledge required for each topic.

Uploaded by

sabitha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Unit I

Part – A Questions

Artificial Intelligence and Data Science


23AD101 – PROGRAMMING IN PYTHON
First Semester
Bloom
QNo CO
Questions ’s
s
Level
State the qualities of a good algorithm. CO
1. K1
1
Enumerate the strategies involved in developing an algorithm. CO
2. K1
1
How does a flow of control works? CO
3. K1
1
Write an algorithm to find the smallest among three numbers. CO
4. K2
1
Which is better iteration or recursion? Justify your answer. CO
5. K2
1
Write an algorithm to accept two numbers, compute the sum and print CO
6. the result. K1
1
Define iteration. CO
7. K1
1
Explain the basic organization of the computer. CO
8. K1
1
Define algorithm. CO
9. K1
1
List the building blocks of algorithm. CO
10. K1
1
Differentiate between algorithm, pseudocode and flowchart. CO
11. K2
1
What are the different notations used in problem solving. CO
12. K1
1
Draw a flowchart to find whether the given number is even. CO
13. K2
1
Draw a flowchart to find the average of three numbers and display the CO
14. result. K2
1
Write the pseudocode to calculate the sum and product of two numbers CO
15. and display it. K2
1
Part – B
Briefly describe iteration . Illustrate with an example. CO
1. K2
1
2. Write an algorithm and give the flow chart to find the net salary of an CO
employee. K2
1
3. Compare machine language, assembly language and high level CO
language. K2
1
4. Write pseudocode for CO
i. find maximum of 2 numbers (8 Marks) K2
1
ii. Find the given number is Prime or Not Prime. (8 Marks)
5. Explain in detail about notation of algorithms. CO
K2
1
6. Draw a flowchart and write an algorithm to accept three numbers, find CO
the greatest and print the result. K2
1
7. Draw a flow chart and write an algorithm to find the sum of series CO
1+2+3+4+…+100. K2
1
Briefly explain simple strategies for developing an algorithm. CO
8. K2
1

UNIT II

Q. CO’ Bloom’
Questions s
No s
Level
What are the rules for writing identifiers? CO
1 K1
2
Write a snippet to display “Hello World” in Python interpreter CO
2 K1
2
List any four built-in data types in python. CO
3 K1
2
How do you assign values to a tuple in python. CO
4 K1
2
Are comments executable statements in python program? How comments CO
5 are included in python program? K2
2
Identify operand(s) and operator(s) in the following expression: sum = a+b. CO
6 K1
2
Define Python and Enlist some features of python. CO
7 K1
2
CO
8 Compare Interpreter and Compiler. K1
2
Define keyword and enumerate some of the keywords in Python. CO
9 K1
2
List down the different types of operator used in python. CO
10 K1
2
Outline the logic to swap the content of two identifiers without using third CO
11 variable. K1
2
Define a variable and write down the rules for naming a variable. CO
12 K1
2
Name any two iterative statements supported by python. CO
13 K1
2
With an example, outline about Is operator. CO
14 K1
2
Differentiate between continue and break statement. CO
15 K1
2
Part – B
Write a program to check whether a given year is leap year or not. CO
1 K2
2
What is the role of interpreter? Give a detailed note on python interpreter CO
2 and interactive mode. Explain how python works in interactive mode and K3
2
script mode with example.
i. List out the control flow statements in python and explain
repetition type in detail with example. (8 Marks) CO
3 K3
ii. Write and explain the python program to swap numbers with and 2
without temporary variables. (8 Marks)
What is the difference between break and continue statement in python? CO
4 Explain with suitable examples. K2
2
Outline the data types supported by python with example. CO
5 K2
2
Name the types of operators supported by python and outline in detail about CO
6 arithmetic operator and Logical Operator with example. K2
2
Outline the conditional branching statement in python with an example. CO
7 K2
2
i. Write a Python program to calculate the factorial of a given number. (8
CO
8 Mark) K3
2
ii. write a program to find sum and average of n numbers. (8 Mark)
Write a Python program to illustrate the if condition, If ‟A‟ in entered it CO
9. display the word “Apricots‟; if “B‟ is entered, it display the word 2 K3
“Blueberries‟; and If ‟C‟ in entered it display the word “Cherries‟. Use
nested if statement.

UNIT III

Q. CO’ Bloom’
Questions s
No s
Level
1 Mention the type of arguments in python. CO3 K1
2 Compare return value and composition. CO3 K2
3 Define string immutability. CO3 K1
4 Illustrate the use of * and + operator in strings with example. CO3 K1
5 Comment with an example on the use of local and global variable CO3 K2
with same identifier name.
6 Define fruitful function. CO3 K1
7 Show the syntax of a function. CO3 K1
8 Differentiate between *args and **kwargs. CO3 K2
9 What is a global variable? And, show sample output. CO3 K2
Show the output of the following statements. CO3 K2
10 >>float(32)
>>float(3.14159)

11 Define string joining with example. CO3 K1


12 List the different types of arguments in function. CO3 K2
13 List few string operations in python. CO3 K2
14 How will you access a character in a string using index number? CO3 K2
15 What is command line argument? CO3 K1
Part – B
Explain the concepts of function and write a python program using CO3
1 any two looping statements to find the factorial of a given number K3
without using recursion.
2 Write a python program to reverse a string without using in built in CO3 K3
functions and explain the same with any two different methods.
3 What is a string function in python? Explain any three python CO3 K2
string methods with examples.
a) Write a python program using function to find the sum of
first ‘n’ odd numbers and print the result.
4 b) Write a program where a function takes an item name and CO3 K3
price, and uses keyword arguments to display the
information neatly.
5 Utilize the concepts of *args and **kwargs, Command Line CO3 K3
Arguments and explain individually with examples.
6 What is a function? How is a function defined and called in CO3 K3
python? Develop a simple program using function.
7 Write a Python function by applying two different methods to gen- CO3 K3
erate the Fibonacci series up to n terms without using recursion.
a) Make use of the basic operations of string and illustrate about CO3
the different methods of accessing a character in a string with
8 example K3
b) Solve an example with the concepts of String Slicing and
Joining

UNIT IV

Q. CO’ Bloom
Questions ’s
No s
Level
1 Define cloning in a list. CO4 K1
2 What is the benefit of using tuple assignment in python? CO4 K1
3 How do you delete a file in python? CO5 K2
4 How do you use command line arguments to give input to the CO5 K2
program?
5 Relate String and List. CO4 K2
Let List=[‘a’,’b’,’c’,’d’,’e’,’f’]. Find the following. CO4 K1
a.List[1:3]
6 b.List[:4]
c.List[3:]

7 Give examples for mutable and immutable objects. CO4 K2


8 What is the purpose of dictionary in python? CO4 K1
9 List any four file operations on python. CO5 K2
10 Write a python program to count words in a sentence using split() CO4 K1
function.
11 In python, how the values stored in list are accessed? Should the CO4 K2
elements of list be of the same data type?
12 How does python dictionary store data? Give example. CO4 K2
13 Write syntax for opening a file to write in binary mode. CO5 K1
14 Define list comprehension. CO5 K1
15 What are the properties of dictionary keys? CO4 K1

Part – B
Apply the concepts of list and explain in detail about list, list oper- CO4
1 ations and list slice. K3

2 Write a python program to generate the electricity bill based on CO4 K3


no.of units consumed. Refer the below table for unit and price de-
tails.
S.N No.of units Price Price
o consumed (Domestic) (Commercial)
1 Upto 200 units 200(Base 500
price)
2 Units>200 and <500 1100 1700
3 Unit>500 and <1000 4500 7000
Note: Program should read the information from the user.
Whether it is for commercial or domestic purpose.
(i) Write a function that copies a file reading and writing upto 50
characters at a time. (8 Marks)
3 (ii) Write a python program to count number of lines, words and CO5 K3
characters in a file. (8 Marks)

4 Apply the concepts of tuple and demonstrate with python code the CO4 K3
various operations that can be performed on tuple.
Define dictionary in python. Do the following operations on dictio-
naries.
i. Initialize two dictionaries with keys and value pairs.
ii. Compare two dictionaries with master key list and print
5 missing keys. CO4 K3
iii. Find keys that are in first and not in second dictionary.
iv. Find same keys in two dictionaries.
v. Merge two dictionaries and create a new dictionary using
a single expression.

Develop a python program and explain about the file reading and
6 writing operations using format operator. CO5 K3

Why does python require file handling? Develop a python program


7 to explain opening files with all modes. CO5 K3

Write a Python program that takes input from the user for two
numbers and performs division. Implement exception handling to
catch the following exceptions:
8  Division by zero (ZeroDivisionError). CO5 K3
 Invalid input if the user enters a non-numeric value
(ValueError).

UNIT V

Q. CO’ Bloom
Questions ’s
No s
Level
1 Define a class and an object. CO6 K1
2 What is the role of the constructor method (__init__) in a Python CO6 K1
class?
3 Differentiate between class attributes and data attributes in CO6 K2
Python.
4 How do you create multiple objects from the same class in CO6 K2
Python? Provide an example.
5 Define encapsulation. CO6 K1
6 What is inheritance in Python? Give an example of single CO6 K1
inheritance.
7 How is polymorphism implemented in Python? Provide a basic CO6 K2
example.
8 How do you override a method in a subclass in Python? Illustrate CO6 K2
with code.
9 Define a lambda function and provide a simple example of its CO6 K1
usage.
10 What is an iterator in Python? How do you create one manually? CO6 K1
11 Explain the concept of a generator in Python and how it differs CO6 K1
from an iterator.
12 Write a Python program to generate the first 5 even num- CO6 K2
bers using a generator.
13 What is a list comprehension? Provide an example to create a list CO6 K2
of squares of numbers from 1 to 5.
14 How do you combine functional programming with object-oriented CO6 K2
programming in Python? Provide an example.
15 Differentiate between a lambda function and a regular function in CO6 K2
Python.
Part – B
Explain the concept of classes and objects in Python. Write a Py-
1 thon program that defines a Book class with attributes like title, CO6 K3
author, and price. Implement methods to set and display these at-
tributes.
2 Describe encapsulation in object-oriented programming with an CO6 K2
example.
Write a Python program that demonstrates the concept of
inheritance using a Vehicle base class with a method move().
3 Derive two classes Car and Bike, overriding the move() method. CO6 K3
Show polymorphic behavior by calling the move() method from
different objects.
Write a Python program using a lambda function to sort a list of
4 tuples based on the second element. Also, use the map() function CO6 K3
with a lambda to square a list of numbers. Explain how lambda
functions make code concise.
Create a list of numbers from 1 to 50 using a list comprehension,
5 selecting only the even numbers. Then, create an iterator for the CO6 K3
list and display each element using the iterator. Explain the ad-
vantages of using list comprehensions and iterators.
Implement a generator function that yields the first 10 Fibonacci K3
6 numbers. Explain how generators work, their memory efficiency, CO6
and how they differ from iterators.
Explain the difference between functional programming and
7 object-oriented programming with examples CO6 K2

You might also like