Python Unit-1 Previous Questions

SEMESTER END EXAMINATIONS – JUNE 2024

Describe logical operators and relational operators in python with suitable examples.

Write a python script to demonstrate if..elif...else statement in python.

Demonstrate the usage of pass, break and continue statement in python using suitable examples.


Describe membership operator and identity operator in python with suitable examples.

Give the syntax of range() function and discuss its importance. Write a python script to demonstrate for loop statement with range() function.

Demonstrate the usage of while statement in python. Write a python script to demonstrate while concept to add 5 numbers.


BACKLOG SUBJECT EXAMINATIONS – SEPTEMBER / OCTOBER 2023

Illustrate conditions and looping statements in python with suitable examples.

Develop a Python program to find roots of a quadratic equation with necessary validation.

Develop a python program to sum the digits of a given number.


SEMESTER END EXAMINATIONS – MAY / JUNE 2023

Describe Arithmetic Operators, Assignment Operators, and Comparison Operators with example.

Write a program to display only those numbers from a list that satisfy the following conditions

  • The number must be divisible by five.
  • If the number is greater than 100, then skip it and move to the next number.
  • If the number is greater than 600, then stop the loop.

Write a program to count the total number of digits and sum of digits in a number using a while loop.

What are identical objects and equivalent objects? Give examples.


SUPPLEMENTARY SEMESTER EXAMINATIONS – SEPTEMBER 2022

Explain the usage of chr() and ord() functions. Develop a script to read a string and convert all uppercase letters to lowercase and vice versa using chr() and ord() functions.


Develop a python program that takes two positive integers m and n, and then produces a box of mXn dimension as shown below. Enter height: 4 Enter width: 5

*****
*    *
*    *
*    *
*    *
*****

Write a program using a while loop that asks the user for a number, and prints a countdown from that number to zero.


SUPPLEMENTARY SEMESTER EXAMINATIONS - NOVEMBER 2022

Explain the significance of break, continue and pass with suitable example.

Develop a python program that reads two integer values n and m from the user, then produces a box that is n wide and m deep, such as the following: Enter a width: 5 Enter a height: 4


@@@@@
@    @
@    @
@@@@@

Illustrate the different types of iterative statements available in Python.


SEMESTER END EXAMINATIONS – JUNE 2022

List the operators supported in Python? Describe specifically about identity and membership operator with a suitable example?

Demonstrate the usage of pass, continue and break with the help of appropriate example.


EXAMINATIONS SEPTEMBER /OCTOBER 2021 SUPPLEMENTARY

Develop a python program to print unique elements in a list.


EXAMINATIONS SEPTEMBER /OCTOBER 2021 SUPPLEMENTARY

Develop a program to print the sum of n natural numbers.

Demonstrate the usage of pass, continue and break with the help of appropriate examples.


EXAMINATIONS SEPTEMBER /OCTOBER 2020 SUPPLEMENTARY

Describe Arithmetic Operators, Assignment Operators, Comparison Operators, Logical Operators and Bitwise Operators in detail with examples.


Implement a Python Program to reverse a number and also find the number of digits and Sum of digits in the reversed number. Prompt the user for input.

Illustrate break, continue and pass statements in Python.


SEMESTER END EXAMINATIONS – JUNE 2019

Describe the purpose and usage of Break, Continue and Pass in Python.


SUPPLEMENTARY SEMESTER EXAMINATIONS – JULY 2019

Design a program to print the mid number (which is between min and max) out of three input numbers

How do you terminate a loop? Write a Python program to count the palindrome words in a line of text.

What are identical objects and equivalent objects? Give examples.


Use the for loop and give example for: i) Processing characters in Strings ii) Displaying values and keys of a dictionary iii) Looping over List of Lists.


MAKEUP EXAMINATIONS – JULY 2019

Develop a python program to find the sum of even numbers and odd numbers in the given list.


Design a simple calculator with different mathematical operations using python script.


SEMESTER END EXAMINATIONS – MAY/JUNE 2018

Design a Python program to find the average of best two test scores out of three test scores taken as input.

In what situations, break and continue statements were used? Discuss with examples.

Use the for loop and give example for: i) Processing characters in Strings ii) Displaying values and keys of a dictionary iii) Looping over List of Lists.


SUPPLEMENTARY SEMESTER EXAMINATIONS – JULY/AUGUST 2018

Using for loop, print of table of Celsius/Fahrenheit equivalences. Let c be the Celsius temperatures, ranging from 0 to 100. For each value of c, print the corresponding Fahrenheit temperature.


Examine each of the following expressions. Predict what the result would be? Explain what the type is for each expression. If an expression is illegal, explain why?

i. 10 / 5
ii. 5 / 10
iii. 5.0 / 10
iv. 10 % 4 + 8 / 4
v. 3 ** 10 / 3.

Explain what ord() and chr() function is used for. Using the same, Write a function that takes a string input and converts all uppercase letters to lowercase and vise versa.

Sample input: I love PyTHon
Sample output: i LOVE pYthON.

SEMESTER END EXAMINATIONS – MAY/JUNE 2017

What is the output of the following code segments? Explain the causes.

i) 
for letter in 'Python':
	if letter == 'h':
		break
	print 'Current Letter :', letter

ii) 
for letter in'Python':
	if letter =='h':
		continue
	print'Current Letter :', letter

iii) 
for letter in'Python':
	if letter =='h':
		pass
		print'This is pass block'
	print'Current Letter :', letter

SUPPLEMENTARY SEMESTER EXAMINATIONS – AUGUST 2017

When you use the + operator to concatenate two lists, does it make a copy or a reference of the arguments? Explain with the help of an example.

Develop a Python program that will accept, as input, a series of names and salaries. Use the name ‘End’ to mark the end of the sequence of values. After the values have been entered, print the average salary and the names and salaries of those individuals with the highest and lowest salaries.


Develop a python program that takes two positive integers m and n, and then produces a box of mXn dimension as shown below. Enter height: 4 Enter width: 5

*****
*    *
*    *
*****

Develop a script to read n values into a list. Separate the numbers in the list into two new lists, first contains all prime numbers and second contains all non-prime numbers.