0% found this document useful (0 votes)
42 views7 pages

Question Bank - Pap

The document contains questions related to Python programming. It covers topics like data types, control flow, functions, files, regular expressions, lists, tuples, dictionaries and more. Multiple choice, fill in the blank and coding questions are provided related to these topics.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views7 pages

Question Bank - Pap

The document contains questions related to Python programming. It covers topics like data types, control flow, functions, files, regular expressions, lists, tuples, dictionaries and more. Multiple choice, fill in the blank and coding questions are provided related to these topics.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Channabasaveshwara Institute of Technology

(Affiliated to VTU, Belgaum & Approved by AICTE, New Delhi)


(NAAC Accredited & ISO 9001:2015 Certified Institution)
NH 206 (B.H. Road), Gubbi, Tumkur – 572 216. Karnataka

Question Bank-1
1. a. Discuss with example and diagrams, Why Should you learn to write Programs?
b. Define Program. Differentiate between Compiler and Interpreter. Give Examples.
c. With a neat diagram explain the High level definition of the parts of Hardware Architecture.
Explain the role/Job of Programmer.
2. a. With examples explain the following Six Building blocks of Programs: Input, Output, Sequential
Execution, Conditional Execution, Repeated Execution and Reuse.
b. Explain the following different types of errors: Syntax errors, Semantic errors and Logic Errors.
3. Define the following with example : Values and Types , Variables , Expressions , Keywords ,
Statements , Operators and Operands, Order of Operations , Modulus Operators , String operations
and Comments.
4. Explain how to read the input from the user with example.
5. Explain the following with examples
a. Boolean Expression
b. Logical Operators
c. Conditional Execution : if
d. Alternative Execution: if else
e. Chained Conditionals : if elif else
f. Nested Conditionals : if else if else
g. Catching exception using try and except
h. Short circuit evaluation of logical circuits
6. Explain the following with example
a. Functions
b. Function Call
c. Built in Function
d. Type Conversion Functions
e. Random Numbers
f. Math Functions
g. Adding new Functions
h. Defining and using the new functions
i. Flow of execution
j. Parameter and Arguments
k. Fruitful and void Functions
l. Advantages of Functions
7. Write a program that uses input to prompt a user for their name and then welcomes them.
8. Write a program to prompt the user for hours and rate per hour to compute gross pay.
Subject: Python Application Programming Code: 15CS664
9. Write a program to read the following input from user and display
a. Name :
b. USN :
c. Roll NO:
d. Mobile No:
e. E-Mail id :
f. Percentage of Marks :
10. To find the simple interest for a given value P,T and R. The program must take the input from the
user.
11. To read two integers and find the sum , diff , mult and div .
12. To check whether the number is positive using simple if .
13. To check whether the given number is even or odd using simple if else.
14. Write a program to prompt the user for hours and rate per hour to compute gross pay. Also to give
the employee 1.5 times the hourly rate for hours worked above 40 hours.
15. Define Iteration and Loop. With Syntax and Programming example explain the working and flow
execution of 1. While Loop and 2. For Loop in Python. Explain what are Minimum and Maximum
Loops.
16. Define String? Explain how the strings are accessed , traversed, sliced and why Strings are called
immutable. Explain at least 5 String functions with examples. (concatenation, len, upper, lower, etc).
17. What are Files? Explain with syntax how the following file operations are done in Python :
a. Opening a File (existing)
b. Reading a File (existing)
c. Closing a File
d. Writing a File (existing)
e. Checking a current position
f. Reposition a pointer to the beginning
g. Creating and writing a new file
18. Write a python program to generate first n Fibonacci number and factorial of n using functions
19. Write a python program to count the number of Characters in a given string and hence to display the
characters of string in reverse order.
20. Write a python program to
a. To create two new files f1 and f2
b. To read and display the contents , count the number of lines and find the word whose count is
more in f1 and f2 respectively.
c. To create and display the file f3 which is a combination of f1 and f2.
Channabasaveshwara Institute of Technology
(Affiliated to VTU, Belgaum & Approved by AICTE, New Delhi)
(NAAC Accredited & ISO 9001:2015 Certified Institution)
NH 206 (B.H. Road), Gubbi, Tumkur – 572 216. Karnataka

Question Bank-2
1. What are Lists? Explain with examples the different ways to create a list. Why lists are called
Mutable. Discuss the following List operations and functions with examples :
1. Accessing ,Traversing and Slicing the List Elements 2. + (concatenation) and * (Repetition)
3. append , extend , sort , remove and delete
4. len , sum, min and max
5. split and join
2. Write a program to compute an average : 1) without using list and 2) using list
3. Compare String and List with examples. With example illustrate how the list can be passed as
arguments. What are objects and Aliasing?
4. What are Dictionaries? Explain with examples how the dictionaries are created. Differentiate
between Key and value of the Dictionary element. Mention the properties of Key . Discuss the
following Dictionary operations and functions with examples
1. Accessing , Traversing , Updating , Deleting
2. Traversing a Dictionary using looping
5. With example program illustrate how the Dictionary can be used to count the occurrence of words in
a file.
6. What are Tuples ? Explain with examples how tuples are created. Compare Tuple with list. Discuss
the following Dictionary operations and functions with examples
3. Accessing , Updating , Deleting , Traversing (Iteration) , Comparing
4. len ,(in) membership + (concatenation) and * (Repetition)
5. DSU (Decorate , Sort and UnDecorate ) pattern
7. Discuss the Tuple Assignment with example .Explain how swapping can be done using tuple
assignment. Write a Python program to input two integers a and b , and swap those numbers . Print
both input and swapped numbers.
8. With example explain how dictionary can be converted into tuple.
9. Write python program to find the common word in a given file. Accept the file name from the user.
10. What are Regular Expressions? What are the two types of characters used in regular expression?
Give example. What are the common uses of regular expression?
11. Explain the intention/meaning of the following Regular expressions
1. ^From .* ([0-9][0-9]):
2. ^Details:.*rev=([0-9.]+
3. ^X\S*: ([0-9.]+)
4. ^X\S*: [0-9.]+
5. ^X\S*: [0-9.]+
6. [a-zA-Z0-9]\S+@\S+[a-zA-Z]
7. \S+@\S+
8. ^From:.+@
9. r"([a-zA-Z]+) (\d+)"
10. r"(\w+) World"
11. r'(.*) are (.*?) .*'
Subject: Python Application Programming Code: 15CS664

12. Explain the following methods of python regular expression library with programming examples.
a. re.match()
b. re.search()
c. re.findall()
d. re.split()
13. Explain with example the significance of Escape character in Regular Expression.
14. Briefly describe the methods of regular expression
15. What is list in Python? Demonstrate use of any three methods of list.
16. Give the output of following Python code: l=[(x, y) for x in [1,2,3] for y in [3,1,4] if x != y] print l
17. Give the output of following Python code: str1 = ‘This is Pyhton’
print( "Slice of String : ", str1[1 : 4 : 1] ) print("Slice of String : ", str1[0 : -1 : 2])
18. Is tuple mutable? Demonstrate any two methods of tuple.
19. What is dictionary in Python? Explain with an example
20. What is Lambda function give example.
21. Write a Python program to sum all the items in a list.
22. Write a Python program to get the largest and smallest number from a list.
23. Write a Python program to count the number of strings where the string length is 2 or more and the
first and last character are same from a given list of strings. Sample List : ['abc', 'xyz', 'aba', '1221']
Expected Result : 2
24. Write a Python program to convert a list of characters into a string.
25. Write a Python program to find the index of an item in a specified list.
26. Write a Python program to get the frequency of the elements in a list.
27. Write a Python program to create a list by concatenating a given list which range goes from 1 to n.
Sample list : ['p', 'q'] n =5
Sample Output : ['p1', 'q1', 'p2', 'q2', 'p3', 'q3', 'p4', 'q4', 'p5', 'q5']
28. Write a Python program to convert list to list of dictionaries. Go to the editor Sample lists: ["Black",
"Red", "Maroon", "Yellow"], ["#000000", "#FF0000", "#800000", "#FFFF00"]
Expected Output: [{'color_name': 'Black', 'color_code': '#000000'}, {'color_name': 'Red', 'color_code':
'#FF0000'}, {'color_name': 'Maroon', 'color_code': '#800000'},
{'color_name': 'Yellow', 'color_code': '#FFFF00'}] Click me to see the sample solution
29. Write a Python program to create a list of empty dictionaries.
30. Write a Python script to concatenate following dictionaries to create a new one. Sample Dictionary :
dic1={1:10, 2:20} dic2={3:30, 4:40} dic3={5:50,6:60} Expected Result : {1: 10, 2: 20, 3: 30, 4: 40, 5: 50,
6: 60}
31. Write a Python program to create a tuple with different data types
32. Write a Python program to convert a tuple to a string
33. Write a Python program to convert a list of tuples into a dictionary
34. Write a Python program to convert a tuple to a dictionary.
35. Write a Python program to find the length of a tuple.
Channabasaveshwara Institute of Technology
(Affiliated to VTU, Belgaum & Approved by AICTE, New Delhi)
(NAAC Accredited & ISO 9001:2015 Certified Institution)
NH 206 (B.H. Road), Gubbi, Tumkur – 572 216. Karnataka

Question Bank-3

Subject: Python Application Programming Code: 15CS664

1. Define Class and Object.


2. With syntax and programming example, explain how the class is defined, object is created, and
methods are invoked in Python.
3. With illustration Discuss the use of init method in Python.
4. Why Objects are mutable.
5. Explain the use of copy module in Python.
6. With an example explain how the objects can be modified using functions.
7. Explain the following two types of functions with an example
a. Pure Function
b. Modifiers
8. With help of programming examples explain the difference between Prototype and Planned
Programming Development.
9. Explain with example the following features of object-oriented programming languages
c. Class and Object
d. Data Variables and Methods
e. Encapsulation
f. Inheritance
g. Polymorphism
h. Operator Overloading
i. Operator Overriding
10. What is the difference between functions and methods. With example explain how to transform
functions into methods.
11. Explain with example what are optional arguments.
12. Explain with example what is initialization method. With programming example illustrate the use of
initialization method and self-argument.
13. Write an Object-Oriented Python program to create two Time objects: current Time, which contains
the current time; and bread Time, which contains the amount of time it takes for a bread maker to
make bread. Then we'll use add Time to figure out when the bread will be done. Write the print Time
function to display the time when the bread will be done by the bread maker.
14. Design a Python program as described below:
a. Create a class called Palindrome.
b. In your Palindrome class, create a method called reverse() which takes a string argument. Your
method should return the reverse of the argument as a string.
b. Create a second method in Palindrome called isPalindrome() which takes a string argument. This
method should return True if the argument is a palindrome and False otherwise.
b. Write some code to test your new Palindrome class and print out results of your testing to the
user. Give some consideration to what sort of strings you might want to use for your testing.
15. What is Socket? Explain the Socket Module. Explain with syntax how sockets are created in Python
using Socket address , Socket types and Port Number.
16. Explain Server Sockets Methods , Client Sockets and General Socket Methods.
17. What is Client and Server? Write a Python program to create client and server.
18. What is Port? List out Well Known Ports and their applications and protocol.
19. Define WebScraping
20. Write a short note on the following :
a. Socket
b. Port
c. HTTP
d. WebBrowser
21. Write and Explain the Program of Simple Web Browser.
22. Write and explain the program to retrieve an image over HTTP.
23. Write and Explain the python program to retrieve web pages with urllib.
24. Write a python program to retrieve the data from the text file (containing English sentences) and
compute the frequency of each word.
25. Describe Parsing HTML and Scraping the web.
26. Write and Explain Python program to parse HTML using regular expressions.
27. Write and Explain Python Program to parse HTML using Beutifulsoup Library.
28. Write and Explain Python Program to read binary files using urllib.
29. What is XML? What are the applications of XML? Differentiate between XML and HTML.
30. What are the features and advantages of XML?
31. Give example for XML and Write a Tree representation of XML.
32. With example explain the Tree Structure of XML.
33. Write and Explain Python Program to parse XML.
34. What is JSON? Explain with Example.
35. Write and Explain Python Program to parse JSON.
36. Write a brief note on Application Programming Interfaces (API).
37. With example explain SOA.
38. What is Google Geocoding Services ? Write and Explain Python Program to prompt user for a search
string (city) , call the Geocoding API and extracting information from the returned XML.
39. Explain how security is achieved in API usage.
40. Define Data, Database , Table , Rows and Columns.
41. Write and Explain Python Program to create a Database Table.
42. Explain what is Database Cursor.
43. Explain spidering a twitter.
44. Write and Explain Python Program to spidering twitter to a database with single table.
45. Explain what is Data Modeling.
46. Write and Explain Python Program to spidering twitter data into Multiple Tables. Or Write and
Explain Python Program to retrieve data from twitter account /database and to insert a data to a
database with multiple tables.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy