INTRODUCTION TO COMPUTING AND PROBLEM SOLVING KTU B-TECH 1st YEAR QUESTION PAPER 2016-2017

Max. Marks: 100                                                       Duration: 3 Hours 


PART A 


INTRODUCTION TO COMPUTING AND PROBLEM SOLVING  KTU B-TECH 1st YEAR QUESTION PAPER 2016-2017



Answer all questions, each question carries 4 marks

  1. 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.
  2. Write notes on buses.
  3. Draw the flowchart to find out the greatest of three numbers. 
  4. Differentiate between top down and bottom up problem solving strategies.
  5. Write an algorithm to compute sum of the series  ... .... up to N terms.
  6. 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                               
  7. Write a Python program to find the sum of all even terms in a group of n numbers entered by the user.  
  8. Show how you will use the cosine() and log() functions in your program with the help of an example.
  9. What will be the output of this program? Briefly explain the working of this code.
    def check(x,y): 
    if y=0:              
    print ‘error’     
    return               
    else:                  
    return x/y        
    a,b=10,5           
       print check (a,b)
  10. Write a Python program to compute the nth Fibonacci number. Use a recursive function for the implementation.
  11. 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]
  12. 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.
  13. 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)
  14. Write the syntax for opening a file in Python. Give one example.
  15. What do you mean by pickling in Python? Explain its significance with the help of an example.
  16. 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



  1. (a) Draw and explain the instruction execution cycle in a computer. 
    (b) Write notes on OMR, MICR, and OCR devices.
  2. Give the algorithm and flowchart for finding the largest and smallest numbers in a given list of N numbers.. 
  3. (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)
  4. (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)
  5. (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)
  6. (8 x 4 = 32 Marks)
     

PART-C 


Answer Any 2 Question carries 14 marks


  1. (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.
  2. (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)
  3. (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)


INTRODUCTION TO COMPUTING AND PROBLEM SOLVING  KTU B-TECH 1st YEAR QUESTION PAPER 2016-2017


No comments:

Powered by Blogger.