0% found this document useful (0 votes)
3 views

python July 2015

The document is an End Semester Assessment for a B. Tech. course on Introduction to Computing Using Python, consisting of various programming and theoretical questions. It covers topics such as computational problem solving, Python programming constructs, recursion, file handling, and object-oriented programming. The assessment includes coding tasks, error identification, and explanations of concepts related to Python and programming principles.

Uploaded by

Shreeya Rao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

python July 2015

The document is an End Semester Assessment for a B. Tech. course on Introduction to Computing Using Python, consisting of various programming and theoretical questions. It covers topics such as computational problem solving, Python programming constructs, recursion, file handling, and object-oriented programming. The assessment includes coding tasks, error identification, and explanations of concepts related to Python and programming principles.

Uploaded by

Shreeya Rao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

SRN

PES UNIVERSITY UE1 SCSI 01


End Semester Assessment (ESA) B. Tech. 1 8t SEMESTER — July-2016
Summer Term
UEI5CS101 - introduction to Computing Using Python
Time: 3 Hrs. Answer All Questions Max Marks: 100
1. a) List the essence of Computational problem solving and Briefly explain the phases involved 2+8
in the process of Computational problem solving.
b) Who published Moore's Law? Define Moore's Law. 3
c) Write the complete code to print ten random numbers between 1 and 100. 3
d) Explain the two fundamental types of translators 4

2. a) Using Python, Implement a simple calculator for any six Arithmetic operators by taking 8
operands and operators from the user.
b) Explain the following with an example for each. 8
i. in (2
ii. ord() each)
ii. chr()
iv. range()
c) Find the error/s in the below code 4
Num=input("Enter the number) (1 each)
if Num>0
print "Positive"
elsE:
pritn "Negative"

3. a) Write the output of the following. >>> represents python prompt. 5


i) >>>[10,20] < [10,20,30]
ii) >>> a=[10,20,30]
>» b = a
>»b[1]=40
>>>a
iii) >>> colors={"r":"red","b":"blue","b":"brown"}
>>> colors["b"J
iv) >>> names={"sonu","sunny","pinky","sonu"}
>>> len(narnes)
v) >>> numbers=("hattu","rnoovattu","nalavattu",("hattu","nooru"))
>>> count("hattu")
b) Given the below list, create a new list of numbers with square of the item in the original list if 5
the number is greater than 5 and less than 20.
List1=[2,9,12,5,18,25]
c) Given the string city="I stay in Bangalore". Write the code to print city in all lowercase, all 5
uppercase, swap the character case and capitalize the first letter of every word. Also print the
length of the given string city
(Hint: Output each of these four in a separate line)
SRN
d) Given vegetables---{"beans","carrot","tom ato","cabbage","orange" } and fruits = 5
{"mango","orange","p ineapple","papaya" }
Mention the statement used for the following.
A) New set created with all elements from both the given sets
B) New set created which contains common elements in both the given sets
C) New set created with elements from the vegetables only and common elements are
ignored
D) Length of the new set in case of A, if the variable is new_set.
E) Delete the contents of vegetables.

4. a) What is recursion? Write a python program to find the sum of digits of a given number using 8
recursion.
b) Which are the two ways in which you can import modules to the current Program? Explain 6
with an example for each.
c) List any three functions which support functional programming. 3
d) Given s=[1,6,9,6,3,4] ,Write the list comprehension for the following. 3
A) Create an unconditional list with same elements as 's'
B) Create a list with only elements which are greater than 3 in the given list 's'
C) Create a list with only elements which are even in the given list 's'

5 a) Which method is used to open the file using python language? Write the code to open a file 8
myfile.txt and write 'python' and `jython' in different lines. Add the code to open this file in
read mode and print the contents of the file line by line on the terminal. Then close the
opened file without fail.
b) Briefly explain the fundamental features of Object Oriented Programming with an example 6
of class.
c) What is an exception? Which is the root of all exception types? Also list the constructs used 6
in Exception handling.

You might also like