0% found this document useful (0 votes)
50 views

Python Prev Yr

Python questions

Uploaded by

Shreya Singh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
50 views

Python Prev Yr

Python questions

Uploaded by

Shreya Singh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 10
For More Question Papers Visit - www.pediawikiblog.com ISCS66s Sixth Semester B.E. Degree Examination, Dec.2018/" Python Application Programming 1/2 Time: 3 hrs. Max. Marks: 80 Note: Answer any FIVE full questions, choosing one full question from each module. Module-1 1a. Explain the following : i) Skills necessary for a programmer ii) Interactive mode iii) Short circuit evaluation of expression iv) Modulus operator (04 Marks) b. Mention three types of errors encountered in python programs. Explain the basic building block of python with an example python program to display format number (Fy = 2°" + 1) for a ‘n’ value promoted by the users (08 Marks) c. Describe python language support for arithmetic operators, Write a python programs to calculate student result based on 2 exam, 1 sport event and 3 activities conducted in a college with weightage of the activity = 20% and sports = 20% for 50 marks. (04 Marks) OR 2 a. List and give syntax of all python supported conditional statements along with its usage with an example program to check whether given number is positive or negative or zero. (08 Marks) b, Differentiate between argument and paraineter. Illustrate the flow of execution of a python function with an example program to convert given Celsius to Fahrenheit temperature. (08 Marks) Module-2 3 a. Explain while and for loop write a program to generate Fibonacci series up to the given limit by defining FIBONACCI (n) function. (08 Marks) b. Mention the advantages of continue statement. Write a program to compute only even numbers sum within the given natural number using continue statement. (08 Marks) OR 4 a. Define a string. How it can be traversed though using looping statement? Write a python program to display presence of given substring in main string. (08 Marks) b. How computational fault or computational errors are handled in python? Show it with an example python program to copy all lines beginning with vowels from FROM.text file to VOWELTEXT text file retaining other lines. (08 Marks) Module-3 5 a. Describe any two list opearations and list methods. Write a python program to accept ‘n’ numbers from user, find sum all even numbers and product of all odd numbers in entered list (08 Marks) b. List merits of dictionary over list. Write a python program to accept USN and marks obtained, find maximum, minimum and students USN who have scored in the range 100-85, 85-75, 75-60 and below 60 marks separately. (08 Marks) For More Question Papers Visit - www.pediawikiblog.com For More Question Papers Visit - www.pediawikiblog.com Compare and contrast tuples with lists. Explain the following operations in tuples i) Sum of two tuples ii) Slicing operators iii) Compression of two tuples iv) Assignments to variables. (08 Marks) Explain extracting data using regular expressions. Implement a python program to find for lines having *@’ sign between characters in a read text file. (08 Marks) Module-4 How class can be instantiated in python? Write a python program to express instances as return values to define a class RECTANGLE with members width, height, corner_x, corner_y and member function : to find centre, area and perimeter of a rectangle. (08 Marks) Explain init and str method with an example python program. (08 Marks) OR Define polymorphism. Demonstrate polymorphism with function to find histogram to count the numbers of times each letters appears in a word and in sentence. (08 Marks) What is a pure function? Write a python program to find duration of event if start and end time is given by defining class TIME. (08 Marks) Module-5 Explain any 2 socket functions, Explain support for parsing HTML using regular expression with an example program. (08 Marks) Describe a support of security mechanism employed in Internet application with support of API usage with an example program to get four strings and put them in “hidden.PY”. (08 Marks) OR Write a note on XML. Design python program to retrieve a node present in XML tree. (08 Marks) Brief on structured Query language, with suitable python program explain functions involved in creation of database table in python. (08 Marks) For More Question Papers Visit - www.pediawikiblog.com For More Question Papers Visit - www.pediawikiblog.com 15CS664 Sixth Semester B.E. Degree Examination, Dec.2019/Jan.2020 Python Application Programming Time: 3 hrs. Max. Marks: 80 Note: Answer any FIVE full questions, choosing ONE full question from each module. Module-1 1a. Explain the salient features of python. (05 Marks) b. Write a python program to calculate the area of square, rectangle and circle. Print the results. Take input from user. (0S Marks) c. What are user defined functions? How can we pass parameters in user defined functions? Explain with suitable example. OR 2 a. Explain the concept of conditional execution alternate execution and chained conditions with suitable examples. (06 Marks) b. Write a python program to create a user defined function to find maximum and minimum letter in string. Also find the length the string without using inbuilt function. (05 Marks) c. Explain the concept of type conversion functions and math functions in python with examples, (05 Marks) Mod 2 3 a. Explain the working of while loop in python with suitable example. (0S Marks) b. Write a python program to demonstrate counting, summing and average of elements using loops. (05 Marks) c, What is a string? Write a python program to demonstrate traversal through a string with a loop. Also explain the concept of string slicing. (06 Marks) OR 4 a. Withsyntax and example code, explain the working of definite loop in python. (08 Marks) b. Write a python program to concatenate and compare two strings. Read the strings from user. (05 Marks) ¢. Explain fileopen, fileclose, fileread and filewrite concepts in python with example. (06 Marks) Module-3 . What is a list? Explain the concept of list slicing and list traversing with example. (05 Marks) Ss a b. Explain the concept of comparing tuples. Describe the working of sort function with python code. (06 Marks) c. Write a python program to search for lines that start with ‘F? followed by 2 characters, followed by ‘m:” (05 Marks) OR 6 a. What is dictionary? How is it different from list? Write a python program to count occurrence of characters in a string and print the count, (06 Marks) b. With an example program, illustrate how to pass function arguments to list. (05 Marks) ¢. Write a python program to search lines that start with *X’ followed by any non whitespace characters, followed by *:’ ending with number. Display the sum of all these number. (05 Marks) For More Question Papers Visit - www.pediawikiblog.com 10 For More Question Papers Visit - www.pediawikiblog.com Module-4 Define class and object? What are programmer defined types? Explain with example. (05 Marks) Illustrate the concept of pure function with python code. (05 Marks) What is the difference between method and function? Explain the working of init method with suitable code. (06 Marks) Define attribute? With the help of python code, explain how functions return instance values, (06 Marks) Explain the concept of modifier with python code. (05 Marks) What is type based dispatch? Illustrate with python example. (05 Marks) Module-5 Define socket? Writ a python program that makes a connection to a webserver and follows the rules of HTTP protocol to request a plain test document and display what server sends back. (06 Marks) What is XML? How is it used is python? Explain parsing of XML with example. (05 Marks) Define cursor? Explain connect, execute and close command of databases with suitable example. (OS Marks) OR Write a python code to read the file from web using urelib and retrieve the data of the file. Also compute the frequency of each word in the file. (06 Marks) What is JSON? Illustrate the concept of parsing JSON python code. (05 Marks) Explain the concept of using JOIN to retrieve data in python. (05 Marks) For More Question Papers Visit - www.pediawikiblog.com 15CS664 Sixth Semester B.E. Degree Examination, June/July 2019 Python Application Programming Time: 3 hrs. Max. Marks: 80 Note: Answer any FIVE full questions, choosing ONE full question from each module. b. b. Module-1 List the features of Python Programming Language (at least FIVE). (05 Marks) What is the role of'a programmer? List two skills required to be a programmer. (05 Marks) Explain the chained and nested conditional execution statements along with syntax and flow chart (06 Marks) OR What are Python words and sentences? Explain with an example for each (04 Marks) Differentiate compiler and interpreter (04 Marks) Write python programs to i) Find largest of three numbers. ii) Check whether the given year is leap vear or not with functions. (08 Marks) Module-2 With syntax, explain the finite and infinite looping constructs in python. What is the need for break and continue statements. (08 Marks) Write a Python program to generate and print prime numbers between 2 to 50. (04 Marks) What are String slices? Explain the slicing operator in Python with examples. (04 Marks) OR Write a Python program to count the number of occurrences ofa given word ina file. (06 Marks) Write a Python function that takes decimal number as input and convert that to binary equivalent and return the same. (04 Marks) List any six methods associated with strings and explain each of them with an example. (06 Marks) jodul What are the ways of traversing a list? Explain with an example for each. (04 Marks) Differentiate Pop and Remove methods on lists, How to delete more than one element from a list (06 Marks) Write a Python program that accepts a sentences and build dictionary with LETTERS DIGITS , UPPER CASE , LOWER CASE as key values and their count in the sentences as valugs, Ex : Sentence = “VTU@123.¢-Leamin d= {SLETTERS® : 12, °DIGITS” : 3, “UPPER CASE”: 4. “LOWER CASE” : 8} (06 Marks) OR Compare and contrast lists and tuples. (04 Marks) Write a program to check the validity of'a password read by users. The following criteria should be used to check the validity. Password should have atleast 1) One lower case letter ii) One digit iii) One upper case letter iv) One special character from [S#@ !] Vv) Six character For More Question Papers Visit - www.pediawikiblog.com 10 b. b a Demonstrate i) how a dictionary items can be represented as a list of tuples. ii) How tuples can be used as keys in dictionaries? (04 Marks) Module. What is a Class? How to define a class in Python? How to instantiate a class and how the class members are accessed? (04 Marks) Di flerentiate class variables and instance variables. (02 Marks) Write a Python program that uses datetime module within a class, takes a birthday as input and prints the age and the number of days . hours, minutes and seconds until the next birthday (10 Marks) OR Write a 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, Add a method reflex_x to class point, which returns a new point. Which is the reflection of the point about the x — axis, Ex : point . 10) > reflex_y retums point (5, -10). (06 Marks) Differentiate between simple, multiple and multi — level inheritance. (06 Marks) Write a program that has a class P Inherit ac Student from Person which also has aclass MarksAttendance. Assume the attributes for Person class as ; USN, Name. dob, gender. Attributes for Student class as : Class, branch , year, MA. Attributes for MarksAttendance * Marks, Attandance Create a student S = Student (“1 ABL6CS00S” |“) *T8-1-90" “M", 85 , 98) and display the details of the student (04 Marks) jodule-5 Demonstrate with the help of Python construct 1) how to retrieve an image over HTTP. 11) how to retrieve web pages with urllib (08 Marks) Compare and contrast the JavaScript object Notation (ISON) and XML. (04 Marks) What is Service ~ Oriented Architecture? List the advantages of the same, (04 Marks) OR Write a Python program that retrieve an user’s Twitter friends , Parse the retumed JSON and »me of the information about the friends. (08 Marks) simple spidering program that will go through Twitter accounts and build a database of them. (08 Marks) Time: a, For More Question Papers Visit - www.pediawikiblog.com ee P a 15CS664 Sixth Semester B.E. Degree Examination, June/July 2018 Python Application Programming 3 hrs Max. Marks: 80 Answer any FIVE full questions, choosing one full question from each module. odul the rules to declare @ variable in Phython, Demonstrate atleast three different types of variable uses with an example program (05 Marks) Explain the rules of precedence used by Phython to evaluate an expression. (05 Marks) Write a Phython program to find the best of two test average marks out of three test's marks accepted from the user. (06 Marks) oR iow Phython handles the exceptions? Explain with an example progrant (0S Marks} Write a single user defined function named *Solve* that.retutns the Remainder and Quotient on division of two numbers accepted from the user. Print the- Remainder and Quotient ately on the console, (06 Niarks) Predict the output and justify your answer : (i) -11%9 (li) 7.7//7 (iii) (200-70)*10/5 (iv) not “False” (vy 5#1492 (05 Marks) Module Demonstrate the use of break and continue Keywords in looping structures using a snippet code. (06 Marks) Explain string slicing in Python. Show with examples (04 Marks) 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 List and explain any four built in string manipulation functions supported by Python. (06 Marks) Write the Python cdde-to display the last six characters of the string “Make hay while the sun shines” 10,the console. (03 Marks) Write a Pytho program to accept a file name from the user: (i) / Display the first N-lines of the file. (ii) Findthe frequency of occurrence of the word accepted from the user in the file. 7 ks) Module-3 What are lists? Lists are mutable, Justify the statement with examples. (05 Marks) How tuples are created in Python? Explain different ways of accessing and creating them. (05 Marks) Write a Pytho program to read all the lines in a file accepted from the user and print all email addresses contained in it. Assume the email addresses contain only non-white space characters. (06 Marks) For More Question Papers Visit - www.pediawikiblog.com OR Implement a Python program using Lists to store and display the average of N int accepted from the user. (05 Marks) b. Explain dictionaries. Demonstrate with a Pyuton program (05 Marks) ¢. Write a Pytho program to search for lines that start with the word ‘From’ and a character followed by a two digit number between G0 and 99 followed by“ Print the number if it is greater than zero. Assume any input file (06 Marks) 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 (i) (iii) setMarks io assign marks to the student (OmMarks) b. Using datetime nodule write a program that gets the current date and prints.the day of the week, (04 Marks) ©. What are polymorphic functions? Explain with a snippet code (08 Marks) OR What does the keyword self in Python mean? Explain with ab esainple. (05 Marks) Show using a Python code how_ init_method is invoked When an object is initiated, F-xplain its working (6 Marks) ¢. Explain _ str_ method with a Pytho program (08 Marks) Module. a. What is socket? Explain how socket colnectiny can be establi Python code over the TCP/IP connection andthe hitp protocol to ge J to the imeret us ae Web document, (08 Marks) b. Explain the significance of XMIvoyer the web development. iilusirate with an example. (08 Marks) OR Write a note on Gdogle Geocoding web service. Using Python supported libraries, demonstrate with a Snippet code. (08 Marks) b. What is embedded SQL? Explain the importance of SQLite database, Write a Python code to establish a database connection to *LmpDP" and display the total gross salary paid to the employees Working in the ‘Quality Cortre!’ department Assume the employee table has been already created and exist in the “EmpDb". The fields of Employee table are : (EmpID. DeptName, GrossSalary) (08 Marks) For More Question Papers Visit - www.pediawikiblog.com Time: oe op ° For More Question Papers Visit - www.pediawikiblog.com 15CS664 Sixth Semester B.E, Degree Examination, Aug./Sept. 2020 Python Application Programming 2 3 hrs. Max. Marks: 80 Note: Answer any FIVE full questions, choosing ONE full question from each module. Module-1 Explain types of error with examples. (04 Marks) Explain various Names, Keywords and expressions with examples. (06 Marks) Write a python program using try and except, so that your program handles non-numeric input gracefully by printing a message and exiting the program the following shown two execution of the program Enter Hours : 20 Enter Rate: nine Error, please enter numeric input Enter hours : forty Error, please enter numeric input. (06 Marks) OR Explain conditional execution, Alternative execution chained conditionals and nested conditionals with examples. (08 Marks) Explain break and continue statement with examples in python. (04 Marks) Explain with an example what are fruitful functions and void functions. (04 Marks) Module-2 Explain while and for loops with examples. (04 Marks) Write a python program to find the largest value from the given set of accepted values. (06 Marks) Discuss the string handling methods in python with examples. (06 Marks) Write a python program to check whither a given string is palindrome or not. (06 Marks) Explain with example the syntax of read (), write () methods for a file. (04 Marks) Develop a python program for creating a copy an existing file. (06 Marks) Module-3, Explain the difference between a list and a dictionary. (04 Marks) 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 any three letters from the middle iii) Print the letters from 5" letters to the end of the list (04 Marks) Discuss the lists handling functions in python with example (08 Marks) For More Question Papers Visit - www.pediawikiblog.com 10 oP oF s oP For More Question Papers Visit - www.pediawikiblog.com OR Differentiate between list and dictionary. (08 Marks) 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) Explain the need of Regular expressions in python language (04 Marks) le-4 Explain classes and attributes in python language with examples. (05 Marks) Explain pure functions and modifiers with examples. (05 Marks) Write a program that uses class to store the name and marks of students. Use list to store the marks in three subjects. (06 Marks) OR Explain initialization method with example. (04 Marks) Write a class Rectangle that has attributes length and breadth and a method area which returns the area of the rectangle. (06 Marks) What is operator overloading” Write phython code to overload “ by providing the methods __ add_ —" and * * “operator sub__and__ mul__. (06 Marks) Module-5 Write a python code for retrieving the romeo.txt file from the web and compute the frequency of each word in the file. (06 Marks) Write a note on XML. (05 Marks) Explain with a neat diagram of Service Oriented Architecture. (05 Marks) OR Describe creation of database table using database cursor architecture. (08 Marks) Write a python code for creating employee database, inserting records and selecting the employees working in the company. (08 Marks) For More Question Papers Visit - www.pediawikiblog.com

You might also like