0% found this document useful (0 votes)
43 views2 pages

Ctup Mock Test II

This document contains a mock test for the subject "Computational Thinking Using Python". It has 3 parts - Part A contains 10 multiple choice questions worth 2 marks each, Part B contains 5 questions worth 13 marks each, and Part C contains 1 question worth 15 marks. The questions cover topics like Python programs to calculate salary, check if points are collinear, find vowels/constants in a string, file handling, modules, functions, dictionaries and more. Students need to answer all questions to attempt the mock test.

Uploaded by

Mohamed Aslam M
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)
43 views2 pages

Ctup Mock Test II

This document contains a mock test for the subject "Computational Thinking Using Python". It has 3 parts - Part A contains 10 multiple choice questions worth 2 marks each, Part B contains 5 questions worth 13 marks each, and Part C contains 1 question worth 15 marks. The questions cover topics like Python programs to calculate salary, check if points are collinear, find vowels/constants in a string, file handling, modules, functions, dictionaries and more. Students need to answer all questions to attempt the mock test.

Uploaded by

Mohamed Aslam M
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

QP CODE: 263810

Register Number

K. RAMAKRISHNAN COLLEGE OF TECHNOLOGY


(An Autonomous Institution)
Samayapuram, Trichy – 621 112

DEPARTMENT OF CSE
MOCK TEST-II
SUBJECT CODE: 20GE2102 SUBJECT NAME:COMPUTATIONAL THINKING USING PYTHON

Answer All Questions


PART-A (10*2=20) Marks

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.

ii) How the string is converted to list? Give example.


Or
12 B) Write a python Program to check how many vowels, constants, digits, special 13
characters and whitespaces present in the string of “Tara’s mark is 80% in
Python!”
ii) Write a python program to check whether the string is anagrams.
13 A) Check whether the list is empty or not. Get the input from the user for 2 13
student’s record as name, address, rollno, mark and store it in different list.
The two students mark should be same. Find the duplicate element in a list
and display it.
Or
13 B) What is Dictionary? Do the following operations. 13
i. Initialize two dictionaries with key value pairs
ii. Compare two the dictionaries with master key list and find the missing
key
iii. Find the keys that are in first and not in second dictionary.
iv. Find the same key in two dictionaries.
v. Merge the two dictionaries and Create a new dictionary using a single
expression
vi. State the difference between set and dictionaries in python.
14 A) Explain modules in python and how will you import them? Explain them by 13
creating and importing the modules in python
Or
14 B) Discuss function prototype. Explain the pros and cons of functions. 13

15 A) Explain the sequential and random access file with example. 13


Or
15 B) Explain the modes of files and types of Errors in python. 13

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.

You might also like