Python
Python
/Seat No_______________
Marks
Q.1 (a) List the advantage and disadvantage of python. 03
(b) Differentiate between List and Tuple. 04
(c) Demonstrate Membership operators and identity operators with suitable 07
examples.
Q.2 (a) What are negative indexes and why are they used? 03
(b) Write a python program to check if a string is palindrome or not. 04
(c) Write a Python program to generate pyramid pattern as given below. 07
*
**
***
****
OR
(c) Explain while loop in python. How to create infinite while loop? How to 07
break infinite while loop in certain condition? Explain with example.
Q.3 (a) Write a Python function to sum all the numbers in a list. 03
(b) Discuss global, local and nonlocal variable in detail. 04
(c) Develop python program to find maximum, minimum and average of 07
given numbers using user define function.
OR
Q.3 (a) What is a function? Mention the type of function and use. 03
(b) Describe with example: Module in python 04
(c) Write a python function to convert string into upper case and find length 07
of string. String will be passed to function.
Q.5 (a) What is micro python? Discuss unique features of micro python. 03
(b) List different features available in Node MCU 8266 controller. 04
1
(c) Write MicroPython program to read proximity sensor connected at Pin1, 07
blink the LED if sensing is detected.
OR
Q.5 (a) Enlist various IDE available to carry out programing in MicroPython. 03
(b) Describe merits and demerits of Micropython over python. 04
(c) Develop program in Micropython to send digital data on GPIO pin of 07
Micropython supported board and blink LED connected to it.
***************
2
Seat No.: ________ Enrolment No.___________
1
OR
Q.4 (a) Define SCOPE, Discuss global and local variable in 03
detail.
(b) Define Lambda function, Utilize lambda function in an 04
example.
(c) Develop python program to find maximum, minimum 07
and average of given numbers using user define function.
*************
2
Seat No.: ________ Enrolment No.___________
MARKS
Q.1 (a) Describe membership operator and identity operator with 03
example.
(b) Write Python program to find sum of first N numbers using while 04
loop. (Take N as user input)
(c) Differentiate List, Tuple, Set and Dictionary. 07
Q.3 (a) Describe python tuple with example. Describe any two built-in 03
tuple methods
(b) Describe filter method/function available in python with example. 04
(c) Write a python program to read marks of students from 07
“student_marks.csv”. Find average, maximum, and minimum
marks from data. (File contains 100 records)
OR
Q.3 (a) Describe different methods to make dictionary variable. 03
(b) Enlist different modes of opening file. Describe any three method 04
with example
(c) Write a program to print 100 fibonacci numbers in file 07
“Myfibonnaci.csv”
1
(c) Write following python functions: 07
Function-1: Returns reverse string word wise.
Function-2: Count occurrence of vowels from input string.
Design Main python code where above functions are called.
OR
Q.4 (a) Enlist python operators which results in Boolean output. Explain 03
with example.
(b) Enlist python errors. Describe try-except block with example. 04
(c) Write a python program to find roots of following quadratic 07
equation and plot it.
y = 3x2 -5x - 4
in the range of -5 to 5 on plot. Put axes label and plot title.
*************
2
Seat No.: ________ Enrolment No.___________
MARKS
Q.1 (a) What are key features of python? 03
(b) Differentiate between compiler and interpreter. How is the 04
python an interpreted language?
(c) What is the difference between list and tuple in python? 07
Explain with suitable example.
Q.2 (a) What are local variable and global variable in python? 03
(b) Explain dictionary in python with the help of example. 04
(c) What are common built-in data types in python? 07
OR
(c) What is type conversion in python? Explain with the help 07
of suitable example.
Q.3 (a) Discuss the following function of List in python. 03
a) append( )
b) count( )
c) reverse( )
(b) Explain the use of break, continue and pass statement in 04
python.
(c) Explain Logical Operator and bitwise operator in python. 07
OR
Q.3 (a) Write the output of the following code. 03
txt = "Python Programming"
x = txt.casefold()
print(x)
y = txt.count("P")
print(y)
x = txt.split()
print(x)
(b) Write a python program to check if given string is 04
palindrome or not.
(c) Explain arithmetic operator and assignment operator in 07
python.
Q.4 (a) Write a Python function to sum all the numbers in a list. 03
(b) Explain nested if else statement in python 04
(c) Explain the different methods available for manipulating 07
the CSV files in python.
OR
Q.4 (a) Explain the structure of while loop in python. 03
(b) What is meant by module in python. List some of the built 04
in module and built in functions of python.
1
(c) Write a function in python to count the number of lines 07
from a text file "sample.txt" which is not starting with an
alphabet "T". If the file "sample.txt" contains the
following lines: What will be the output?
*************
2
Seat No.: ________ Enrolment No.___________
Q.2 (a) Explain the structure of for loop in python with suitable example. 03
(b) Write a short note on: Bitwise operators in python. 04
(c) Write a python program to print all the prime numbers between 100 07
to 200.
OR
(c) Write a Python program to generate pyramid pattern as given 07
below.
*
* *
* * *
* * * *
Q.3 (a) What are the advantage of choosing mnemonics variable name in 03
python?
(b) What is different type of error in python? Explain in brief. 04
(c) Explain various type conversion function in python 07
OR
Q.3 (a) Explain modulo operator in python with the help of suitable 03
example.
(b) Explain the use of following built in function in python. max(), 04
pow(), str(), input()
(c) Explain different mode for opening a file in python. 07
1
OR
Q.4 (a) What is the output of following code snippet? 03
def fred():
print("Zap")
def jane():
print("ABC")
jane()
fred()
jane()
(b) What is the purpose of “def” keyword in python? 04
(c) Explain the conversion of list to dictionary in python. 07
************
2
Seat No.: ________ Enrolment No.___________
MARKS
Q.1 (a) Explain how string is converted into list? Convert String S = “GTU 03
Supports Innovation” into list.
(b) How list is different from tuple? Write advantages of tuple. 04
(c) Describe Arithmetic Operators, Assignment Operators and Bitwise 07
Operators in detail with examples
Q.2 (a) Explain for loop in python. Display even numbers from 0 to 100 using 03
for loop
(b) Explain while loop in python. How to create infinite while loop? How 04
to break infinite while loop in certain condition? Explain with example.
(c) Explain nested if statements in Python with logical combinations. 07
Write program to get temperature and humidity from the user. Display
following messages in different situations:
(1) If temperature>30 and humidity<20% Message: “Hot and Dry”
(2) If temperature is in between 20 to 30 and Humidity between 20%
to 40% Message: “Good weather condition”
(3) If temperature is between 20 to 30 and Humidity more than 80%
Message: “Moisture present”
OR
(c) Write Python program that accepts a sentence and calculate the number 07
of words, digits, uppercase letters and lowercase letters
Q.4 (a) Write Python code to check if a given year is a leap year or not ? 03
1
(b) Write a Python Program to input information for 5 number of students 04
as given below:
a. Name
b. Registration Number
c. Total Marks
(c) Write Python Program to Prompt for a Marks in the range 07
of 0 to 100. If the entered mark is out of range, it should print an error.
If the entered marks is between 0 and 100, print a grade using following
information:
Marks ≥ 70 Grade A
60≤Marks<70 Grade B
50 ≤ Marks <60 Grade C
40 ≤ Marks <50 Grade D
Marks<40 Grade FF
OR
Q.4 (a) Explain file exception handling. What are the reasons for file 03
exceptions?
(b) Write Python Program to count the number of times an item appears in 04
the list.
(c) Given a point(x,y), Write Python Program to find whether this point 07
lies in the First, Second, Third or Fourth Quadrant of X - Y Plane. Print
message of corresponding quadrant.
Q.5 (a) List Integrated development environment (IDE) used for Micropython 03
programming
(b) Write Micropython program to send digital data 0 to pin no. 4 and 04
digital data 1 to pin no. 2 of NodeMCU board.
(c) Write a Python program to check the validity of a password entered by 07
the user. Provide prompt to the use to enter the password.
The Password should satisfy the following criteria:
1. Contain at least 1 letter between a and z
2. Contain at least 1 number between 0 and 9
3. Contain at least 1 letter between A and Z
4. Minimum length of password: 6
If password satisfies all above condition, print message “Valid
password” else print message “Invalid password”.
OR
Q.5 (a) Explain difference between Python and Micropython. 03
(b) What is the necessity of file operations? Explain different mode of file 04
opening. Which mode is preferred if
(c) Write Micropython program to read sensor data from pin A0 of 07
NodeMCU board. Glow LED connected at pin number 4 of NodeMCU
if sensor data is greater than 500.
*************
2
Seat No.: ________ Enrolment No.___________
Marks
Q.1 (a) Define Python? List the important features of python. 03
(b) What is tuple ? What is the difference between list and tuple? 04
(c) Write short note on different types of operators in python with appropriate 07
example.
Q.2 (a) What is a function? Mention the type of function and use. 03
(b) What is len function and explain how it is used on strings with an example. 04
(c) What is Data Type? Explain various data types used in Python. 07
OR
(c) Write a python program to check if a string is palindrome or not. 07
Q.3 (a) What is the use of str.upper() and str.lower() functions in string? 03
(b) What are Python's dictionaries? Explain how to create a dictionary in python? 04
(c) Explain following List methods in python with appropriate example. 07
a) append() b) insert() c) remove() d) clear() e) reverse()
OR
Q.3 (a) What is meant by module in python? . List some built in modules in python. 03
(b) Explain break and continue statement in python? 04
(c) What is an exception? Explain about the different types of Exceptions in 07
Python.
Q.4 (a) Explain string comparison with an example. 03
(b) Which method is used to read the contents of a file which is already created? 04
(c) Write a program to enter a number in Python and print its octal and hexadecimal 07
equivalent
OR
Q.4 (a) What are negative indexes and why are they used? 03
(b) What is the difference between = = and is operator in Python? 04
(c) Write a python program to find the factorial of any number. 07
Q.5 (a) Write the syntax and usage of WHILE and FOR loop. 03
(b) Give difference between Micro Python and Python. 04
(c) Explain all file processing modes supported in Python. 07
OR
Q.5 (a) What is micro python? Discuss unique features of micro python. 03
(b) How does del operation work on dictionaries? Give an example. 04
(c) Write program in MicroPython to send digital data on GPIO pins of NodeMCU 07
and glow LED connected with NodeMCU or any other MicroPython supported
board.
1
Seat No.: ________ Enrolment No.___________
1
(2) cosine wave
(3) y = x2 + 2x + 1
range of -5 to 5 on (A) separate plot (B) same plot.
Put axes label and plot title for both plots.
*************
2
Seat No.: ________ Enrolment No.___________
Q.2 (a) What is The Structure and Behavior of a “while Loop” explain with example. 03
(b) Write a program that accepts the lengths of three sides of a triangle as inputs. The 04
program output should indicate whether or not the triangle is a right triangle.
(c) Write a python script to Convert Decimal number to Binary number 07
Q.3 (a) Discuss Boolean Functions with examples. 03
(b) Define a function named even. This function expects a number as an argument and 04
returns True if the number is divisible by 2, or it returns False otherwise.
(c) Write a Python function to calculate the factorial of a number (a non- 07
negative integer). The function accepts the number as an argument
Q.6 (a) How to read CSV file in python explain with example. 03
(b) Discus the steps of Installation of MicroPython on Hardware 04
(c) Write a python program to find the longest words in a read file. 07