Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
252 views

Python Assignment 2

This document contains an assignment for a Python application development course. It includes 12 multiple choice questions testing students' understanding of Python concepts like strings, lists, dictionaries, tuples, files and regular expressions. Some example questions are to write code to display the last 6 characters of a string, create regexes to extract phone numbers and email addresses, and explain dictionary methods with an example program. The document provides the course outcomes, cognitive levels, marks for each question and which outcomes they test.

Uploaded by

study material
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
252 views

Python Assignment 2

This document contains an assignment for a Python application development course. It includes 12 multiple choice questions testing students' understanding of Python concepts like strings, lists, dictionaries, tuples, files and regular expressions. Some example questions are to write code to display the last 6 characters of a string, create regexes to extract phone numbers and email addresses, and explain dictionary methods with an example program. The document provides the course outcomes, cognitive levels, marks for each question and which outcomes they test.

Uploaded by

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

DAYANANDA SAGAR ACADEMY OF TECHNOLOGY AND MANAGEMENT

(Affiliated to Visvesvaraya Technological University , Belagavi & Approved by AICTE,


New Delhi)
22 Mile, B.M Kaval, Opp. to Art of LivingUdayapura, Kanakapura Road, Bangalore-
560082.
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING.
Accredited by NBA for 3 years(26-7-18 to 30-6-2021),NewDelhi

Odd Semester Session (2020-2021)


ASSIGNMENT-1
Subject: Application Development Using Python Subject Code: 18CS55
Class: V Sem A & B sec
Duration: 1 ½ Hrs Max Marks: 50
Faculty: Anoop G L, Dr. Manjunath D R

Course Outcomes:

Course Outcomes:
CO 1. Examine Python syntax and semantics and be fluent in the use of Python flow
control and functions.
CO 2. Demonstrate proficiency in handling Strings and File Systems.
CO3: Create, run and manipulate Python Programs using core data structures like Lists,
Dictionaries and use Regular Expressions.

Cognitive Level: R- Remember, U-Understand, A- Analyze, Ap-Apply, Cr-Create, E-


Evaluate

Cogni Course
Q. Mark
Question tive Outcom
No. s
Level es

a. Write the python code to display the last six characters of the string
Cr 3 CO2
“Make hay while the sun shines “ to the console. (3M- June 2018)
b. Write a python program to accept a file name from the user. (7M-
June 2018, July 2019)
1
i. Display the first N line of the file.
Cr 07 CO2
ii. Find the frequency of occurrence of the word accepted from the
user in the file.
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
2 Cr 10 CO3
for matching email addresses.
b. Find All Matches in the Clipboard Text
c. Join the Matches into a String for the Clipboard

a. What does the . character normally match? What does it match if


U 5 CO3
re.DOTALL is passed as the second argument to re.compile()?
3
b. Write a Python program to generate and print prime numbers between Cr 5 C01
2 to 50 using Lists.

a. Define a string. How it can be traversed through using looping


4 statement? Write a python program to display presence of given substring Cr 10 CO2
in main string. (8M- Jan 2019, July 2019, Dec/Jan2020)

a. What is the function that creates Regex objects? U 3 CO3

b. Create the regex must match the following:


• 'Satoshi Nakamoto'
• 'Alice Nakamoto'
• 'RoboCop Nakamoto'
but not the following: Ap 4 CO3
5 • '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)
c. What does the |, ? , *, and + character signify in regular expressions? U 3
Explain with examples. (4 marks)
a. Explain Dictionaries. Demonstrate with python Program. U 5 CO3

6 b. List any six methods associated with strings and explain each of them
with an example. (05 Marks, July 2019) U 5 CO2

a. Explain with python code to perform Greedy and Non-greedy Ap 3 CO3


Matching.
b. Explain the usage of Search() and Findall() method with python code. Ap 3 CO3
7
c. write a python program to concatenate and compare two strings, Read
Cr 4 CO2
the strings from user. ( 05 M -Dec/Jan2020).
a. Explain fileopen, fileclose, fileread and filewrite concepts in python U 5 CO2
8 with example. (05 M -Dec/Jan2020)
b. Explain Modifying a List of Files Using Glob Patterns in python with U 5 CO2
examples.
a. What is list. Describe any two list operations and list methods. Write a
python program to accept ‘n’ number from user , find sum of all even Cr 7 CO3
numbers and product of all odd numbers in the entered list. (7M- Jan
9 2019)
b. with example program illustrate how to pass function arguments to list.
Ap 3 CO3
(3 M -Dec/Jan2020)

a. List merits of dictionary over list. How tuples can be used as keys in
dictionaries. Write a python program to accept USN and marks obtained,
find maximum, minimum and students USN who have scored in the range Cr 7 CO3
10 100-85,85-75, 75-60 and below 60 marks separately. (8M- Jan
2019, 06 M -Dec/Jan2020)
b. write a python program to search lines that start with ‘F” followed by 2 Cr 4 CO3
characters, followed by ‘m:’

a. Compare and contrast tuples with lists. Explain the following


operations in tuples
i. Sum of two tuples
A 7 CO3
ii. Slicing operators
11 iii. Compression of two tuples
iv. Assignments to variables. (7M- Jan 2019, July 2019)

b Write a python program to count occurrence of characters in a string


Cr 3 CO2
and print the count. (03 M -Dec/Jan2020)

a. Explain extracting data using regular expressions. Implement a python


program to find for lines having ‘@’ sign between characters in a read Cr 6 CO3
text file. (7M- Jan 2019)
12
Explain the concept of comparing tuples. Describe the working of sort
function with Python (4M -Dec/Jan2020) U 4 CO3

**********************All the Best************************

You might also like