BCECCE4104 - Fundamentals of Python
BCECCE4104 - Fundamentals of Python
2
B Roll No. Total Printed Pages: 2
T B. Tech. II Year IV-Semester (Main/Back) End
4
1
2BT4166 Semester Examination, April 2023
(All Spl.)
6
BCECCE4104 : Fundamentals of Python
6
(b) Write applications of python and explain the difference in between python-2 and python-3. (6)
OR
Q.2 (a) Write down all the data types available in python with example. (6)
(b) What are comments, keywords, and scope of variable in python? (6)
UNIT-II (CO2)
Q.3 (a) Write a python script to take a number from user in variable ‘n’ and print the sum of all number
(6) up-to the ‘n’ using recursion.
Write a python script to take a number from user in variable ‘n’ and print the sum of all number up-
to the ‘n’ using recursion.
(Ex – if 5 is entered the output must be 1+2+3+4+5 = 15)
OR
Q.4 Python program to check the validity of password input by users. The program should do the (12) following –
1. Input password from user.
2. Consider condition 3 to 6 and set up flags for each criterion of a valid password. (Ex. -
has_valid_length = False)
3. First verify if the length of password is higher or equal to 8 and lower or equal to 16.
4. iterate through each character of the password.
5. check if there are lowercase alphabets, check if there are uppercase alphabets.
6. check if the password has digits, check if the password has special characters. Then only it
will print that the password is valid.
UNIT-III (CO3)
Q.5 (a) Write a Python function to count the number of even and odd numbers from a series of (6) numbers.
( Numbers : 1, 2, 3, 4, 5, 6, 7, 8, 9).
(b) Take name and age from user and store it in dictionary using a python script. (6)
OR
Q.6 (a) Write a code using map and lambda functions, to find the squares of a given list of numbers. (6)
Ex: Input: n=[3,4,5] Output:[9,16,25]
(b) Write a code using filter and lambda functions, to find even numbers from a list of numbers.
(6) Ex: Input n=[1,2,3,4,5] Output:[2,4]
UNIT-IV (CO4)
Q.7 (a) Explain the difference between multiple inheritance and multilevel inheritance explain with an
(6) example.
(b) With the real world explain the data abstraction and encapsulation. (6)
OR
Q.8 (a) Write a suitable piece of code to demonstrate the difference in between method overloading (6) and overriding.
UNIT V (CO5)
Q.9 (a) How to open and close file? Also give the Syntax for same. (6)
(b) Write a program to read data from two text files and then write that data into another file (6)
(sample.text).
OR
(b) Write a program to count the total number of upper case, lower case, and digits used in the text (6) file.
2BT4166-A Page 2