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

Quiz 1 Basic Programming Language

1. The document provides instructions for a computer-based exam on basic Python programming for a class. 2. Students are asked to submit their answers in .txt and .py format with their roll number and name as the folder name. 3. Any student found not following instructions will be asked to leave and forfeit test marks.

Uploaded by

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

Quiz 1 Basic Programming Language

1. The document provides instructions for a computer-based exam on basic Python programming for a class. 2. Students are asked to submit their answers in .txt and .py format with their roll number and name as the folder name. 3. Any student found not following instructions will be asked to leave and forfeit test marks.

Uploaded by

AkashDeb
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

School of Arts and Sciences

Biological and Life Sciences


Basic Programming Language
Integrated M.Sc, Semester III
Class Quiz-I, (Monsoon Semester)
Marks (3 * 10 = 30) Time- 1.5 hrs

NOTE- This is a computer based exam based on the honors system -- you are not allowed to
use the internet for self-use. Submit your answer sheets transferred in a pendrive. Your folder
should be named with your Roll no and name. Anyone found not following the instructions
will be asked to leave immediately & forfeit the test marks. Submit your two answer sheets
one in .txt and one in .py format. Each of this format will contain all your answers in a
numerological order.

1) Write a Python program to search for patterns in the string below and print matched if the
pattern is found and notmatched when not found (print the pattern and matched or unmatched
in the output.) :
string = 'The quick brown fox jumps over the lazy dog.'
patterns = [ 'fox', 'dog', 'horse' ]

2) Write a Python program to search for patterns in the string below and print the location of
the pattern in the original string (print the pattern and location in the output.) :
string = 'The quick brown fox jumps over the lazy dog.'
pattern1 = 'fox'
pattern2 = 'dog'

3) Use regular expression to change the input string to the output forms given below:
Inputtext: The quick brown fox jumps over the lazy dog.
Output1: The quick brown wolf jumps over the lazy dog.
Output2: THE quick brown FOX jumps over the lazy DOG.
4) Write a Python function that matches a string that has an 'a' followed by anything, ending in
'b'. Test this on the following strings:
string1 = "aabbbbd"
string2 = "aabAbbbc"
string3 = "accddbbjjjb"
The output should clearly tell match or nomatch for each string

5) Write a Python program to find all words starting with 'a' or 'e' in a given string.
string = "Astounding aardvarks, arguably an ancient animal, always ate apples and acorns
and artichokes all around Athens, amazing. Eating enough early eases elimination."

6) Write a Python program to replace maximum 2 occurrences of space, comma, or dot with a
colon.
string = "text = 'Python Exercises, PHP exercises, C++ exercises'

7) Write a Python program to find all five characters long word in a string.
string = 'The quick brown fox jumps over the lazy dog.'

8) Write a Python program to find all words which are at least 4 characters long in a string.
string = 'The quick brown fox jumps over the lazy dog.'

9) Write a Python program to find all adverbs and their positions in a given sentence. Can you
do the same for nouns?
string = "Clearly, he has no excuse for such behavior."

10) Write a Python program to split a string at uppercase letters.


string = "PythonTutorialAndExercises"

You might also like