Enrollment No. ...........
MID TERM EXAMINATION
Third Semester (BCA) NOV 2024
Paper Code: BCA-211
Subject: Basics of Python Programming
Time: 2 Hours
Maximum Marks: 60
Note: Attempt five questions in all, including Q.no.1, which is compulsory. Select one question from each unit.
Q1. (a) Explain the salient features of Python programming language. [5]
(b) Write a Python program to print a dictionary that contains a number (between 1 and n) in the form (x, x*x). [5]
(c) Explain the following operators in Python with examples: [5]
- i) //
- ii) **
- iii) %
Q2. (a) Consider a string mystr = "Cinderella"
. Write a Python program to:
[10]
- i) Pick the word "der" from the upper case of character "e" in mystr.
- ii) Get the total number of occurrences of character "e" in mystr.
- iii) Check whether "der" exists in mystr.
(b) Write a program to find and calculate the square of only those numbers whose last significant digit is 5. [5]
Q3. (a) Write program control statements in Python. [5]
(b) Explain the following flow charts: [10]
- i) For an integer list
num = [145,32,14,65,97,172]
, write a Python program to replace all the occurrences of 3 with 9 and display the output. - ii) Explain the methods to access the functions (variable length) and default arguments in Python.
Q4. (a) Convert a 1D array of size 12 into 2D array of size 4x3. [5]
(b) Differentiate between list/tuple. Explain any two methods of element (with example) in list and tuple. [10]
Q5. (a) How can you define a function in Python (with keyword, positional, arbitrary (var args) and default arguments)? Explain with example. [10]
(b) Display the Python code to convert NumPy array into list. [5]