Module1: Question Bank: Syllabus: Why Should You Learn To Write Programs, Variables, Expressions and Statements
Module1: Question Bank: Syllabus: Why Should You Learn To Write Programs, Variables, Expressions and Statements
Module1: Question Bank: Syllabus: Why Should You Learn To Write Programs, Variables, Expressions and Statements
Syllabus: Why should you learn to write programs, Variables, expressions and statements,
Conditional execution, Functions?
Part A: Theory
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
Part B: Programs
1. Write a program that uses input to prompt a user for their name and then welcomes them.
2. Write a program to prompt the user for hours and rate per hour to compute gross pay.
3. 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 :
4. To find the simple interest for a given value P,T and R. The program must take the input from the
user.
5. To read two integers and find the sum , diff , mult and div .
6. To check whether the number is positive using simple if .
7. To check whether the given number is even or odd using simple if else.
8. 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.
12. Explain the following methods of python regular expression library with programming examples.
1. re.match()
2. re.search()
3. re.findall()
4. 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])
Additional Questions
1.Create a student database using dictionary. Read rollnumber, name and mark in
computer programming. Use rollnumber as key and the other data must be stored as
list.List the students details in the order of roll number. Read a roll number and display
the corresponding student details.Delete a particular student details after reading a roll
number.
2.Read a list of numbers and print the count of each element in the list in the order.
3.Read a string and print the number of occurrence of vowels in the string.
4.Empno, name and basic pay of ‘n’ employees are stored in a dictionary. Use empno as
the key. Read an empno and update the basic pay of that employee.
5.In the above program display the name and basic pay of all the employees in the order
of name.
6.Read an octal number( as string) and convert into binary using a dictionary.
7. Write a python program to create a dictionary of roll numbers and names of five
students. Display the content of the dictionary in the alphabetical order of names.(
University Question)
8.A bookshop details contains the Title of the book and Number of copies of each title. As
books are added to the shop, the number of copies to each should increase and as books
are sold, the number of copies in each should decrease. Implement this scenario using
dictionary data type in Python. (University Question)
9.Read a list of marks(out of 20).Count the three category of students fail(f), pass(p),
firstclass(fc).
10.Read a string and find the characters which occurred most, also print their count.
12. Program to count the number of occurrence(frequency) of each letters in a given string(
histogram
13. Program to read name and phn numbers of ‘n’ customers and print the list in sorted order
of names
14.Create a class car with attributes model, year and price and a method cost() for
displaying the prize. Create two instance of the class and call the method for each
instance
15.Create a class student with attribute name and roll number and a method dataprint()
for displaying the same. Create two instance of the class and call the method for each
instance
16.Create a class Person with attributes name, age salary and a method display() for
showing the details. Create two instances of the class and call the method for each
instance.
17.Create a class Rectangle with attributes length and breadth and method area() for
calculating the area of the rectangle. Create two instances of the class and call the method
for each instance.
18.Create a class car with attributes model, year and price and a method cost() for
displaying the prize. Create two instance of the class and call the method for each
instance.
19.Create a class student with attribute name and roll number and a method dataprint()
for displaying the same. Create two instance of the class and call the method for each
instance.
20.Create a class Person with attributes name, age, salary and a method display() for
showing the details. Create two instances of the class and call the method for each
instance.
21.Create a class Employee with attributes name, age and salary and a method
printdetails() for displaying the same. Create two instances of the class and call the
method for each instance.
Question Bank Module 5
1. What is Socket? Explain the Socket Module. Explain with syntax how sockets are
created in Python using Socket address , Socket types and Port Number.
2. Explain Server Sockets Methods , Client Sockets and General Socket Methods.
3. What is Client and Server? Write a Python program to create client and server.
4. What is Port? List out Well Known Ports and their applications and protocol.
5. Define WebScraping
6. Write a short note on the following :
a. Socket
b. Port
c. HTTP
d. WebBrowser
7. Write and Explain the Program of Simple Web Browser.
8. Write and explain the program to retrieve an image over HTTP.
9. Write and Explain the python program to retrieve web pages with urllib.
10. Write a python program to retrieve the data from the text file (containing English
sentences) and compute the frequency of each word.
11. Describe Parsing HTML and Scraping the web.
12. Write and Explain Python program to parse HTML using regular expressions.
13. Write and Explain Python Program to parse HTML using Beutifulsoup Library.
14. Write and Explain Python Program to read binary files using urllib.
15. What is XML? What are the applications of XML? Differentiate between XML and
HTML.
16. What are the features and advantages of XML?
17. Give example for XML and Write a Tree representation of XML.
18. With example explain the Tree Structure of XML.
19. Write and Explain Python Program to parse XML.
20. What is JSON? Explain with Example.
21. Write and Explain Python Program to parse JSON.
22. Write a brief note on Application Programming Interfaces (API).
23. With example explain SOA.
24. 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.
25. Explain how security is achieved in API usage.
26. Define Data, Database , Table , Rows and Columns.
27. Write and Explain Python Program to create a Database Table.
28. Explain what is Database Cursor.
29. Explain spidering a twitter.
30. Write and Explain Python Program to spidering twitter to a database with single
table.
31. Explain what is Data Modeling.
32. 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..