Python QP
Python QP
Module – 1 M L C
Q.1 a. List and explain math operators used in Python with example. 7 L2 CO1
b. Write a Python program to check whether the number is even or odd. 6 L3 CO1
OR
Q.2 a. With an example explain the following built-in functions : 6 L1 CO1
i) print( )
ii) input( )
iii) len( ).
c. Write a program to print even numbers using step size in range( ). 6 L3 CO1
Module – 2
Q.3 a. Explain the following list methods with examples. 10 L2 CO2
index( ),
append( ),
insert( ) ,
sort( ),
reverse( ).
OR
Q.4 a. Show that lists are mutable. 6 L1 CO2
1 of 2
BPLCKB105/BPLCK105B
Module – 3
Q.5 a. Write the output of following Python code >>>Spam = ‘Hello, World!’ 6 L1 CO3
i) >>>Spam[0] ii) >>Spam[4] iii) >>>Spam[–1]
iv) Spam[0 : 5] v) >>> Spam [:5] vi) >>>Spam[7 :].
b. Write a program to accept string and display total number of alphabets. 6 L3 CO3
OR
Q.6 a. Explain the following string methods with examples : 10 L1 CO3
i) isalpha( ) ii) isalnum( ) iii) isdcimal( ) iv) isspace( ) v) istitle( ).
b. Write a Python program that repeatedly asks users for their age and a 6 L3 CO3
Password until they provide valid input. [age is in digit and Password in
alphabet an digit only].
c. Differentiate between Absolute and relative paths in specifying file paths. 4 L2 CO3
Module – 4
Q.7 a. Show that files and folders can be copied using Shutil module. 8 L1 CO4
OR
Q.8 a. Describe logging levels used in Python to categorize log messages by 10 L2 CO4
importance.
b. With example show how files and folders can be permanently deleted. 10 L1 CO4
Module – 5
Q.9 a. Write a program to implement the following object diagram and its 10 L3 CO4
functionality as shown in Fig.9(a). Initialize the attributes through a
constructor and print the same.
Fig.Q9(a)
b. Discuss operator overloading. Mention any five operators with respective 10 L2 CO4
special functions to be overloaded in Python.
OR
Q.10 a. Explain the following with an example : 8 L2 CO4
i) isinstance( ) ii) hasattr( ) iii) [Link] iv) copy. deepcopy( ).
Module – 1 M L C
Q.1 a. List and explain the use of comparison operator in python. Write the step by 6 L1 CO1
step execution of the following expression in python.
3/2 * 4 + 3 + (10/4)**3 – 2
b. Explain the control statements, if, else, elif with proper syntax and 6 L2 CO1
examples.
OR
Q.2 a. Explain the string concatenation and string replication operator with an 6 L2 CO1
example.
b. Explain local and global scope of variable with suitable example. 6 L2 CO1
c. Develop a program to read the student details Like Name, USN and Marks 8 L3 CO1
in three subjects. Display the student details, total marks and percentage
with suitable messages.
Module – 2
Q.3 a. What is list? Explain the concept of list indexing and slicing with examples. 6 L2 CO2
b. With suitable examples, explain the list methods append( ), extend( ), 8 L2 CO2
sort( ), count( ) and pop( ).
c. Read N numbers from the console and create a list. Develop a program to 6 L3 CO2
print mean, variance and standard deviation with suitable message.
OR
Q.4 a. Define tuple data type? List out the difference between tuple and list. 6 L2 CO2
b. Identify and explain the dictionary methods like get( ), item( ), keys( ) and 8 L2 CO2
values ( ) in python with examples.
1 of 2
BPLCK105B/BPLCKB105
Module – 3
Q.5 a. Write the output of the following : 6 L2 CO3
i) ‘HeLLo’ upper( ) isupper ( )
ii) ‘HeLLo’ upper( ) lower( )
iii) ‘__’ Join(‘There can be only one’ split( ) )
c. Develop a python program to count the total number of vowels, consonants 8 L3 CO3
in a string.
OR
Q.6 a. Make use of the concept of file handling and explain Reading and writing 7 L2 CO3
process with suitable python programs.
b. Explain the concept of file path, also discuss absolute and relative paths. 7 L2 CO3
b. List out the benefits of compressing file with zip file module, also explain 8 L2 CO3
the concepts of walking a directory tree.
b. Develop a python program with a function named DivExP which takes two 8 L3 CO3
parameters a, b and returns a value C. (C = a/b). Write suitable assertion for
a > 0 in function DivExP and raise on exception for when b = 0. Program
has to read two values from the console and call a function DivExP.
Note: 1. Answer any FIVE full questions, choosing ONE full question from each module.
2. M : Marks , L: Bloom’s level , C: Course outcomes.
Module – 1 M L C
Q.1 a. Define comparison operator and list its type. Give the difference 4 L1 CO1
between = = and = operator.
b. Explain flow control statement in detail with if, else, whileloop and forloop. 10 L2 CO1
OR
Q.2 a. Define exception in python programming and give the basic form of an 8 L1 CO1
exception handling block with an example.
b. Explain how to define function and to make a function call by passing an 4 L2 CO1
argument with an example.
c. Develop a python program to read the name and year of birth of a person 8 L3 CO1
and to display whether the person is a senior citizen or not.
Module – 2
Q.3 a. Explain in detail about append( ) and index( ) function with respect to list in 6 L2 CO2
python.
b. Develop suitable python program with nested list to explain copy( ) and 6 L3 CO2
deepcopy( ) methods.
OR
Q.4 a. Explain the below methods in list with suitable code : 6 L2 CO2
i) remove( ) ii) sor( ) iii) reverse( ).
1 of 2
BPLCK105B/BPLCKB105
Module – 3
Q.5 a. Develop a code to print to most frequently appearing words in a text file. 10 L3 CO3
OR
Q.6 a. Explain the method to restore the data to variable from the hard drive. 10 L2 CO3
b. Develop a program to sort the contents of a tent file and write the sorted 10 L3 CO3
content into a separate text file.
Module – 4
Q.7 a. Explain various shell utilities function. 10 L2 CO3
b. Develop a program to read and to extract all the files and folder into a ZIP 10 L3 CO3
file by using relevant methods.
OR
Q.8 a. Explain permanent delete and safe delete with a suitable python 10 L2 CO3
programming.
b. Define Assertion. Explain the use of Assertion in a Traffic light simulation 10 L2 CO3
with a python program.
Module – 5
Q.9 a. Define pure function and modifier. Explain the role of pure function and 10 L2 CO3
modifier in application development.
OR
Q.10 a. Define operator overloading. Explain with suitable python program. 10 L2 CO4
*****
2 of 2
USN BPLCK105B/BPLCKB105
Module – 1 M L C
Q.1 a. Explain the following functions with examples: 10 L2 CO1
i) input ii) print iii) len iv) str v) int
b. Explain if and elif control statements with syntax and flowchart. 5 L2 CO1
c. Write a program to read name and year of birth of a person. Display 5 L3 CO1
whether the person is a senior citizen or not.
OR
Q.2 a. Explain the following with example: 8 L3 CO1
i) Def Statements with Parameters
ii) Parameters and Return Values
Module – 2
Q.3 a. Define list. Explain append( ), index( ), sort( ) and insert( ) list methods 10 L3 CO2
with example.
b. Read 10 numbers from a console and create a list. Develop a program to 6 L3 CO2
print the elements of created list, sorted list and reversed list.
OR
Q.4 a. Define dictionary. Explain the following methods of dictionary 10 L2 CO2
i) setdefault ii) get iii) keys iv) items
Module – 3
Q.5 a. Explain how individual elements of a string are accessed. How to extract a 10 L3 CO3
part of a string? Explain with examples.
1 of 2
BPLCK105B/BPLCKB105
OR
Q.6 a. Explain any 5 methods in [Link] module related to files. 10 L2 CO3
Module – 4
Q.7 a. Write a program to display folder name, list of subfolders, and files in the 5 L3 CO3
working directory using [Link]( ).
OR
Q.8 a. What is an assertion? Explain how to use assert keyword with an example. 7 L3 CO3
c. Demonstrate reading and extracting from zip files using zipfile module. 6 L3 CO3
Module – 5
Q.9 a. Explain _ _ init_ _, _ _str_ _, _ _add _ _ methods with example. 12 L3 CO4
OR
Q.10 a. Define classes and objects. Write a program to create a class called student 12 L3 CO4
with attributes name, usn, sem, sec and create two student objects. Read
and print the details of two students using appropriate methods.
*****
2 of 2
USN BPLCK105B/BPLCKB105
Module – 1 M L C
Q.1 a. What is the need for role of precedence? Illustrate the rules of precedence 6 L2 CO1
in Python with example.
b. Explain the local and global scope with suitable examples. 6 L2 CO1
OR
Q.2 a. What are functions? Explain Python function with parameters and return 7 L2 CO1
statements.
b. Define exception handling. How exceptions are handled in python? Write a 7 L2 CO1
program to solve divide by zero exception.
c. Develop a python program to calculate the area of rectangle and triangle 6 L3 CO1
print the result.
Module – 2
Q.3 a. Explain negative indexing, slicing, index( ), append( ), remove( ), pop( ), 8 L2 CO2
insert( ) and sort( ) with suitable example.
b. Explain the use of in and not in operators in list with suitable examples. 6 L2 CO2
OR
Q.4 a. Explain the following methods in lists with an examples: 8 L2 CO2
i) len( ) ii) sum( ) iii) max( ) iv) min( ).
1 of 2
BPLCK105B/BPLCKB105
OR
Q.6 a. Explain the concept of file handling. Also explain reading and writing 8 L2 CO3
process with suitable example.
b. Explain the concept of file path. Also discuss absolute and relative file path. 6 L2 CO3
Module – 4
Q.7 a. Explain the following file operations in Python with suitable example: 6 L2 CO3
i) Copying files and folders
ii) Moving files and folders
iii) Permanently deleting files and folders.
b. List out the benefits of compressing file? Also explain reading of a zip file 8 L2 CO3
with an example.
OR
Q.8 a. Briefly explain assertions and raising a exception. 6 L2 CO3
b. List out the benefits of using logging module with an example. 6 L2 CO3
c. Develop a program with a function named DivExp which takes two 8 L3 CO3
parameters a, b and returns a value C (C = a/b). Write suitable assertion for
a > 0 in function DivExp and raise an exception for when b = 0. Develop a
suitable program which reads two values from the console and calls a
function DivExp.
Module – 5
Q.9 a. Define a class and object, construct the class called rectangle and initialize 8 L2 CO4
it with height = 100, width = 200, starting point as (x = 0, y = 0). Write a
program to display the center point co-ordinates of a rectangle.
b. Explain the concept of copying using copy module with an example. 6 L2 CO4
OR
Q.10 a. Define a function which takes two objects representing complex numbers 8 L2 CO4
and returns new complex number with a addition of two complex numbers.
Define a suitable class ‘Complex’ to represent the complex number.
Develop a program to read N(N > = 2) complex numbers and to compute
the addition of N complex numbers.
*****
2 of 2
USN BPLCK205B/ BPLCKB205
b. List and explain with example different comparison and Boolean operators. 8 L1 CO1
OR
Q.2 a. List and explain with syntax and example the flow control statement in 10 L1 CO1
python.
b. Demonstrate with example print( ), input( ) and string replication function 6 L2 CO1
in python.
c. Develop a program to read the name and year of birth of a person. Display 4 L3 CO1
weather person is senior citizen or not?
Module – 2
Q.3 a. What is a list? Explain append( ), insert( ), and remove methods with 10 L1 CO2
example.
b. Explain the methods of list data types in python for the following 10 L1 CO2
operations with suitable code snippet for each.
i) Adding value to list
ii) Remaining value from list
iii) Finding a value in a list
iv) Sorting the value in a list
v) Reversing a value in list
OR
Q.4 a. Explain get( ), item( ), keys( ) and values( ) methods of dictionary in 8 L2 CO2
python.
b. How is tuple different from list? Which function is used to convert list to 7 L1 CO2
tuple?
Module – 3
Q.5 a. Explain the syntax and example various string methods. 7 L1 CO3
1 of 2
c. Read multidigit number from console. Develop a program to print 5 L3 CO3
frequency of occurrence of each digit with suitable message.
OR
Q.6 a. Explain File reading and writing process with suitable python program. 7 L3 CO3
b. With code snippet, explain saving variables using shelve module and 6 L2 CO3
print( ) and print format( ) functions.
Module – 4
Q.7 a. Explain the functions of shutil module with example. 10 L1 CO3
OR
Q.8 a. Explain the following file operation in python with example. 6 L1 CO3
i) Copying files and folders
ii) Moving files and folders
iii) Permanently deleting files and folders
b. Define assertions. What does an assert statement in python consists of? 7 L1 CO3
Give an example.
c. Develop a program to sort contents of a text file and write the forted 7 L3 CO3
content into a separate file.
Module – 5
Q.9 a. Explain operator overloading and polymorphism with example. 7 L1 CO4
b. Explain the concept of pure functions and modifiers with python code. 7 L1 CO4
c. Write a function called print time that takes a time object and print it in the 6 L3 CO4
form of hour: minute: second?
OR
Q.10 a. What is class? How do we define class? How class members are accessed, 6 L1 CO4
explain with examples.
*****
2 of 2
USN BPLCK205B / BPLCKB205
Module – 1 M L C
Q.1 a. Explain with example print( ), input( ) and len( ). 6 L2 CO1
OR
Q.2 a. What are functions? Explain python function with parameters and return 6 L2 CO1
statement.
c. Explain Local and Global scope with variables for each. 8 L2 CO1
Module – 2
Q.3 a. Explain the use of in and not in operator in list with examples. 6 L2 CO2
OR
Q.4 a. Explain the following list methods with examples. 10 L2 CO2
i) index ( ) ii) append( ) iii) insert( )
iv) sort( ) v) reverse( ) vi) List concatenation and Replication.
b. Develop a program to read the student details like Name, USN and Marks 10 L3 CO2
in three subjects. Display the student details, total marks and percentage
with suitable messages.
Module – 3
Q.5 a. Illustrate with example opening of a life with open( ) function, reading the 10 L2 CO3
contents of the file with read( ) and writing to files with write ( ).
1 of 2
BPLCK205B / BPLCKB205
OR
Q.6 a. Explain the following string methods with examples. 10 L2 CO3
i) isalpha( ) ii) isalnum( ) iii) isdecimal( ) iv) isspace( ) v) istitle( ).
Module – 4
Q.7 a. What are Assertions? Write the contents of an assert statement. Explain 10 L2 CO3
them with examples.
b. Develop a program with a function named DivExp which takes Two 10 L3 CO3
parameters a, b and returns a value c(c = a/b), write suitable assertion for
a > 0 in function DivExp and raise an exception for when b = 0. Develop a
suitable program which reads two values from the console and calls a
function DivExp.
OR
Q.8 a. Explain about files and folders can be copied using shutil module. 10 L2 CO3
Module – 5
Q.9 a. Explain about class and objects. 10 L2 CO4
OR
Q.10 a. Explain the concept of prototyping Vs planning. 10 L2 CO4
*****
2 of 2
USN BPLCK205B/BPLCKB205
Module – 1 M L C
Q.1 a. Explain elif, for, while statement in python with example for each. 06 L2 CO1
b. List and explain math operators used in python with example. 06 L2 CO1
c. Develop a program to read the name and year of birth of a person. Print 08 L3 CO1
whether person is senior citizen or not.
OR
Q.2 a. Explain local and global scope with example. 06 L2 CO1
Module – 2
Q.3 a. Explain the following list methods with example : 08 L2 CO2
(i) append( ) (ii) insert( ) (iii) sort( )
c. Develop a program using dictionary to print Ten most frequently appearing 08 L3 CO2
word in a text file.
OR
Q.4 a. Explain the following method with example: 08 L2 CO2
(i) key( ) (ii) values( ) (iii) items( ) in dictionary
Module – 3
Q.5 a. Explain the following string method with example: 08 L1 CO3
(i) isalpha( ) (ii) isalnum( ) (iii) isdecimal( ) (iv) isspace( )
1 of 2
BPLCK205B/BPLCKB205
b. Differentiate between absolute and relative path in specify file path. 04 L2 CO3
c. Write a program to accept string and display total number of alphabet. 08 L3 CO3
OR
Q.6 a. Explain the following method with example: 08 L2 CO3
(i) upper( ) (ii) lower( ) (iii) is_upper( ) (iv) is_lower( )
c. Develop a program to sort the content of a text file and write the sorted 08 L2 CO3
content into separate file.
Module – 4
Q.7 a. How do you copy files and folders using Shutil module? Explain in detail. 10 L2 CO3
b. With suitable code, explain Backup a folder into a Zip files, clearly mention 10 L3 CO3
steps in detail.
OR
Q.8 a. What are assertions? Write the content of an assert statement. Explain then 10 L2 CO3
with example.
b. Explain logging module with example how files and folder can be 10 L2 CO3
permanently deleted.
Module – 5
Q.9 a. What is a class? How to define class in python? How to initiate a class and 10 L2 CO4
how the class members are accessed?
OR
Q.10 a. Discuss operator overloading. Mention any five operators with respective 10 L2 CO4
special function to be overloaded in python.
2 of 2
USN BPLCK205B/BPLCKB205
Module – 1 M L C
Q.1 a. Demonstrate with example print ( ), input ( ) and string replication. 6 L3 CO1
c. Explain elif, for , while , break and continue statements in python with 8 L2 CO1
examples for each.
OR
Q.2 a. What are user defined functions? How can we pass parameters in user 5 L1 CO1
defined functions? Explain with suitable example.
b. Explain Local and Global scope with variables for each. 8 L2 CO1
c. Develop a program to read the name and year of birth of a person. Print 7 L3 CO1
whether the person is a senior citizen or not.
Module – 2
Q.3 a. What is a List? Explain append ( ) , insert ( ) and remove ( ) methods with 8 L2 CO2
examples.
OR
Q.4 a. How is tuple different from a list and which function is used to convert list 6 L2 CO2
to tuple? Explain.
c. Read N numbers from the console and create a list. Develop a program to 10 L3 CO2
compute and print mean , variance and standard deviation with messages.
Module – 3
Q.5 a. Explain the following methods with suitable examples : 8 L2 CO3
i) upper ( ) ii) lower ( ) iii) is_upper ( ) iv) is_lower ( )
b. Illustrate with example opening of a file with open ( ) function, reading the 12 L2 CO3
contents of the file with read ( ) and writing to files with write ( ).
1 of 2
BPLCK205B/BPLCKB205
OR
Q.6 a. Explain the steps involved in adding bullets to Wiki – Markup. Support 10 L2 CO3
with appropriate code.
b. Develop a program to sort the contents of a text file and write the sorted 10 L3 CO3
contents into a separate text file. [Use strip ( ) , len ( ) , list methods sort ( ) ,
append and file methods open ( ) , readlines ( ) and write ( )].
Module – 4
Q.7 a. How do you copy files and folders using Shutil module? Explain in detail. 6 L2 CO3
b. What are Assertions? Write the contents of an assert statement. Explain 8 L2 CO3
them with examples.
OR
Q.8 a. With suitable code, explain Backing up a Folder into a Zip file. Clearly 12 L2 CO3
mention the steps involved.
b. Explain the logging module and debug the factorial of number program. 8 L3 CO3
Module – 5
Q.9 a. What is a Class? How to define class in Python? How to initiate a class and 8 L2 CO4
how the class members are accessed?
OR
Q.10 a. What is Polymorphism? Demonstrate polymorphism with functions to find 10 L3 CO4
histogram to count the numbers of times each letters appears in a word and
in sentence.
b. Write Deck methods to add, remove shuffle and sort cards, with illustrating 10 L2 CO4
the problem.
*****
2 of 2
USN 15CS664
Note: Answer any FIVE full questions, choosing ONE full question from each module.
2. Any revealing of identification, appeal to evaluator and /or equations written eg, 42+8 = 50, will be treated as malpractice.
Module-1
1 a. List the features of Python Programming Language (at least FIVE). (05 Marks)
b. What is the role of a programmer? List two skills required to be a programmer. (05 Marks)
c. Explain the chained and nested conditional execution statements along with syntax and flow
chart. (06 Marks)
Important Note : 1. On completing your answers, compulsorily draw diagonal cross lines on the remaining blank pages.
OR
2 a. What are Python words and sentences? Explain with an example for each. (04 Marks)
b. Differentiate compiler and interpreter. (04 Marks)
c. Write python programs to i) Find largest of three numbers
ii) Check whether the given year is leap year or not with functions. (08 Marks)
Module-2
3 a. Demonstrate the use of break and continue keywords in looping structures using a snippet
code. (06 Marks)
b. Explain string slicing in Python. Show with examples. (04 Marks)
c. Write a Phytho program to accept a sentence from the user and display the longest word of
that sentence along with its length. (06 Marks)
OR
4 a. List and explain any four built in string manipulation functions supported by Python.
(06 Marks)
b. Write the Python code to display the last six characters of the string “Make hay while the
sun shines” to the console. (03 Marks)
c. Write a Pytho program to accept a file name from the user :
i) Display the first N-lines of the file.
ii) Find the frequency of occurrence of the word accepted from the user in the file.
(07 Marks)
Module-3
5 a. Explain the difference between a list and a dictionary. (04 Marks)
b. Make a list of first ten letters of the alphabet then using the slice operation do the following :
i) Print the first three letters from the list.
ii) Print the three letters from the middle.
iii) Print the letters from 5th letters to the end of the list. (04 Marks)
c. Discuss the lists handling function in python with example. (08 Marks)
OR
6 a. Difference between list and dictionary. (08 Marks)
b. Define Tuple. Explain DSU pattern. Write a python code to determinate tuples by sorting a
list of words from longest to shortest using loops. (04 Marks)
c. Explain the need of Regular expressions in python language. (04 Marks)
1 of 2
15CS664
Module-4
7 a. Create a student class and initialize it with name and roll number. Design methods to :
i) Display_to display all information of the student.
ii) setAge_to assign age to student.
iii) setMarks_to assign marks to the student. (07 Marks)
b. Using datetime module write a program that gets the current date and prints the day of the
week. (04 Marks)
c. What are Polymorphic functions? Explain with a snippet code (05 Marks)
OR
8 a. What does the keyword self in Python mean? Explain with an example. (05 Marks)
b. Show using a Python code how_init_method is invoked when an object is initiated. Explain
its working. (06 Marks)
c. Explain _ str_ method with a Pytho program. (05 Marks)
Module-5
9 a. Demonstrate with the help of Python construct i) how to retrieve an image over HTTP.
ii) how to retrieve web pages with urllib. (08 Marks)
b. Compare and contrast the JavaScript object Notation (JSON) and XML. (04 Marks)
c. What is Service – Oriented Architecture? List the advantages of the same. (04 Marks)
OR
10 a. Write a Python program that retrieve an user’s Twitter friends , Parse the returned JSON and
extract some of the information about the friends. (08 Marks)
b. Create a simple spidering program that will go through Twitter accounts and build a
database of them. (08 Marks)
*****
2 of 2
USN 17CS664
Module-1
1 a. Define variable, expression and statement in python with examples. (06 Marks)
b. List logical operators. With a suitable program explain the role of logical operators.
(06 Marks)
c. Develop a python program to calculate the roots of a quadratic equation using chained
conditionals. (08 Marks)
Important Note : 1. On completing your answers, compulsorily draw diagonal cross lines on the remaining blank pages.
OR
2 a. Define ‘user defined function’. Explain the syntax of definition and function call with an
example. (08 Marks)
b. Develop a python program to convert temperature given in Fahrenheit to Degree Celsius.
(06 Marks)
c. Develop a program to perform simple arithmetic operations (+, – , , / ) using functions.
(06 Marks)
Module-2
3 a. Develop a program to illustrate the role of break and continue statements. (08 Marks)
b. Develop a program to read two strings and display the longer string without using built-in
functions. (06 Marks)
c. Define indefinite loop with syntax and example. (06 Marks)
OR
4 a. Explain string slicing with suitable examples. (06 Marks)
b. Explain with an example, exception handling in python. (06 Marks)
c. Develop a program to count the occurrences of a given word in a given text file. (08 Marks)
Module-3
5 a. Develop a program to generate Fibonacci numbers using Lists. (06 Marks)
b. Explain creation, access, updating and deleting elements from dictionary. (08 Marks)
c. Write a program to read a line of text, create a dictionary having word as a key and word
length as a value. (06 Marks)
OR
6 a. ‘Tuples are immutable’ and ‘List are mutable’. Explain with suitable code segments.
(10 Marks)
b. Explain the following methods with code segments:
i) compile( ) (ii) search( ) (iii) findall( ) (10 Marks)
Module-4
7 a. Explain the concept ‘prototype and patch’ with suitable code segments/programs. (10 Marks)
b. Explain type based dispatch showing different possibilities with suitable code segments.
(10 Marks)
1 of 2
17CS664
OR
8 a. Explain deep copy and shallow copy by taking suitable code examples. (10 Marks)
b. Explain _ _ init_ _ , _ _ str _ _ and operator overloading with suitable code segments.
(10 Marks)
Module-5
9 a. Explain the methods used to connect to a server using sockets. Develop a program to
retrieve an image from a web host using HTTP protocol and Urllib library. (10 Marks)
b. Explain the structure of JSON with an example. Explain parsing of JSON data with a
suitable python program. (10 Marks)
OR
10 a. Explain the structure of XML with an example. Explain the different methods used to parse
XML having multiple nodes with a suitable program. (10 Marks)
b. Explain the methods used to access a database in python. Develop a python program to
create database table with a minimum two tuples (rows) and print.
Table Name : STUDENT
Field : USN : Integer – Primary key
Name : Text – Unique
Marks : Integer (10 Marks)
*****
2 of 2
USN 18AI52
Note: Answer any FIVE full questions, choosing ONE full question from each module.
2. Any revealing of identification, appeal to evaluator and /or equations written eg, 42+8 = 50, will be treated as malpractice.
Module-1
1 a. Each variable used in python programming will have its own scope of visibility. Is it
possible to have local and global variables with same name? Justify your answer using a
small python code snippet along with the output expected. (06 Marks)
b. How are runtime exceptions handled in python? (04 Marks)
c. Write a small python code to implement the game “Guess the Number”. (10 Marks)
Important Note : 1. On completing your answers, compulsorily draw diagonal cross lines on the remaining blank pages.
OR
2 a. List and explain the following operators in detail :
(i) Comparison operators
(ii) Boolean operators
(iii) Mixing Boolean and Comparison operators (10 Marks)
b. Write a python program/code to read the name of a user and his age. Based on the age, the
following message to be displayed to the user:
(i) If the age is less than 20, then display his name is a message “You are a minor”.
(ii) If the age is more than 20, but less than 50, then display his name and a message
“Your are in your mid age”
(iii) If the age is above 50, then display his name and a message “You are in your old
age”.
Support your code with corresponding flow chart and a sample output. (10 Marks)
Module-2
3 a. Elaborate on Augmented Assignment operators supported in python. (05 Marks)
b. List any 4 methods most frequently used in python and explain them along with their
syntaxes in detail. (10 Marks)
c. Explain list slicing concept with an example of your own. (05 Marks)
OR
4 a. Define Dictionary. Is it possible to traverse the keys and the Dictionary using a ‘for’ loop?
Justify your answer (10 Marks)
b. Write a python program to accept a sentence and compute the number of words, digits,
upper and lower case letters present in it. Display the results with proper messages and
sample output. (10 Marks)
Module-3
5 a. Write a note on :
(i) Greedy and Non Greedy matching.
(ii) The findall ( ) method. (10 Marks)
b. Explain the process of file Reading and Writing along with suitable python programming
code snippet. (10 Marks)
1 of 2
18AI52
OR
6 a. Write a note on:
(i) The Caret and Dollar sign characters
(ii) The wild card character (10 Marks)
b. Write a python program to extract phone numbers and email addresses using RegEx.
(10 Marks)
Module-4
7 a. (i) Define classes, objects and Rectangles in python. (03 Marks)
(ii) Elaborate on the concept of pure functions with the help of a python code snippet.
(07 Marks)
b. Using python code snippets, explain the init and _ _ str _ _ methods in detail. (10 Marks)
OR
8 a. What is operator overloading? Using a python code snippet, explain overloading of basic
arithmetic operators like +, -, * and / along with expected output sequence. (10 Marks)
b. Define Polymorphism. Explain the various ways in which polymorphism concept can be
handled / applied in python coding. (10 Marks)
Module-5
9 a. Using suitable python code snippets, explain
(i) How to download files from the web using the requests module?
(ii) How to save the downloaded files to the Hard drive? (10 Marks)
b. Write a note on the procedure for retrieving a web page element from a beautiful soap object
with the help of select method. Using an example python script of your own and explain the
above concept by passing a string of a CSS selector for the element under observation.
(10 Marks)
OR
10 a. Write a note on usage of openPyXL to achieve the following tasks along with supporting
python coding.
(i) Creating and saving Excel documents
(ii) Creating and Removing sheets. (10 Marks)
b. Using a python code snippet, elaborate on the json module of python in detail. (10 Marks)
*****
2 of 2
USN 18AI52
Module-1
1 a. Explain data types in python programming language with a example and demonstrate
print( ), input( ) (06 Marks)
b. Explain with an example :
i) String concatenation
Important Note : 1. On completing your answers, compulsorily draw diagonal cross lines on the remaining blank pages.
OR
2 a. Demonstrate with an example str( ), int( ) and len( ) functions. (06 Marks)
b. With the help of flowchart explain if-statement and elif-statement. (08 Marks)
c. What is exception handling? How exception are handled in python? Write a python program
with exception handling code to solve divide – by – zero error situation. (06 Marks)
Module-2
3 a. What is list? Explain append( ), insert( ) and remove( ) methods with example. (08 Marks)
b. Explain references with an example. (06 Marks)
c. What is the differences between list and Tuples? Explain with example method of
converting types with list ( ) and Tuples( ) functions. (06 Marks)
OR
4 a. Discuss get( ), item( ) keys( ) and values( ) of dictionary methods in python with example.
(08 Marks)
b. Write a program to swap case of a given string input Java o/p jAVA. (06 Marks)
c. Explain the various string methods for following operation with example :
i) Upper( )
ii) Low( )
iii) islower( ) (06 Marks)
Module-3
5 a. Write a program to find an American phone number (example 415-555-4242) in a given
string using regular expressions. (06 Marks)
b. With a suitable python code explain :
i) Greedy pattern matching
ii) Non-greedy pattern matching. (06 Marks)
c. What are regular expressions? Describe question mark, star, plus Regex symbols with
suitable Python code snippet. (08 Marks)
1 of 2
18AI52
OR
6 a. Explain in detail with code snippet
i) Current working directory
ii) Home directory. (08 Marks)
b. With code snippet explain reading the content of file and writing to files. (08 Marks)
c. Explain absolute path and relative path. (04 Marks)
Module-4
7 a. What is a class? How to define class in python? How to initiate a class and how class
members one accessed. (06 Marks)
b. Explain init and - - str- - method with an example python snippet code. (08 Marks)
c. Illustrate the concept of pure function with python code. (06 Marks)
OR
8 a. Explain the concept of modifier with python code. (06 Marks)
b. Illustrate the concept of operator overloading. (07 Marks)
c. Illustrate the concept of inheritance. (07 Marks)
Module-5
9 a. How do we download a file from web and save it to hard drive using request module.
(08 Marks)
b. Explain Selenium’s web drive methods for finding elements. (06 Marks)
c. Explain in detail how to parse HTML with the beautiful soap. (06 Marks)
OR
10 a. Explain the concept of :
i) Extracting text from PDF
ii) Decrypting PDF. (08 Marks)
b. What are the advantage of CSV files? Explain reader object with python code. (06 Marks)
c. What is JSON mdoule? Explain loads( ) and dumps( ) functions of JSON. (06 Marks)
*****
2 of 2
USN 18BT36
Note: Answer any FIVE full questions, choosing ONE full question from each module.
2. Any revealing of identification, appeal to evaluator and /or equations written eg, 42+8 = 50, will be treated as malpractice.
Module-1
1 a. What is an Algorithm? Explain with an example. What are the building block of algorithms?
(10 Marks)
b. Outline the ‘Tower of Hanoi’ problem with the help of figure. Suggest an algorithm to solve
the Tower of Hanoi problem with relevant diagrams. (10 Marks)
Important Note : 1. On completing your answers, compulsorily draw diagonal cross lines on the remaining blank pages.
OR
2 a. What is flowchart and what is the purpose of it. Along with description list and draw the
common symbols used in flowchart. Illustrate with an example. (10 Marks)
b. What is Pseudocode? Explain the common keywords used in pseudocode. Write a
Pseudocode for finding the minimum in a list. (10 Marks)
Module-2
3 a. Define Variables. List the rules to declare variables in python. Demonstrate atleast 3
different types of variables with examples. (10 Marks)
b. Differentiate between Python compiler and Interpreter. (05 Marks)
c. Write the python program to find the sum of natural numbers upto ‘n’ where n is provided
by user. (05 Marks)
OR
4 a. Define functions with Syntax. Explain Value-returning functions with example. (05 Marks)
b. Explain the rules of precedence of Operators used by Python language. (05 Marks)
c. Explain Operators and Operands in python with examples. (10 Marks)
Module-3
5 a. List different types of conditional statements available in python. Illustrate the use of
chained if..elif..else and nested if..else with an example each. (10 Marks)
b. Define Operators. List the different types of operators available in python. Explain any 3 in
detail. (10 Marks)
OR
6 a. Demonstrate the use of while loop in python with proper syntax and flowchart. (10 Marks)
b. Write a python program to , i) Exchange the value of two variables.
ii) Find distance between two points. (10 Marks)
Module-4
7 a. Write a python program to perform linear search on a list. (10 Marks)
b. Briefly describe the operations on list with relevant codes. (10 Marks)
OR
1 of 2
18BT36
8 a. Write any five methods that operate on list with examples. (10 Marks)
b. What is fruitful function? Explain with an example compare fruitful function with void
function. (10 Marks)
Module-5
9 a. Define Dictionary. Explain in detail about Dictionary operations. (10 Marks)
b. Write Python program for selection sort and insertion sort. (10 Marks)
OR
10 a. Differentiate between List, Tuple and Dictionary. (05 Marks)
b. Define Tuple. Explain Tuple operations in detail. (08 Marks)
c. Write a note on List comprehension. (07 Marks)
*****
2 of 2
USN 18BT36
Note: Answer any FIVE full questions, choosing ONE full question from each module.
2. Any revealing of identification, appeal to evaluator and /or equations written eg, 42+8 = 50, will be treated as malpractice.
Module-1
1 a. Discuss briefly about algorithmic problem solving technique. (04 Marks)
b. Write an algorithm to insert a card in a list of sorted cards. (08 Marks)
c. Explain in detail about building blocks of algorithm. (08 Marks)
Important Note : 1. On completing your answers, compulsorily draw diagonal cross lines on the remaining blank pages.
OR
2 a. Define flowchart. Discuss the symbols and rules for drawing flowchart with the example.
(06 Marks)
b. Write the pseudocode for Towers of Hanoi. (06 Marks)
c. Write an algorithm to find the minimum number in a list. (08 Marks)
Module-2
3 a. Explain in detail about various data types in python with an example each. (15 Marks)
b. What is a keyword? List the keywords used in python program. (05 Marks)
OR
4 a. Define function. Briefly discuss about function definition, function call and flow of
execution. (08 Marks)
b. Describe about the concept of precedence and associativity of operators with examples.
(08 Marks)
c. Give a detailed note on python interpreter and interactive mode of operation. (04 Marks)
Module-3
5 a. Analyze with a program to find out the distance between two points. (06 Marks)
b. Explain conditional statements in detail with example. (14 Marks)
OR
6 a. Explain in detail about iterations with example. (16 Marks)
b. Discuss about string slicing and string immutability. (04 Marks)
Module-4
7 a. Write a python program to search an element in a sorted array using binary search. (10 Marks)
b. Illustrate a program to find GCD of two numbers. (06 Marks)
c. Explain recursion in python with an example program. (04 Marks)
OR
8 a. Write a python program for linear search using function. (08 Marks)
b. Describe the algorithm and python program to find exponentiation of given number.
(08 Marks)
c. Mention any four list methods with its description. (04 Marks)
1 of 2
18BT36
Module-5
9 a. Create a python program to perform insertion sort. (10 Marks)
b. “Tuples are immutable”. Explain with an example. (05 Marks)
c. Explain operations and methods in dictionaries. (05 Marks)
OR
10 a. Illustrate list comprehension with example. (04 Marks)
b. Discuss about tuple assignment. (04 Marks)
c. Perform merge sort on a given list of elements. (12 Marks)
*****
2 of 2
USN 18CB753
Module-1
1 a. What is program? What are the building blocks of programs? (06 Marks)
b. Explain computer hardware architecture with neat diagram. (08 Marks)
c. Write a python program to prompt the user for hours and rate per hours to compute gross
pay. (06 Marks)
Important Note : 1. On completing your answers, compulsorily draw diagonal cross lines on the remaining blank pages.
OR
2 a. Explain if, else and elif statement in python. (06 Marks)
b. Define the following:
(i) Value (ii) Variables (iii) Expressions (iv) Arguments (08 Marks)
c. Write a user defined function to find given number is positive, zero or negative. (06 Marks)
Module-2
3 a. Write a program which repeatedly reads numbers until user enters ‘done’. Once ‘done’ is
entered, printout the total, count and average of the numbers. (10 Marks)
b. Apply following string functions to given string:
S = “Hello World”
(i) len ( ) (ii) S[4] (iii) [Link]( ) (iv) S.[6: ] (v) [Link] ( ) (10 Marks)
OR
4 a. Discuss read and write mode on files. Write a python program to count number of lines in a
file. (10 Marks)
b. What is iteration? Explain while loop and for loop syntax with example. (10 Marks)
Module-3
5 a. Explain the following methods of list data types in python with suitable example:
(i) append ( ) (ii) insert ( ) (iii) Sort ( )
(iv) remove ( ) (v) pop ( ) (10 Marks)
b. What is dictionary? Write a python program to accept string from user and print the
dictionary for count of each character in string. (10 Marks)
OR
6 a. Explain how to use tuple as keys in dictionaries. (06 Marks)
b. How is tuple different from list data type? Explain with example the function used to
convert list into tuple and tuple into list. (06 Marks)
c. Write a python program that uses regular expression to search for words that starts from ‘a’.
(08 Marks)
Module-4
7 a. Define class. How class and objects are created in python? (06 Marks)
b. Explain _ _ init _ _ and _ _ str _ _ methods. (06 Marks)
c. Explain pure function and modifiers with examples. (08 Marks)
1 of 2
18CB753
OR
8 a. Explain type based dispatch with an example. (06 Marks)
b. Discuss operator overloading with suitable examples. (06 Marks)
c. Explain the concept of inheritance with class diagram. (08 Marks)
Module-5
9 a. Explain how to retrieve an image over HTTP. (06 Marks)
b. What is socket? Explain how socket connection can be established over TCP/IP connection.
(08 Marks)
c. Explain significance of XML over the web development. Illustrate with examples. (06 Marks)
OR
10 a. What is JSON? Explain concept of parsing JSON. (06 Marks)
b. Explain the four basic SQL commands needed to create and maintain data. (08 Marks)
c. Explain a four keys of database cursor. (06 Marks)
*****
2 of 2
USN 18CS752
Note: Answer any FIVE full questions, choosing ONE full question from each module.
Module-1
1 a. List the features of python programming language. (06 Marks)
b. Differentiate compiler and interpreter. (04 Marks)
c. Describe arithmetic operators, assignment operators, comparison operators, logical operators
Important Note : 1. On completing your answers, compulsorily draw diagonal cross lines on the remaining blank pages.
OR
2 a. List and give syntax of all python supported conditional statements and explain its usage
with an example. Write a program to check whether the given number is positive or negative
or zero. (08 Marks)
b. Write a short note on:
i) ** and // operators
ii) Types of errors
iii) Built-in function. (06 Marks)
c. Write python programs to
i) Find largest of 3 numbers
ii) Check whether the given year is leap year or not with a function. (06 Marks)
Module-2
3 a. With syntax and example code, explain the working of definite loop in python. (06 Marks)
b. Write a python program to demonstrate counting, summing and average of elements using
loops. (06 Marks)
c. Explain the concept of string slicing and predict the output for the following code (consider
the string str = “Hello World”)
i) print(“str[:] is”, str[:])
ii) print(“str[0:5] is”, sf[0:5])
iii) print(“str[4:4] is”, st[4:4])
iv) print(“str[3:8:2] is”, str[3:8:2])
v) print(str[-1:]). (08 Marks)
OR
4 a. Explain the concepts of infinite loops. Differentiate ‘break’ and ‘continue’ statements with
an example. (06 Marks)
b. What is a string? Write a python program to demonstrate traversal through a string with a
loop. Also explain the concept of string slicing. (07 Marks)
c. Explain file open, file close, file read and file write concepts in python with example.
(07 Marks)
1 of 2
18CS752
Module-3
5 a. What is list? Explain the following methods with an example:
i) append( ) ii) sort( ) iii) Reverse( ). (10 Marks)
b. What is dictionary? How is it different from list? Write a python program to count the
occurrence of characters in a string and print the count. (06 Marks)
c. What is tuples? Compare and contrast lists and tuples. (04 Marks)
OR
6 a. Discuss the lists handling functions in python with example. (08 Marks)
b. Explain ‘DSU’ pattern with respect to tuples. Write a python code to determine tuples by
sorting a list of words from longest to shortest using loops. (08 Marks)
c. Explain the need of regular expression in python language. (04 Marks)
Module-4
7 a. Define class and object. Explain the working of init method with suitable code. (06 Marks)
b. Define attribute. With the help of python code explain how functions return instance values.
(06 Marks)
c. Explain the concept of modifier with python code. (08 Marks)
OR
8 a. What is the difference between method and function? Also explain programmer defined
types with an example. (10 Marks)
b. Illustrate the concepts of pure function with python code. (10 Marks)
Module-5
9 a. Write a python code to read the file from web using urllib and retrieve the data of the file.
(10 Marks)
b. What is XML? How is it used in python? Explain parsing of XML with example. (10 Marks)
OR
10 a. Define cursor. Explain connect, execute and close command of databases with suitable
example. (10 Marks)
b. Write a python code for creating employee database, inserting records and selecting the
employees working in the company. (10 Marks)
*****
2 of 2
USN 18EC646
Module-1
1 a. Identify three types of errors encounter in python and also explain the basic building blocks
of Python program. (07 Marks)
b. Develop Python programs to i) find the area of a rectangle ii) find whether the given number
is eve or odd. In both cases accept the input from the user and program must handle non-
Important Note : 1. On completing your answers, compulsorily draw diagonal cross lines on the remaining blank pages.
numeric input gracefully by printing a message and exiting the program. (08 Marks)
c. Predict the output and justify your answer :
i) –15%7 ii) 7.7//6 iii) (200 – 70) 10/5 iv) 6 1 3 v) not “True”. (05 Marks)
OR
2 a. Write a user defined function named ‘solve’ that returns the remainder and quotient as
division of two numbers accepted from the user print the remainder and quotient separately
on the console. (05 Marks)
b. Make use of necessary example and flow chart to explain the concept of alternate execution,
chained conditional and nested conditional and nested conditional statements. (08 Marks)
c. Make use of necessary code snippets to explain :
i) Short circuit evaluation
ii) Type conversion function
iii) Void functions. (07 Marks)
Module-2
3 a. Mention the advantages of break and continue statement. Write a program to compute the
sum of only odd numbers within the given natural number using continue statement.
(08 Marks)
b. Make use of necessary syntax and examples to explain the following string methods :
i) lower ii) capitalize iii) join iv) isalpha (08 Marks)
c. Use find and string slicing to extract the second half of the email address in the following
string and print the result – “From support @ [Link] July 9 2022”. (04 Marks)
OR
4 a. Write a Python program to accept the file from the user add :
i) Display the first N-lines of the file
ii) Find the frequency of occurrence of the word accepted from the user in the file
(10 Marks)
b. Develop a Python program to search for the line that starts with the word “From” in a file.
(05 Marks)
c. Explain ‘for’ loop with necessary syntax. Write a program to compute the factorial of a
number accepted from the user. (05 Marks)
1 of 3
18EC646
Module-3
5 a. Identify the ways of traversing a list. Explain with example. Also explain any two list
operations. (08 Marks)
b. Compare and contrast tuples with lists. Explain the following operations in tuple :
i) Sum of tuples
ii) slicing operations
iii) tuple assignment. (06 Marks)
c. Write a program using lists to store and display the average of N integers accepts from the
user. (06 Marks)
OR
6 a. Develop a program that accepts a sentence and builds dictionary with LETTERS, DIGITS,
UPPERCASE, LOWERCASE and key values and their count in the sequence as values.
Example :
Sentence = “VTU@123.e - Learning” d = {LETTERS” : 12, “DIGITS” : 3,
“UPPERCASE” : 4, “LOWERCAE” : 8}. (06 Marks)
b. Write a Python program to check the validity of a passward read by the users. The following
criteria should be used to check the validity. Passward should have atleast
i) One upper case letter
ii) One lower case latter
iii) One digit
iv) One special character from ($ # ! @)
v) Eight characters. (08 Marks)
c. Demonstrate :
i) The difference between pop and remove methods on lists
ii) How a dictionary item can be represented as a list of tuples. (06 Marks)
Module-4
7 a. Differentiate between pure function and modifier develop a Python program to find duration
of an event of start and end time is given by defining class TIME. (08 Marks)
b. What is polymorphism? Explain with snippet code. (07 Marks)
c. Explain init and str method with example. (05 Marks)
OR
8 a. Write a Python program that has a class point with attributes as X and Y co-ordinates.
Create two objects of this class and find the midpoint of both the points. Also add a method
reflux – X to class point, which returns the new point which is the reflection of the point
about the X-axis.
Example : Point (5, 10) Reflex – X returns point (5, 10). (08 Marks)
b. Make use of necessary example to explain single, multiple, multilevel and hierarchical
inheritance. (08 Marks)
c. Demonstrate the concept of operator overloading with a code snippet. (04 Marks)
2 of 3
18EC646
Module-5
9 a. Make use of an example to explain the significance of XML over the web development.
(08 Marks)
b. Explain any two socket functions. Write a Python program to that makes a connection to a
web server and follows the rules of HTTP protocol to request a document and display what
server sends back. (08 Marks)
c. What is service oriented architecture? List the advantages of the same. (04 Marks)
OR
10 a. Create a simple spidering program that will go through Twitter accounts and build a
database of them. (08 Marks)
b. With necessary diagram and code describe creation of database table using database cursor
architecture. (08 Marks)
c. Compare the contrast the Javascript object Notation (JSON) and XML. (04 Marks)
*****
3 of 3
USN 18EC646
Note: Answer any FIVE full questions, choosing ONE full question from each module.
Module-1
1 a. Explain any five salient features of python. (06 Marks)
b. What is short circuit evaluation of logical expressions? How is it useful? (06 Marks)
Important Note : 1. On completing your answers, compulsorily draw diagonal cross lines on the remaining blank pages.
c. Write a program to solve quadratic equation. Your program should prompt the user to input
the coefficients of quadratic equation. (08 Marks)
OR
2 a. With help of suitable examples, explain the rules of precedence used in python for
evaluation of expressions. (06 Marks)
b. Explain the feature of exception handling in python with help of suitable example.
(08 Marks)
c. Write a program to prompt the user to input an integer and print the factorial of the fed
number. (06 Marks)
Module-2
3 a. Explain with suitable example the difference between continue and break in a for loop.
(08 Marks)
b. Write a program to prompt the user for a file name and then read through the file and look
for presence of your USN. If USN is found print the line containing your USN. (12 Marks)
OR
4 a. With the help of suitable examples explain the various slicing methods of string. (08 Marks)
b. Explain any three methods of string with help of suitable example. (06 Marks)
c. Write a program to write table of integers from 0 to 10 and their corresponding squares into
a file. (06 Marks)
Module-3
5 a. Write a program to build statistics of a file in form of dictionary. The key of dictionary
should be word in the read file and the corresponding value should be the frequency
(number of times the word is found) of word. (10 Marks)
b. Write a program to read all the lines in a file accepted from user and print all the ip
addresses in file contents. (06 Marks)
c. Differentiate between lists and tuples. How is a tuple created? Give two possible ways.
(04 Marks)
1 of 2
18EC646
OR
6 a. Describe any three methods of dictionary. Use suitable example to illustrate these methods.
(06 Marks)
b. What is tuple? Write a program to find the longest word in a list using DSU pattern of tuple.
(06 Marks)
c. Write program segment to perform following operations using regular expressions:
i) Filter given list to exclude elements that contain either ‘a’ or ‘e’.
ii) Search for a valid USN in a paragraph containing multiple lines with each line
separated by a newline character. (08 Marks)
Module-4
7 a. Define classes and objects in python. Explain with examples. (06 Marks)
b. Write a program to create class rectangle which has attributes length and breadth, a
parameterized constructor and method for finding area of rectangle. (08 Marks)
c. With the help of suitable example explain the concept of polymorphism. (06 Marks)
OR
8 a. With the help of suitable example explain the differences between pure functions and
modifier. (06 Marks)
b. Explain the concept of operator overloading with a suitable example. (08 Marks)
c. What is the significance of _ _str_ _ and _ _init_ _ methods in a class? (06 Marks)
Module-5
9 a. What is Socket? With the help of suitable program segment explain how socket connection
can be established to internet over TCP/IP connection and the http protocol to get the web
document. (08 Marks)
b. What is JSON? Write a program to parse data in JSON format. (06 Marks)
c. What is a database cursor? Explain its significance in data base operations. Illustrate how a
new table can be created in a database. (06 Marks)
OR
10 a. Write a program to retrieve data from [Link] file on internet and compute frequency of
each word in the retrieved file. (08 Marks)
b. What is API? Explain the service oriented architecture with the help of suitable block
diagram. (06 Marks)
c. What is SQL? Explain any 3 SQL commands with the help of suitable examples. (06 Marks)
*****
2 of 2
USN 21BT42
Note: Answer any FIVE full questions, choosing ONE full question from each module.
2. Any revealing of identification, appeal to evaluator and /or equations written eg, 42+8 = 50, will be treated as malpractice.
Module-1
1 a. Define Algorithm. Mention the types. (04 Marks)
b. Explain the building blocks of algorithms with neat flow charts. (06 Marks)
c. Write a brief algorithmic procedure to find the minimum number in a list. (10 Marks)
Important Note : 1. On completing your answers, compulsorily draw diagonal cross lines on the remaining blank pages.
OR
2 a. What are the properties that an algorithm must satisfy? Explain them. (04 Marks)
b. Describe Binary Search Algorithm. Provide the pseudocode and explain the working.
(06 Marks)
c. With a brief procedure, explain the game play of the Towers of Hanoi. (10 Marks)
Module-2
3 a. Define Expressions. Explain its types. (04 Marks)
b. What is the output of the code?
print (‘Hello World’ + 100 + ‘How are you?’).
Also, explain the statement if it produces any error. (06 Marks)
c. Discuss various methods of importing moduler in Python programs. (10 Marks)
OR
4 a. Define Lambda functions. Using this concept, write a program to add 2 numbers. (04 Marks)
b. List useful string methods in Python. Explain with an example for each method. (06 Marks)
c. Write a Python program to show different data types. (10 Marks)
Module-3
5 a. Discuss the concept of string formatting in Python. Provide an example of formatting strings
using f – strings and format ( ) method. (04 Marks)
b. Explain Flow control statements with examples. (06 Marks)
c. Write a Python program to convert temperatures from Celsius to Fahrenheit. (10 Marks)
OR
6 a. Discuss the concept of nested if and else statements. (04 Marks)
b. Write short notes on :
i) Break statement ii) Continue statement iii) Pass statement. (06 Marks)
c. Write a Python program to print prime numbers from 5 to 50. (10 Marks)
Module-4
7 a. What is a Function? Explain the method to declare a function. (04 Marks)
b. Explain Local and Global scope of variables in Python with suitable examples. (06 Marks)
c. Write a Python program using functions to find if a string is Palindrome or not. (10 Marks)
OR
1 of 2
21BT42
8 a. Define List. Explain with concept of slicing and indexing with suitable examples. (04 Marks)
b. Write short notes on :
i) Cloning list ii) Aliasing iii) Parameters in lists. (06 Marks)
c. Write a Python program using a function to calculate the determinant of an equation
x2 + 14x + 5 = 0. (10 Marks)
Module-5
9 a. What are Tuples? How is it different from lists? (04 Marks)
b. Explain tuple unpacking, with an example. (06 Marks)
c. Write a Python program to simulate the selection sorting process. (10 Marks)
OR
10 a. Explain the purpose and usage of keys ( ) , Values ( ) , and items ( ) in dictionaries.
(04 Marks)
b. John is an engineer working as an ABC specialist in London. His age is 35. His hobbies are
biking , travelling , singing and music. Using dictionaries, mention the attributes using key –
value pair. Explain the process. (06 Marks)
c. Write a Python program to check if key already exists in a dictionary. (10 Marks)
*****
2 of 2
USN 21EC643
1 a. List and explain the significant features of Python programming language. (08 Marks)
b. Write 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. (06 Marks)
c. Demonstrate the syntax of Python functions : print( ), input( ) and str( ) with examples.
(06 Marks)
Important Note : 1. On completing your answers, compulsorily draw diagonal cross lines on the remaining blank pages.
OR
2 a. With proper syntax and examples, explain the control statements.
i) if ii) else iii) elif iv) break statement. (08 Marks)
b. Explain the local and global scope of the variable with a suitable example. (06 Marks)
c. Write a Python snippet to generate the Fibonacci series. (06 Marks)
Module-2
3 a. What are the lists? Explain append( ), insert( ) and remove( ) methods with examples.
(08 Marks)
b. For the following two questions, spam contains the list [‘a’, ‘b’, ‘c’, ‘d’, [3, 4, 7, 2]]
i) What does span [-2] evaluate to?
ii) What does span [4] [1] evaluate to? (05 Marks)
c. Demonstrate with example of upper( ), lower( ), and isupper( ) and islower( ) string
methods. (07 Marks)
OR
4 a. What is a dictionary? Compare dictionaries with lists. Write a program to count the number
of occurrences of characters in string. (08 Marks)
b. Write a program to implement search and replace multiple occurrences of a given substring
in the main string in a list. (07 Marks)
c. Define Tuple data type, explain converting types with the list( ) and tuple ( ) Functions.
(05 Marks)
Module-3
5 a. With example, explain the following Pattern Matching with Regular Expressions.
i) Grouping with Parentheses
ii) Matching Multiple Groups with the Pipe. (10 Marks)
b. What are the steps involved in file handling? Also, explain the reading and writing process
with suitable examples in Python. (10 Marks)
1 of 2
21EC643
OR
6 a. Explain the basic steps for creating and finding regular expression objects with Python.
(06 Marks)
b. Writ a python program to accept USN and marks objected. Find maximum, minimum and
USN students who scored 100-85, 85-75, 75-60 and below 60 marks separately. (06 Marks)
c. Explain the purpose of the following special characters used in optimal matching regular
expression: ?, *, +, and {}. Illustrate with example. (08 Marks)
Module-4
7 a. Differentiate between class variables and instance variables with suitable examples.
(05 Marks)
b. Write a program to create a class classed Rectangle with the help of a corner point, width
and height. Write the following function sand demonstrate their working :
i) To find and display the center of the rectangle
ii) To display point as an ordered pair
iii) To resize the rectangle
iv) To find area and perimeter of a rectangle. (10 Marks)
c. Justify the statement “Objects are mutable” with suitable examples. (05 Marks)
OR
8 a. Explain – intit_( ) and – str_( ) methods with an example. (10 Marks)
b. Explain operator overloading and polymorphism with examples. (10 Marks)
Module-5
9 a. Write a Python program that makes a socket connection to a web server and follows the
rules of the HTTP protocol to request a document and display what the server sends back.
(10 Marks)
b. Illustrate with a python program how to retrieve web pages with urllib. (10 Marks)
OR
10 a. What is Service – Oriented Architecture (SOA)? List out the advantages of SOA. (06 Marks)
b. Discuss various keys used in the database model. (06 Marks)
c. Write the four SQL commands needed to create and maintain data. (08 Marks)
*****
2 of 2
USN BBT306A
Module – 1 M L C
Q.1 a. What is flowchart? Draw common symbols used in flow chart along with 10 L1 CO1
description list.
b. Outline the towers of Hanoi problem with relevant diagrams and describe 10 L2 CO2
the algorithm of towers of Hanoi.
OR
Q.2 a. What is pseudocode? How common keywords used in pseudocode? Write a 10 L1 CO1
pseudocode to print all natural members up to n.
b. Define algorithm. Explain building blocks of algorithm with an example. 10 L2 CO2
Module – 2
Q.3 a. Briefly explain precedence of operators with examples. 5 L1 CO2
b. Discuss about : 15 L2 CO2
i) flow of execution
ii) Parameters and agreements
iii) Modules.
OR
Q.4 a. Describe function definition and add a note on uses. 5 L1 CO2
b. Write short notes on : 15 L2 CO2
i) Difference between compliers and integrators
ii) Different datatypes in python
iii) Types of interpreter in programming.
Module – 3
Q.5 a. Discuss about iterations with suitable example. 10 L2 CO3
b. Apply python code for exchange the values of two available and distance 10 L3 CO3
between two points.
OR
Q.6 a. Explain the types of conditional statements. 10 L2 CO3
b. Make use of python for string slicing with an example. 10 L3 CO3
Module – 4
Q.7 a. Identify function composition with suitable example. 10 L3 CO4
b. Differentiate contacts linear search and linearly search with suitable 10 L4 CO4
example.
OR
Q.8 a. What is Fruitful function? Illustrate with an example and compare 10 L3 CO4
Fruitful function with void function.
b. Analyse different methods that operate on list with example. 10 L4 CO4
Module – 5
Q.9 a. Insert a value to a started list via list comprehension python. 10 L3 CO5
b. Analyse the various operations on dictionary with codes. 10 L4 CO5
OR
Q.10 a. Briefly explain Tufle assignment and tuple as return values. 10 L3 CO5
b. Analyse various operations that can be performed on tuples. 10 L4 CO5
*****
USN BMT306C
Module – 1 M L C
Q.1 a. What are the building blocks of a program? Explain in detail. 10 L2 CO1
b. Define errors. Explain the types of errors. 10 L2 CO1
OR
Q.2 a. Define debugging. Explain 4 thing that needs to be followed while 10 L2 CO1
debugging a program.
b. What are variables, statements and expression? Explain with an example 10 L2 CO1
for each.
Module – 2
Q.3 a. Explain Boolean expressions and logical operators with example. 10 L2 CO1
b. Explain if and elseif condition with an example. 10 L2 CO2
OR
Q.4 a. Explain nested condition with an example. 10 L2 CO2
b. Explain the importance of ‘function’ with a program. 10 L2 CO2
Module – 3
Q.5 a. Explain working of ‘FOR’ loop with example. 10 L2 CO3
b. Explain working of ‘WHILE’ loop with example. 10 L2 CO3
OR
Q.6 a. Explain string slice and string compare operation with example. 10 L2 CO3
b. Explain string parsing with a program. 10 L3 CO3
Module – 4
Q.7 a. Explain file open and write file operation. 10 L2 CO4
b. Explain searching through the file with a program example. 10 L2 CO4
OR
Q.8 a. Write a program using try, except and open function. 10 L3 CO4
b. Explain character matching with regular expression. 10 L2 CO4
Module – 5
Q.9 a. Explain traversing a list and list slice with a program. 10 L2 CO4
b. Explain parsing list with a program. 10 L3 CO4
OR
Q.10 a. Explain dictionaries with a program. 10 L2 CO4
b. Explain tuple compare and tuple assignment with a program. 10 L2 CO4
*****
USN BMT306C
Module – 1 M L C
Q.1 a. With a neat diagram, explain the computer hardware architecture. 10 L1 CO1
b. Explain the buildings block of the program and also discuss the types of 10 L2 CO1
errors.
OR
Q.2 a. Discuss various categories of operators in python. Find and explain 10 L2 CO1
stepwise solution of the following expressions.
i) x = 1 + 2* * 3/4 *5
ii) x = 1 + 2* 3/4.0 – 5
Module – 2
Q.3 a. Illustrate chained and Nested conditional execution in python using 10 L3 CO2
flowchart and program.
b. Discuss the math function and type conversion with an example. 10 L3 CO2
OR
Q.4 a. Define function definition. Illustrate the adding new functions with an 10 L3 CO2
example. Write a program using function to find smallest number in the
given values.
b. Illustrate alternative execution and catching exceptions using try and except 10 L3 CO2
with an example code.
Module – 3
Q.5 a. Outline while loop, break statement and continue statement is python with 10 L3 CO3
an example.
b. Illustrate string slice and len function in string with example code and 10 L2 CO3
syntax.
OR
Q.6 a. With flow diagram and program, explain the concept of for loop statement. 10 L3 CO3
Write a program to find the largest values in a list or sequence.
b. Explain in detail about string comparison and string concatenation. 10 L2 CO3
Module – 4
Q.7 a. Discuss about the file reading and writing operations with python code. 10 L3 CO4
b. Illustrate character matching in regular expression with python code. 10 L3 CO4
1 of 2
BMT306C
OR
Q.8 a. Explain about the searching through a file with example. 10 L3 CO4
b. Explain about extracting data using regular expressions in brief with an 10 L3 CO4
example.
Module – 5
Q.9 a. Discuss about list slices and deleting elements from list with an example. 10 L2 CO4
b. Define python tuple. With a program explain the concept of accessing 10 L2 CO4
values in tuple and detecting tuple element.
OR
Q.10 a. Name the operations that performance on a list and outline any four with an 10 L2 CO4
example.
b. Define dictionary in python. Do the following operations on dictionaries. 10 L2 CO4
i) Initialize two dictionaries with key and value pairs
ii) Compare two dictionaries with master key list and printing missing
keys.
*****
2 of 2