Semester : S1 and S2
Year : 2016
Term : JANUARY
Branch : MECHANICAL ENGINEERING
Scheme : 2015 Full Time
Course Code : BE 101-05
Page:2
i) Replace the value ‘circle’ with ‘ellipse’
ii) Add a new value ‘rectangle’ top end of list
iii) Remove the values ‘square’ and ‘triangle’ from list.
13. Let farm={'Sheep':5,'Cows':2,'Goats':10} be a dictionary. Write the statements for following
operations. (3)
i) To add the key value pair (‘Ducks':8)
ii) To display the number of items in the dictionary.
iii) To remove the key value pair (‘Cows':2)
14. Write the syntax for opening a file in Python. Give one example. (2)
15, What do you mean by pickling in Python? Explain its significance with the help of an example.
(3)
16, When does an exception occur during program execution? How are exceptions handled in
Python? Explain with examples. (3)
PARTB
Answer any 4 complete questions each having 8 marks
17. (a) Draw and explain the instruction execution cycle in a computer. (4)
(b) Write notes on OMR, MICR, and OCR devices. (4)
18. Give the algorithm and flowchart for finding the largest and smallest numbers in a given list of
N numbers. (8)
19. (a) Differentiate between break and continue statements with proper examples. (3)
(b) Write a Python program to display all Armstrong numbers in a given range. (5)
20. (a) Write a Python program to count the number of zeros and negative terms in a given set of n
numbers. (4)
(b) Write a Python program to find the sum of digits of a number using functions(preferably a
recursive function). (4)
21. (a) Why do we need functions? What are the advantages of using a function? (3)
(b) Write a Python program to simulate a ménu driven calculator with addition, subtraction,
multiplication, division and exponentiation operations. Use a separate function to implement
each operation. (5)
Answer any 2 complete questions each having 14 marks
22. (a) What do you mean by mutability of a data structure? Explain with the help examples, why
we say that lists are mutable while tuples are immutable. (3)
(b) Write a Python program to count number of vowels, consonants, words and questionmarks
in a given string. (6)
(c) Write a Python program to input a list of n numbers, Calculate and display the average of
numbers. Also display the cube of each value in the list. (5)
23. (a) Write a Python program to create a dictionary of roll numbers and names of 5 students.
Display the contents of dictionary in alphabetical order of names. 0