Ctup Mock Test II
Ctup Mock Test II
Register Number
DEPARTMENT OF CSE
MOCK TEST-II
SUBJECT CODE: 20GE2102 SUBJECT NAME:COMPUTATIONAL THINKING USING PYTHON
1. Muth’s basic salary is input through the keyboard. His dearness allowance is
35% of basic salary, and house rent allowance is 20% of basic salary. Write a
python program to calculate his gross salary.
2
2. Compare interpreter and compiler. What types of translator is used for python? 2
3. write a python program to find the position of ” is” in “this is my program” 2
4. String is mutable or immutable. Justify with example. 2
5. Define tuple. What is the difference between list and tuple? 2
6. Write a python program to display a set of strings using range() functions. 2
7. Can functions return tuple? If yes give example. 2
8. Whether the integer function return the value or not. List the advantage of
function. 2
9. How modules and packages related to each other? 2
10. Which method is used to read the contents of a file which is already created
and How to read a multiple lines in a file?. 2
PART-B (5*13=65)
11 A) Given three points (x1, y1), (x2, y2) and (x3, y3), write a python program to 13
check if all the three points fall on one straight line.
Or
11 B) A certain grade of steel is graded according to the following conditions: 13
(i) Hardness must be greater than 50
(ii) Carbon content must be less than 0.7
(iii) Tensile strength must be greater than 5600
The grades are as follows:
Grade is 10 if all three conditions are met
Grade is 9 if conditions (i) and (ii) are met
Grade is 8 if conditions (ii) and (iii) are met
Grade is 7 if conditions (i) and (iii) are met
Grade is 6 if only one condition is met
Grade is 5 if none of the conditions are met
Write a python program, which will require the user to give values of
hardness, carbon content and tensile strength of the steel under consideration
and output the grade of the steel.
12 A) Write a program that takes a string as an argument and displays the letters 13
backward, one per line.
For example: In Robert McCloskey’s book Make Way for Ducklings, the
QP CODE: 263810
names of the ducklings are Back, Cack, Dack, Eack, Fack, Quack, Pack, and
Quack. Consider the string as “BCDEFOPQ”. For each character in a string it
should added backward as “ack”. In this example “Ouack” and “Quack” “u”
should be replaced and it should print as Oack and Qack.
PART-C (1*15=15)
16 A) What are the basic list operations that can be performed in Python? Explain 15
each operation with its syntax and example.
Or
16 B) i) Explain about exception handling mechanism in python and its 15
types with example.
ii) How to merge multiple file into a new file using python.