2024 - IPPQuestion Bank
2024 - IPPQuestion Bank
INTRODUCTION TO PYTHON
PROGRAMMING
BIPPB105
3 Write a python program to add n numbers accepted from the user. CO1
4 What is the difference between an integer and a floating-point number in Python? CO1
Provide an example to illustrate how these data types are handled.
5 What is string concatenation in Python? Explain with an example how strings can CO1
be combined and why it is different from numerical addition.
6 What is string replication in Python? How is it different from string CO1
concatenation? Provide an example to explain both.
8 What is the purpose of the print() function in Python? Write a simple program that CO1
outputs "Hello, Python!" to the console and explain how it works.
9 What happens when you try to concatenate a string and an integer in Python? CO1
Explain with an example and describe how to avoid errors.
10 Demonstrate with example print() and input() and string replication. CO1
11 Explain elif, for, while break and continue statements in python with examples for CO1
each
12 Write a Python program to check whether a given number is even or odd. CO1
13 How can pass parameters in user defined functions? Explain with suitable example. CO1
14 Explain the local and global scope with local and global variables. CO1
15 Demonstrate the concept of exception. Implement a code which prompts the user CO1
for Celsius temperature, convert the temperature to Fahrenheit and print out the
converted temperature by handling the exception.
16 List and explain the significant features of Python Programming Language. CO1
Page 01 of 02
17 Describe the Python functions int(), float(),and str() with example. CO1
18 Write a math operators in python from highest to lowest Precedence with an CO1
example for each. Write the steps how python is evaluating the expression (5-
1)*((7+1)/(3+1)) and reduces it io single value.
19 List and explain the different comparison and Boolean operators, along with CO1
examples.
23 Write a function to generate Fibonacci sequence of length(N). Read N from the CO1
console.
24 Write a function named DivExp which takes TWO parameters a, b and returns a CO1
value c (c=a/b). Write suitable assertion for a>0 in function DivExp and raise an
exception for when b=0. Develop a Python program which reads two values from
the console and calls a function DivExp.
27 Explain for loop with an example? Explain continue statement and write a CO1
program and flow chart to explain the same(continue)
28 Explain while loop with an example? Explain break statement and write a program CO1
and flow
29 What do the following expressions evaluate to? CO1
• (5 > 4) and (3 == 5)
• not(5 > 4)
• (5 > 4) or (3 ==5)
• not((5 > 4) or (3 ==5))
• (True and True) and (True == False)
• (not False) or (not True)
30 Discuss various methods of importing modules in Python programs with suitable CO1
examples. Which method is best? Explain.
31 What is the difference between range(10), range(0, 10), and range(0, 10, 1) in a for CO1
loop?
32 Develop a program to read the name and year of birth of a person. Display whether CO1
the person is a senior citizen or not.
33 Write a python program to add n numbers accepted from the user. CO1
34 With Python programming examples to each, explain the syntax and control flow CO1
diagrams of break and continue statements
36 Explain looping control statement in python with a syntax and example to each CO1
2 Develop suitable Python programs with nested lists to explain copy.copy( ) and CO2
copy.deepcopy( ) methods.
3 Explain append() and index() functions with respect to lists in Python. CO2
4 Explain different ways to delete an element from a list with suitable Python CO2
syntax and programming examples.
5 Read a multi-digit number (as chars) from the console. Develop a program to print CO2
the frequency of each digit with suitable message.
7 What is a list? Explain the concept of list slicing and list traversing with an example. CO2
8 Discuss the methods that are used to delete items from the list. CO2
9 For the following three questions, let’s say spam contains the list ['a','b', 'c', CO2
'd',[3,4]]. i. What does spam[int('3' * 2) / 11] evaluate to? ii. What does spam[-2]
evaluate to? iii. What does spam[4][1] evaluate to?
10 Compare and contrast tuples with lists. Explain the following operations in tuples CO2
i. Sum of two tuples ii. Slicing operators iii. Compression of two tuples
Assignments to variables
11 What is a dictionary? How it is different from List? Write a program to count the CO2
number of occurrences of characters in a string
13 What is list? Explain append(),insert(), and remove() methods with examples. CO2
14 How is tuple is different from a list and which function is used to convert list to CO2
tuple.
16 Discuss get(), item(), keys(), and values() Dictionary methods in python with CO2
examples
17 Develop a program to accept a sentence from the user and display the longest CO2
word sentence along with its length
18 Explain reading and saving python program variables with the pprint.pformat() CO2
Function.
19 Write a program to count the number of occurrences of each letter in a string using CO2
dictionary. Explain the code ?
20 Write a program that uses setdefault() method to newly enter a key and value that CO2
does not exist in the dictionary? Also explain the working of setdefault() method.
21 Write a program to check whether a key or value exists in a dictionary. CO2
Page 01 of 02
22 Write a program using dictionary to store data about your friends birthday. CO2
24 Explain with example the working of identity with mutable objects and immutable CO2
objects?
25 List is mutable, explain with the help of code. Also give the code to modify a list? CO2
26 Give code example of converting list to tuple and vice versa using list() function CO2
and tuple() function.
27 What is the function of comma after typing a single value in a tuple? CO2
28 Read N numbers from the console and create a list. Develop a program to print CO2
mean,
variance and standard deviation with suitable messages.
29 Read a multi-digit number (as chars) from the console. Develop a program to print CO2
the frequency of each digit with suitable message.
30 Write a function divide_number(a,b) that takes two arguments and returns the CO2
result of their division. Handle the case where b is zero using exception handling.
31 Create a program that stores the names and scores of 3 students in a dictionary. CO2
Then calculate the average score and display the student with highest score.
32
33
34
35
36
Module-3
1 Write a program that reads a strings with five characters which starts with ‘a’ and CO3
ends with ‘z’. print search successful if pattern matches string.
2 Explain Python string handling methods with examples: split(),endswith(), ljust(), CO3 8
center(), lstrip()
3 With example code explain join() and split() string methods. CO3 6
5 Demonstrate with example of upper(), lower(), and isupper() string Methods. CO3 6
6 Explain the concept of string immutability in Python with an example. Why are CO3
strings immutable?
9 Write a Python program to demonstrate the use of split(), join(), and replace() CO3
methods on strings.
11 Write a Python program to count the occurrences of each vowel in a given string. CO3
12
13
14
15
16
17
18
19
20
21
22
Page 01 of 02
22POP13
Page 02 of 02