100% found this document useful (1 vote)
435 views

Application Development Using Python: Dept. of CSE, DSATM 2020-21 1

The document contains questions related to Python programming concepts and applications. It covers topics like: 1. Data types, variables, operators, expressions, functions and modules in Python. Example programs are provided to illustrate basic concepts like data type display, calculations etc. 2. Python control flow statements like conditional statements and their usage with examples. Exception handling and error types encountered in Python programs. 3. Python collection data types - lists, tuples, dictionaries - their properties and operations. Example programs demonstrate list operations, searching/filtering lists, nested dictionaries etc. 4. String operations in Python - slicing, indexing, string manipulation functions and example programs to find longest word in a sentence, display file contents based

Uploaded by

study material
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
435 views

Application Development Using Python: Dept. of CSE, DSATM 2020-21 1

The document contains questions related to Python programming concepts and applications. It covers topics like: 1. Data types, variables, operators, expressions, functions and modules in Python. Example programs are provided to illustrate basic concepts like data type display, calculations etc. 2. Python control flow statements like conditional statements and their usage with examples. Exception handling and error types encountered in Python programs. 3. Python collection data types - lists, tuples, dictionaries - their properties and operations. Example programs demonstrate list operations, searching/filtering lists, nested dictionaries etc. 4. String operations in Python - slicing, indexing, string manipulation functions and example programs to find longest word in a sentence, display file contents based

Uploaded by

study material
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Application Development using Python

DAYANANDA SAGAR ACADEMY OF TECHNOLOGY AND MANAGEMENT


DEPARTMENT OF COMPUTER SCIENCE
QUESTION BANK
Subject: Application Development using Python
Subject Code: 18CS55

Module-I
1. Illustrate a program to display different data types using variables and literal constants. (RS)
2. Show how an input and output function is performed in pythonwith an example. (RS)
3. Explain in detail about the various operators in python with suitable examples. (RS)
4. How the area of circle is calculated explain with an example. (RS)
5. Describe a program to calculate student result based on twoexaminations, one sports event and three
activities conducted. Theweightage of the activity = 30%, sports =20%, and examination=50%
(RS)
6. Demonstrate the various expressions in python with suitableexamples. (RS)
7. Write a program to print the digit at ones place and hundredsplace of a number. (RS)
8. Discuss the need and importance of function in python. (RS)
9. Illustrate a program to exchange the value of two variables withtemporary variables. (RS)
10.Analyze the difference between local and global variables. (RS)
11.List the rules to declare variables in python. Demonstrate at least 3 types of variables uses with an
example program. (June/July 2018)(05 Marks)
12.Explain the rules of precedence used in python to evaluate the expression
(June/July 2018) (05 Marks)
13. Write a python program to find the best of two test average marks out of three test’s marks accepted
by the user. (June/July 2018) (06 Marks)
14. How python handles the exceptions? Explain with an example program.
(June/July 2018) (05 Marks)
15.Write a single user defined function named ‘solve’ that returns the remainder and quotient on
division of two numbers accepted by the user. Print the remainder and quotient separately

(June/July 2018) (06 Marks)

16.Predict the output and justify your answer: (i) -11%9 (ii) 7.7//7 (iii) (200-70)*10/5
(iv) not ‘False’(v) 5*1**2 (June/July 2018)(05 Marks)
17.Explain the following: i. skills necessary for a programmer ii. Interactive mode. iii. Short circuit
evaluation of an expression. iv Modulus operator. (Dec 2018/Jan 2019)(04 Marks)
18.Mention 3 types of errors encountered in python programs. Explain the basic building block of
python with an example python program to display format number (Fn=22n+1) for a n value
prompted by users. (Dec 2018/Jan 2019)(08 Marks)

Dept. of CSE, DSATM 2020-21 1


Application Development using Python

19.Describe python language support for arithmetic operators. Write a python programs to calculate
student result based 2 exam, 1 sport event and 3 activities conducted in the college with weightage of
the activity =20% and sports = 20% for 50 marks. (Dec 2018/Jan 2019) (04 Marks)
20.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.
(Dec 2018/Jan 2019)(08 Marks)
21.Differentiate between argument and parameter. Illustrate the flow of execution of a python function
with an example program to convert give Celsius to Fahrenheit temperature.
(Dec 2018/Jan 2019)(08 Marks)
22. Explain the following
i)skills necessary for a programmer
ii)Interactive mode
iii)short circuit evaluation of expression
iv)Modulus operator (Dec 2018/Jan 2019) (04 Marks)
23. List the features of python programming language(at least five)(June/July 2019) (05 Marks)
24. What is the role of programmer? List two skills required to be a programmer.
(June/July 2019) (05 Marks)
25.Explain the chained and nested conditional execution statement along with syntax and chart.
(June/July 2019) (06 Marks)

26. What are python words and sentences? Explain with an example for each.

(June/July 2019) (04 Marks)

27. Differentiate compiler and interpreter.(June/July 2019) (04 Marks)

28. Write python programs to i) Find largest of three numbers ii)check whether the given year is leap
year or not with functions.(June/July 2019) (08 Marks)

Module-II

1. Explain Mutable and Immutable Data Types with example.


2. What is the difference between copy.copy() and copy.deepcopy()? Explain with examples.
3. How can you get the tuple form of a list value? How can you get the list form of a tuple value?
Explain with examples.
4. What are the operators for list concatenation and list replication? Explain with examples.
5. What is the difference between the append() and insert() list methods? Explain with examples.
6. Explain two ways to remove values from a list with examples? Explain a few ways that list values
are similar to string values.
Dept. of CSE, DSATM 2020-21 2
Application Development using Python

7. Discuss the usage of The keys(), values(), items(),get(0 and setdefault() Methods in Dictionaries with
example.
8. What module and function can be used to “pretty print” dictionary values? Explain with examples.
9. Write a python program that uses a dictionary that contains other dictionaries.
10. Explain Dictionaries. Demonstrate with python Program. (June/July 2018)(05 Marks)
11. What are the built-in functions that are used in Tuple?
12. Explain what is range() function and how it is used in lists?
13. Write python program to search for lines that start with the word ‘From’ and a character followed by
a two digit number from 00 and 99 followed by ‘:’ Print the number if it is greater than zero. Assume
the input file. (June/July 2018)(06 Marks)
14. Describe any 2 List Operations and List methods. Write a python program to accept ‘n’ numbers
from user, find sum of all even numbers and product of odd numbers entered in the list
(Dec 2018/Jan 2019)(08 Marks)
15. List merits of Dictionaries over the List. Write a python program to accept USN and marks obtained,
find Maximum and Minimum and Students USN who have scored in the range 100-85, 85-75, 75-60
and below 60 marks separately. (Dec 2018/Jan 2019)(08 Marks)
16. Formulate with an example program to find out all the values in the list that are greater than the
specified number.
17. Compare and contrast tuples and lists. Explain the following operations intuples.
i. Sum of two tuples.
ii. Slicing operators.
iii. Comparison of 2 tuples
iv. Assignments to variables (Dec 2018/Jan 2019)(08 Marks)

18. Explain string slicing in python. Show with an example.(June/July 2018) (04 Marks)
19. Write a python program to accept a sentence from the user and display the longest word of that
sentence along with its length (June/July 2018) (06 Marks)
20. List and explain the string manipulation functions supported in python.
(June/July 2018) (06 Marks)
21. Write the python code to display the last six characters of the string ‘Many hay while the sun shines’
to the console. (June/July 2018) (03 Marks)
22. Write a python program to accept a file name from a user:
a) Display the first N-lines of the file
b) Find the frequency of occurrences of the word accepted from the user in the file.

Dept. of CSE, DSATM 2020-21 3


Application Development using Python

(June/July 2018) (07 Marks)

23. What are escape characters? (RS)


24. What do the \n and \t escape characters represent? (RS)
25. 17. How can you put a \ backslash character in a string? (RS)
18. The string value "Howl's Moving Castle" is a valid string. Why isn’t it
a problem that the single quote character in the word Howl's isn’t escaped? (RS)

19. If you don’t want to put \n in your string, how can you write a string
with newlines in it? (RS)

20. What do the following expressions evaluate to?


• 'Hello world!'[1]
• 'Hello world!'[0:5]
• 'Hello world!'[:5]
• 'Hello world!'[3:] (RS)
21. What do the following expressions evaluate to?
• 'Hello'.upper()
• 'Hello'.upper().isupper()
• 'Hello'.upper().lower() (RS)
22. What do the following expressions evaluate to?
• 'Remember, remember, the fifth of November.'.split()
• '-'.join('There can be only one.'.split()) (RS)
23. What string methods can you use to right-justify, left-justify, and center
a string? (RS)
24. How can you trim whitespace characters from the beginning or end of
a string? (RS)
25.Write a function named printTable() that takes a list of lists of strings
and displays it in a well-organized table with each column right-justified (RS)
input: tableData = [['apples', 'oranges', 'cherries', 'banana'],
['Alice', 'Bob', 'Carol', 'David'],
['dogs', 'cats', 'moose', 'goose']]

Output: apples Alice dogs


oranges Bob cats
cherries Carol moose
banana David goose

Module-III

26. What is the function that creates Regex objects? (RS)

27. Why are raw strings often used when creating Regex objects?

Dept. of CSE, DSATM 2020-21 4


Application Development using Python

28. What does the search() method return?


29. How do you get the actual strings that match the pattern from a Match
object?
30. In the regex created from r'(\d\d\d)-(\d\d\d-\d\d\d\d)', what does group 0 cover? Group 1? Group 2?
31. Parentheses and periods have specific meanings in regular expression syntax. How would you
specify that you want a regex to match actual parentheses and period characters?
32. The findall() method returns a list of strings or a list of tuples of strings. What makes it return one or
the other?
33. What does the | character signify in regular expressions?
34. What two things does the ? character signify in regular expressions?
35. What is the difference between the + and * characters in regular expressions?
36. What is the difference between {3} and {3,5} in regular expressions?
37. What do the \d, \w, and \s shorthand character classes signify in regular expressions?
38. What do the \D, \W, and \S shorthand character classes signify in regular expressions?
39. How do you make a regular expression case-insensitive?
40. What does the . character normally match? What does it match if re.DOTALL is passed as the
second argument to re.compile()?
41. What is the difference between .* and .*??
42. What is the character class syntax to match all numbers and lowercase letters?
43. If numRegex = re.compile(r'\d+'), what will numRegex.sub('X', '12 drummers,
pipers, five rings, 3 hens') return?
44. What does passing re.VERBOSE as the second argument to re.compile() allow you to do?
45. How would you write a regex that matches a number with commas for every three digits? It must
match the following:
• '42'
• '1,234'
• '6,368,745'
but not the following:
• '12,34,567' (which has only two digits between the commas)
• '1234' (which lacks commas)
46. Write a python program to Phone Number and Email Address Extractor that do following functions
a) Create two regexes, one for matching phone numbers and the other for matching email
addresses.
b) Find All Matches in the Clipboard Text
c) Join the Matches into a String for the Clipboard
47. a. explain with python code to perform Greedy and Non-greedy Matching.(4 marks)
48. b. Explain the usage of Search() and Findall() method with python code. (3 marks)
49. How would you write a regex that matches the full name of someone whose last name is Nakamoto?
You can assume that the first name that comes before it will always be one word that
begins with a capital letter.
50. The regex must match the following:
• 'Satoshi Nakamoto'
• 'Alice Nakamoto'

Dept. of CSE, DSATM 2020-21 5


Application Development using Python

• 'RoboCop Nakamoto'
but not the following:
• 'satoshi Nakamoto' (where the first name is not capitalized)
• 'Mr. Nakamoto' (where the preceding word has a nonletter character)
• 'Nakamoto' (which has no first name)
• 'Satoshi nakamoto' (where Nakamoto is not capitalized)
51. How would you write a regex that matches a sentence where the first word is either Alice, Bob, or
Carol; the second word is either eats, pets, or throws; the third word is apples, cats, or baseballs;
and the sentence ends with a period? This regex should be case-insensitive. It must match the
following:
• 'Alice eats apples.'
• 'Bob pets cats.'
• 'Carol throws baseballs.'
• 'Alice throws Apples.'
• 'BOB EATS CATS.'
but not the following:
• 'RoboCop eats apples.'
• 'ALICE THROWS FOOTBALLS.'
• 'Carol eats 7 cats.'

52. What is a relative path relative to?


53. What does an absolute path start with?
54. What do the os.getcwd() and os.chdir() functions do?
55. What are the . and .. folders?
56. In C:\bacon\eggs\spam.txt, which part is the dir name, and which part is
the base name?
57. Write python program to search for lines that start with the word ‘From’ and a character followed by
a two digit number from 00 and 99 followed by ‘:’ Print the number if it is greater than zero. Assume
the input file. (June/July 2018)(06 Marks)
58. Describe any 2 List Operations and List methods. Write a python program to accept ‘n’ numbers
from user, find sum of all even numbers and product of odd numbers entered in the list
(Dec 2018/Jan 2019)(08 Marks)
Module-IV

1. Formulate with an example program to find out all the values in the list that are greater than the
specified number. (RS)
2. Write a program to find out the square root of two numbers. (RS)
3. Explain the concept of OOP. Give an overview of OOP terminology. (RS)
4. Create Class in Python with an example. (RS)
5. Define function "IsInstance" with example. (RS)

Dept. of CSE, DSATM 2020-21 6


Application Development using Python

6. Define Class Object and Class book and how to write a method in Class book. (RS)
7. How to retrieve an image over HTTP and also how to retrieve web pages with urllib. (RS)
8. How to read binary files using urllib. (RS)
9. Create a student class and initialize it with name and roll number. Design methods to:
i. Display_to display all information of the students
ii. setAge_to assign age to student.
iii. setMarks_to assign marks to the student. (June/July 2018) (07 Marks)
10. Using datetime module write a program that gets current date and print the day of the week.
(June/July 2018) (04 Marks)
11. What are polymorphic functions? Explain with a snippet code. (June/July 2018)(05 Marks)
12. What does the keyword self in python mean? Explain with an example.
(June/July 2018)(05 Marks)
13. Show using a python code how _init_ method is invoked when an object is initiated. Explain its
working. (June/July 2018) (06 Marks)
14. Explain _str_ method with a python program. (June/July 2018) (05 Marks)
15. 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
functions : to find center, area and perimeter of a rectangle. (Dec 2018/Jan 2019)(08 Marks)
16. Explain init and str method with an example python program. (Dec 2018/Jan 2019)(08 Marks)
17. Define polymorphism. Demonstrate polymorphism with function to find histogram to count the
numbers of times each letters appears in a word and a sentence.(Dec 2018/Jan 2019)(08 Marks)
18. 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. (Dec 2018/Jan 2019)(08 Marks)

Module-V

1. How to create a database table using Python. (RS)


2. Write a short note on spidering Twitter using a database. (RS)
3. How to use JOIN to retrieve data using Python. (RS)
4. How
• Constraints are set in database tables.
Dept. of CSE, DSATM 2020-21 7
Application Development using Python

• Retrieve and/or insert a record.


• Storing the friend relationship (RS)
5. Write a program to multiply two matrices in Python programming. (RS)
6. Write a Python Event driven Program for file operations Press 1: to open file in read mode 2: open
the file in write mode 3: current position of the file pointer #4: Reposition the pointer at the
beginning 5: exit. (RS)
7. Write a program to insert a number in a sorted array. (RS)
8. Write a Python Program to read a word and prints the number of letters, vowels and percentage of
vowels in the word using dictionary. (RS)
9. Write an Object oriented Python program to create two Time objects: currentTime, which contains
the current time; and breadTime, which contains the amount of time it takes for a bread maker to
make bread. Then we'll use addTime to figure out when the bread will be done. Write the printTime
function to display the time when the bread will be done by the bread maker. (RS)
10. Write a program to find the roots of a quadratic equation (RS)
11. Write a Python Program to check whether the given string is palindrome or not using built in string
manipulation methods. (RS)
12. Write a Python Program to check a given sentence is a pangram or not using function/Module.
(RS)
13. What is Socket? Explain how socket connection can be established to the internet using python code
over the TCP/IP connection and the http protocol to get the web document.
(June/July 2018) (08 Marks)
14. Explain the significance of XML over the web development. Illustrate with an example
(June/July 2018) (08 Marks)
15. Write a note on Goggle Geocoding web service. Using python supporteed libraries, demonstarte with
a snippet code (June/July 2018)(08 Marks)
16. What is embedded SQL? Explain the importance of SQLite database. Write a python code to
establish a database connection on ‘EmpDb’ and display the total gross salary paid to the employees
working in the ‘Quality Control’ department.
Assume the employee table has been already created and exist in the ‘EmpDb’. The fields of
Employee table are: (EmpID, DeptName, GrossSalary) (June/July 2018)(08 Marks)

Dept. of CSE, DSATM 2020-21 8


Application Development using Python

17. Explain any 2 socket functions. Explain support for parsing HTML using regular expression with an
example program. (Dec 2018/Jan 2019)(08 Marks)
18. 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 in hidden.PY.
(Dec 2018/Jan 2019)(08 Marks)
19. Write a note on XML. Design python program to retrieve a node present in XML tree.
(Dec 2018/Jan 2019)(08 Marks)
20. Brief on Structured query language, with suitable python program explain functions involved in
creation of database table in python. (Dec 2018/Jan 2019) (08 Marks)
21. Demonstrate with the help of python construct i) how to retrieve an image over HTTP.
(June/July 2019) (08 Marks)
22. Compare and contrast the javascript object notation(JSON) and XML.(June/July 2019) (04 Marks)
23. What is service oriented architecture? List the advantages of the same. (June/July 2019) (04 Marks)
24. Write a python program that retrieve an users twitter friends. Parse the returned JSON and extract
some of the information about the friends. (June/July 2019) (08 Marks)
25. Create a simple spidering program that will go through twitter accounts and build a database of
them. (June/July 2019) (04 Marks)

Dept. of CSE, DSATM 2020-21 9

You might also like