SRN
PES University, Bencialuru
PES (Established under Karnataka Act No. 16 of 2013) UE15CS101
UNIVERSITY
DECEMBER 2015: END SEMESTER ASSESSMENT B. TECH. I SEMESTER
UE15CS101 - Introduction to Computing using Python
Time: 180 Mins Answer All Questions Max Marks: 100
a Convert the following to base 10. Show all the steps.
4
i. (AA)12
ii. (HA)23
b What is in common within each of the following groups of binary numbers?
i. values that end with a "0" digit (e.g., 1100).
ii. values that end with a "1" digit (e.g., 1100). 4
iii. values with a leftmost digit of "1," followed by all "Os" (e.g., 1000).
1 iv. (d) values consisting only of all "1" digits (e.g., 1111).
c Write a Python program that allows the user to enter any integer base and integer exponent,
and displays the value of the base raised to that exponent. Your program should function as
shown below as an example. 4
What base? 10
What power of 10? 4
10 to the power of 4 is 10000
nce between a compiler and nterpreter Is python program compiled or
8
interpreted or. both?
‘11111111111111111111111MW
Write a python Program to interchange the values of variables of a & b without using the third
variable. Your program should function as shown below as an example.
a=50
b=500
Before Interchange 4
a= 50
b= 500
After Interchange
a= 500
b= 50
Evaluate the following expressions in Python
i. print("Hello")+"PES"
ii. 10+20**2/(10**2)+12+3**3*10 4
Give a logically equivalent expression for each of the following.
i. num I= 25 or num == 0
ii. 1 <= num and num <= 50 4
iii. not num > 100 and not num < 0
iv. (num < 0 or num > 100)
SRN
Give an appropriate if statement for each of the following.
i. An if statement that displays 'PESU' if X is between 0 and 100, inclusive.
d ii. An if statement that displays 'ICUP' if X is between 0 and 100, inclusive, and displays 8
'15CS101' otherwise.
iii. An if statement that displays 'PESU' if X is between 100 and 1000 inclusive and x is an
odd number.
iv. An if statement that displays 'ICUP' if X is between 300 and 100 inclusive and x is an
even number.
a) For 1st = [4, 2, 9, 1], what is the result of each of the following list operations?
i. Ist[1]
ii. Istinsert(2, 3) 4
iii. del Ist[3]
iv. [Link](3)
b) Which of the following are valid operations on tuples (for tuples t1 and t2)? Explain your
options.
i. len(t1) 4
ii. t1 + t2
iii. [Link](t2)
iv. [Link](t2)
For the following information of the type <username, password>
3 <"PESU","t-12345">, <"[Link]","t-100">, <"lcup","Subject">, <"Year","First">
Create a relevant dictionary named Password using the above given information. Write a
relevant python segment of code accepting user name and password, check if the entered is
relevant for the given existing username. Your program should function as shown below as an
c 8
example.
Sample Input -1
User name = Icup
password = N
Password Incorrect
Sample Input -2
User name = Icup
password = Subject
Password Correct
With a typical example explain the following string applicable sequence operations in python.
i. Slice
d ii. Membership 4