You are on page 1of 2

NEW DELHI INSTITUTE OF MANAGEMENT

PGDM(G) / PGDM (M) / PGDM (F)

PGDM 2019-21| Semester-II


End Term Examination | March/April, 2020

Subject: Programming Skills in Python (Major-2) Paper Code: BA-03


Max. Marks: 50 Duration: 3 Hours
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Note:

1. The paper is divided in two sections: SECTION-A, SECTION-B


2. Students are required to attempt from Section - A very briefly. Each question Carries Two marks each .
3. SECTION-B Contains Six Programming based questions. Do any Five . You are suggested to run these
programs in Python Software & Paste the code at the space provided to you. You are advised to use as many
as Comment statements to support your code. Marks will be awarded on the basis of how far your code is
correct. Each Question Carries Six Marks.

SECTION-A
1. What is Interpreter ?
2. What are Statements and expressions in Python?
3. Differentiate Between while & For Statements with Example.
4. Explain how functions are being used in Python with Example? Also explain how to call a function.
5. Compare Function with Modules ?
6. What is the Purpose of Comment Statements? How this is being used in Python
7. Mention any Five features of Python?
8. Explain the Various ways to start Python?
9. Differentiate between List, Tuple & Dictionary?
10. Write any two functions to be used for List?

SECTION-B
1. Construct multiway based on the value of variable n with an integer value in the range 1-100, so that if n is less
than or equal to 25, “very low value” is displayed; if n is greater than 25 and less than or equal to 50, “low value”
is displayed; if n is greater than 50 and less than or equal to 75, “median value” is displayed; otherwise, “high
value” is displayed.

2. Explain break & Continue statements with the help of for loop in a Programming example of your own
choice?

3. With a given integral number n, write a program to generate an output that contains (i, i*i) such that is an
integral number between 1 and n (both included). and then the program should print the as follows:
Suppose the following input is supplied to the program:
8
Then, the output should be:
{1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64}
4. Write a program that calculates and prints the value according to the given formula:
Q = Square root of [(2 * C * D)/H]
Following are the fixed values of C and H:
C is 50. H is 30.
D is the variable whose values should be input to your program in a comma-separated sequence.
Example
Let us assume the following comma separated input sequence is given to the program in the form of list.
D=[100,150,180]
The output of the program should be:
18,22,24

5. Write a program that computes the net amount of a bank account based a transaction log from console
input. The transaction log format is shown as following:
D 100
W 200
D means deposit while W means withdrawal.
(Suppose the following input is supplied to the program:
D 300
D 300
W 200
D 100
Then, the output should be:
500)

6. Define a function that can accept two strings as input and print the string with maximum length in console. If
two strings have the same length, then the function should print both strings.
Hints: Use len() function to get the length of a string

You might also like