FIRST SEMESTER B.TECH DEGREE EXAMINATION, JANUARY 2016
Course Code: BE101-05
Course Name: INTRODUCTION TO COMPUTING AND PROBLEM SOLVING
Max. Marks: 100 Duration: 3 Hours
PART A
Answer all questions, each question carries 4 marks
- a) Name any 3 optical input devices.
b) Name the different I/O ports used in a computer.
c) Define system software with an example. - Write notes on buses.
- Draw the flowchart to find out the greatest of three numbers.
- Differentiate between top down and bottom up problem solving strategies.
- Write an algorithm to compute sum of the series
... .... up to N terms.
- a) Which of the following is a valid variable name in Python? (i) 12xyz (ii) break (iii) A_123 (iv) A?B?C
b) Evaluate the expression x**y**z given x=2,y=3,z=2 .
c) Predict the output of following code:for i in range( 10,-1 ,-2):print i - Write a Python program to find the sum of all even terms in a group of n numbers entered by the user.
- Show how you will use the cosine() and log() functions in your program with the help of an example.
- What will be the output of this program? Briefly explain the working of this code.def check(x,y):if y=0:print ‘error’returnelse:return x/ya,b=10,5print check (a,b)
- Write a Python program to compute the nth Fibonacci number. Use a recursive function for the implementation.
- Let fruit='apples' be a string. What will be the output of the following expressions:
i) len(sl) (ii) sl[0:4] (iii) sl[6] (iv) sl[-4] - Let Data represent the list [‘circle’,’square’,’triangle’]. Write the expressions for following operations:
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. - Let farm={'Sheep':5,'Cows':2,'Goats': 10} be a dictionary. Write the statements for following operations.
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) - Write the syntax for opening a file in Python. Give one example.
- What do you mean by pickling in Python? Explain its significance with the help of an example.
- When does an exception occur during program execution? How are exceptions handled in Python? Explain with examples.
( 40 Marks)
PART-B
Answer any four questions each having 8 marks
- (a) Draw and explain the instruction execution cycle in a computer.
(b) Write notes on OMR, MICR, and OCR devices. - Give the algorithm and flowchart for finding the largest and smallest numbers in a given list of N numbers..
- (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) - (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) - (a) Why do we need functions? What are the advantages of using a function? (3)
(b) Write a Python program to simulate a menu driven calculator with addition, subtraction, multiplication, division and exponentiation operations. Use a separate function to implement each operation. (5)
(8 x 4 = 32 Marks)
PART-C
Answer Any 2 Question carries 14 marks
- (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.
(b) Write a Python program to count number of vowels, consonants, words and question marks in a given string.
(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. - (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.(3)
(b) Write a Python program to create a text file and to input a line of text to it. Display the line of text with all punctuation marks removed. (7) - (a) Define the terms class, attribute, method and instance with the help of an example. (4)
(b) Create a class Car with attributes Model, year and price and a method cost() for displaying price. Create two instances of the class and call the method for each instance. (5)
(c) Write a Python program to create a file containing 10 numbers. Read the contents of the file and display the square of each number. (5)
<<<go back