89% found this document useful (9 votes)
4K views11 pages

Python Programming Model Questions

The document contains sample model question papers for a Python programming course. It includes questions that require writing Python functions and programs to perform tasks like calculating areas of shapes, checking if a string is a palindrome, replacing elements in a list based on certain conditions, using regular expressions to create phone numbers and email addresses, creating folders and files, and performing math operations and Fibonacci sequence generation. The questions refer to textbook chapters and code examples for guidance.

Uploaded by

thor kumar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
89% found this document useful (9 votes)
4K views11 pages

Python Programming Model Questions

The document contains sample model question papers for a Python programming course. It includes questions that require writing Python functions and programs to perform tasks like calculating areas of shapes, checking if a string is a palindrome, replacing elements in a list based on certain conditions, using regular expressions to create phone numbers and email addresses, creating folders and files, and performing math operations and Fibonacci sequence generation. The questions refer to textbook chapters and code examples for guidance.

Uploaded by

thor kumar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
  • Model Question Paper: Python Basics
  • Model Question Paper: Intermediate Python
  • Model Question Paper: Advanced Topics
  • Model Question Paper: Practical Implementations

Model Question Paper-1 with effect from 2020-21 (CBCS Scheme)

Programs of Module 1,2,3 only

Programs asked on theory questions refer text book

Q.1 (a) Write a python program to find the area of square, rectangle and circle. Print the results.
Take input from user:

Output:
2 a) What is a function? How to define a function in python? Write a program using function to
find out the given string is palindrome or not.

Output:

2 c) Write a python program to create a function called collatz() which reads as parameter named
number. If the number is even it should print and return number//2 and if the number is odd then
it should print and return 3*number+1. The function should keep calling on that number until the
function returns a value 1.
3 b) For a given list num=[45,22,14,65,97,72], write a python program to replace all the integers
divisible by 3 with “ppp” and all integers divisible by 5 with “qqq” and replace all the integers
divisible by both 3 and 5 with “pppqqq” and display the output

5 c) Write a python program to create phone number and email address by using regular expression.
Please refer text book

6 c) Write a python program to create a folder PYTHON and under the hierarchy 3 files file1,file2 and
[Link] the content in file1 as ”VTU” and in file2 as “UNIVERSITY” and file3 content should be by
opening and merge of file1 and file2. Check out the necessary condition before write file3.

Please refer text book/code shared later


Model Question Paper-1 with effect from 2018-19 (CBCS Scheme)
1 a) Explain the math operators in Python from highest to lowest Precedence with an example for each.
Write the steps how Python is evaluating the expression (5 - 1) * ((7 + 1) / (3 - 1)) and reduces it to a
single value.

PAGE No : 15 and 16 in text book

1 b) Define a Python function with suitable parameters to generate prime numbers between two integer
values. Write a Python program which accepts two integer values m and n (note: m>0, n>0 and m < n) as
inputs and pass these values to the function. Suitable error messages should be displayed if the
conditions for input values are not followed.
Output:

2 b) Define a Python function with suitable parameters to generate first N Fibonacci numbers. The first
two Fibonacci numbers are 0 and 1 and the Fibonacci sequence is defined as a function F as Fn = Fn-1 +
Fn-2. Write a Python program which accepts a value for N (where N >0) as input and pass this value to
the function. Display suitable error message if the condition for input value is not followed.
Output:
3 c) Write a Python program that accepts a sentence and find the number of words, digits, uppercase
letters and lowercase letters.

Prefer without built-in functions

// USING built in function:


Model Question Paper-1 with effect from 2020-21 (CBCS Scheme)
1 a) Write a python program to find the area of square, rectangle and circle. Print the results. Take input
from user

Refer QP 1 code

2 c) Write a function that computes and returns addition , subtraction, multiplication , division of two
integers. Take input from user.

Output:
4 a)

4 c) Write a Python program to swap cases of a given string. Input: Java Output: jAVA
7 b)

Model Question Paper-1 with effect from 2020-21 (CBCS Scheme)
Programs of Module 1,2,3 only
Programs asked on theory question
2 a) What is a function? How to define a function in python? Write a program using function to 
find out the given string is
3 b) For a given list num=[45,22,14,65,97,72], write a python program to replace all the integers
divisible by 3 with “ppp”
Please refer text book
6 c) Write a python program to create a folder PYTHON and under the hierarchy 3 files file1,file2 and
Model Question Paper-1 with effect from 2018-19 (CBCS Scheme)
1 a) Explain the math operators in Python from highest to lowes
Output:
 2 b) Define a Python function with suitable parameters to generate first N Fibonacci numbers. The first 
two Fibonac
Output:
3 c) Write a Python program that accepts a sentence and find the number of words, digits, uppercase 
letters and lowercase le
Model Question Paper-1 with effect from 2020-21 (CBCS Scheme)
1 a) Write a python program to find the area of square, rectang
4 a)
4 c) Write a Python program to swap cases of a given string. Input: Java Output: jAVA

You might also like