Script Programming: Scheme of Valuation 18IT404 B.Tech., (Semester-IV)
Script Programming: Scheme of Valuation 18IT404 B.Tech., (Semester-IV)
Scheme of Valuation
Script Programming
18IT404
B.Tech.,(Semester- IV)
Date : June, 2020 Semester End Examination : Regular
Duration : 3 hrs. Maximum Marks : 50
1. (1X10 = 10 Marks)
(a) How to get the ASCII value of a character ’c’ in Python? CO1 L1
(b) Write a Python program to swap two variables. CO1 L2
(c) What is the use of “pass” keyword in Python? CO1 L2
(d) What is the output of the following code snippet CO2 L2
y = [x**2 for x in range (5)]
print (y)
(e) Given a string S = “Problem”. How to extract the pattern “Polm” from the string? CO2
L2
(f) Create a dictionary called “capitals” that contains the states and state capitals. Include
’Washington’, capital ’Olympia’ and ’Oregon’, capital ’Salem’. CO2 L2
(g) Write one string that does not matches with the pattern “be[0-9a-zA-Z]t” CO3 L2
(h) How to check whether a variable V is of integer or string type? CO3 L2
(i) Write the difference between Syntax error and exception CO4 L2
(j) What is the use of “finally” block in Python? CO4 L2
UNIT - I
2. (a) Write a program that prints the numbers from 1 to 100. But for multiples of three print
“Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers
which are multiples of both three and five print “FizzBuzz” (CO1, L2, 5 Marks)
(b) Write a Python program to find the factorial of a number (CO1, L2, 5 Marks)
OR
3. (a) Write a Python program to print all prime number in an interval, say 100 to 200 (CO1,
L2, 5 Marks)
(b) Write a Python program to calculate the sum of the digits in a four digit integer (CO1,
L2, 5 Marks)
UNIT - II
4. (a) Write a Python program to count the number of strings where the string length is 2 or
more and the first and last character are same, from white space seperated strings given
as input by the user (CO2, L2, 5 Marks)
(b) Write a Python program to get the n (non-negative integer) copies of the first 2
characters of a given string. Return the n copies of the whole string if the length is
less than 2. (CO2, L2, 5 Marks)
2
OR
5. (a) Write about the characteristics of List and Dictionary. (CO2, L1, 4 Marks)
(b) How access, update and delete operations can be performed on the following objects i)
List ii) Dictionary (CO2, L2, 4 Marks)
UNIT - III
6. Define the classes shown in the following diagram. The solution should include canonical
representation, string representation and overloaded equalto ( == ) operator. (CO3, L2, 10
Marks)
OR
UNIT - IV
8. (a) With a simple example Python program explain control flow under the following
scenerios i) when no excetion is raised ii) when an excetion is raised (CO4, L2, 6
Marks)
(b) Implement a Queue in Python. When the user tries to dequeue from an empty Queue
it shoud raise an user defined exception ’QueueEmpty’. (CO4, L2, 6 Marks)
OR
9. (a) Write about any six built-in exception types in Python. (CO4, L2, 6 Marks)
(b) Implement a Stack in Python. When the user tries to pop from an empty Stack it shoud
raise an user defined exception ’StackEmpty’. (CO4, L2, 6 Marks)