0% found this document useful (0 votes)
18 views3 pages

Model2 PYTHON Key

This document outlines the model exam for the Problem Solving and Python Programming course at SRI RAAJA RAAJAN COLLEGE OF ENGINEERING & TECHNOLOGY, scheduled for January 2025. It includes a variety of questions covering topics such as iterative statements, algorithms, Python modules, exception handling, and file handling. The exam consists of two parts: Part A with short answer questions and Part B with detailed questions requiring explanations and examples.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views3 pages

Model2 PYTHON Key

This document outlines the model exam for the Problem Solving and Python Programming course at SRI RAAJA RAAJAN COLLEGE OF ENGINEERING & TECHNOLOGY, scheduled for January 2025. It includes a variety of questions covering topics such as iterative statements, algorithms, Python modules, exception handling, and file handling. The exam consists of two parts: Part A with short answer questions and Part B with detailed questions requiring explanations and examples.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

SRI RAAJA RAAJAN COLLEGE OF ENGINEERING & TECHNOLOGY

Amaravathiputhur Post, Karaikudi Tk


Accredited by NAAC with B+ Grade
MODEL EXAM 2 – JANUARY 2025

Reg. Date : 5.1.25


o: Yr/Sem/SECTION: I/I/E
Session : AN

GE3151 PROBLEM SOLVING AND PYTHON PROGRAMMING 50 Marks

ANSWER ALL QUESTIONS


PART A (10*2 = 20MARKS)
1. Define an iterative statement (AU.,JAN2022) C105.1 BTL1
i) The iterative is a technique that repeats a set of
statements based upon a condition.
ii) If a condition evaluates to true, the set of statements is
executed again and again.
iii) As soon as the condition becomes false, the repetition
stops. This is also known as looping statement or
iterative statement.
2. Write an algorithm to find the smallest among three numbers. (AU.,A/M2022) C105.1 BTL1
Step1 : start
Step2: read the three numbers A,B,C
Step3: Compare A & B. if A is the smallest perform step4 else
perform step5
Step4: Compare A & C. if A is the smallest ,output “A is the
smallest” else output “ C is the smallest”
Step5: Compare B & C. if B is the smallest ,output “B is the
smallest” else output “ C is the smallest”

3. Write an algorithm to find the sum of first ‘N ‘ natural numbers (AU.,DEC2022) C105.1 BTL1
1. Start
2. Assign sum=0 and i=0
3. Read the number , n
4. Repeat steps 5 to 6 until i=n reached
5. Compute sum=sum+i
6. Compute i=i+1
7. Print sum
8. Stop

4. Let list=[‘a’,’b’,’c’,’d’,’e’,’f’].find the following. (AU.,N/D2022) C105.5 BTL1


a) List[1:3]
b) List[:4]
c) List[3:]
5. Define relative path and absolute path with respect to files. (AU.,N/D2022) C105.2 BTL1
A relative path describes the location of a file relative to the current
directory. An absolute path describes the location from the root
directory.
6. What are the different modules in python?. (AU.,A/M2023) C105.2 BTL1
Modules in python can be
i) Built in modules
ii) User defined modules
Example : “os”, “sys”. “datetime”, “random”
7. How exceptions are handled in python? (AU.,N/D2022) C105.2 BTL1
 The try and except block is used to catch and handle
exceptions.
 When an exception occurs , it is raised or thrown by the
python interpreter.
8. How python dictionaries store data? Give example (AU,A/M2022) C105.2 BTL1

Dictionaries in python is an ordered collection of data values, used to store data values like a map. Unlike other

data type dictionary holds key:value pair.

Eg: dict={1:’python’, 2:’for’, 3:’Everyday’}

9. How do you use command line arguments to give input to the program?

(AU,A/M2023) C105.5 BTL1

Python provides a getopt module that helps to parse command line option and arguments.

$python test.py arg1 arg2 arg3

10. What is range function and how it is used in the list ? (AU,A/D2024) C105.2 BTL1

The range() function generates a list of numbers. This is very useful when creating new lists

or when using for loops: it can be used for both.

Eg:
x = list(range(1,101))
print(x)

PART B – (5*16 = 80 Marks) (Any FIVE)

11. i) Draw a flow chart to accept three distinct numbers , find (AU,N/D2022) C105.2 BTL2
the greatest and print the result (8)
ii) Draw a flowchart to find the sum of the series. 1+2+3+…..
+100(8)

12. i) What is meant by recursion? Write a recursive algorithm to (AU,N/D2022) C105.3 BTL2
solve towers of Hanoi problem (8)
ii) Explain in detail about precedence of python operators
and the associativity of python operators.(8)
13. i) Discuss about scope and lifetime of variables considering (AU,N/D2022) C105.2 BTL3
functions.(8)
ii) Write and explain the python program to swap two
numbers with and without temporary variables.(8)
14. i) Explain bubble sort algorithm using python (AU,N/D2023) C105.2 BTL4
programming(8)
ii) What is string function in python? Explain any 3 python
string methods with an example.(6)
15. i) Explain in deatil about lists, list operations and list slices(8)
(AU,A/M2023) C105.2 BTL3
ii)Demonstrate with python code the various operations that can be performed on tuples(8)

16. i) Why does python require file handling?Explain opening & closing file in python with all modes.
(AU,N/D2023) C105.3 BTL4

ii) Give a brief note on python exception handling using try, except, raise and finally statements.(8)

Prepared by: Mrs.D.Sujatha, HoD/AI&DS Approved by:

You might also like