2
V Sem CSE End-Sem Lab Exam 2011 DAA Name :_______________________ Section ___ Roll No _______________ Note 1. Possessing any kind of ELECTRONIC GADGETS is considered as MALPRACTICE. 2. Do NOT seek any clarifications from the EXAMINER(s) 3. Call the examiner for evaluation only ONCE when you feel that experiment is complete 4. You are NOT permitted to make changes to your programs once you call the examiner for evaluation. 5. Do NOT WRITE anything on this paper except your Name and Roll No. and Sec 6. Exploring other than EXAM DIRECTORY is considered as MALPRACTICE Design question Write a program to do the following 1. Identify the patterns ‘DESIGN’ followed by ‘ANALYSIS’ in the given random text such as DESIGN * ANALYSIS *. Here, * represents any random sequence of characters but not ‘DESIGN’ or ‘ANALYSIS’. Implement a brute force technique to display the patterns followed by their indices. 2. Imagine a long text containing the substrings ‘DESIGN’ and ‘ANALYSIS’ along with other random sequence of characters. For all possible pair of patterns ‘DESIGN’ and ‘ANALYSIS’ in the text, it is required to perform the action as detailed below. Task numbers Pattern occurrences Action 2(a) ‘DESIGN’ followed by ‘ANALYSIS’ Retain the sequence 2(b) ‘ANALYSIS’ followed by ‘DESIGN’ Exchange the pattern such that the output is ‘DESIGN’ followed by ‘ANALYSIS’ 2(c) ‘DESIGN’ followed by ‘DESIGN’ Remove the second occurrence and replace it by the pattern ‘ANALYSIS’ 2(d) ‘ANALYSIS’ followed by ‘ANALYSIS’ Remove the first occurrence and replace it by the pattern ‘DESIGN’ Implement brute-force technique and test it on the text given below. DESIGN * ANALYSIS * ANALYSIS * ANALYSIS * DESIGN * DESIGN * ANALYSIS * DESIGN The output should be

DAA Lab Question 4

Embed Size (px)

Citation preview

Page 1: DAA Lab Question 4

V Sem CSE End-Sem Lab Exam 2011

DAA

Name :_______________________ Section ___ Roll No _______________Note1. Possessing any kind of ELECTRONIC GADGETS is considered as MALPRACTICE.2. Do NOT seek any clarifications from the EXAMINER(s)3. Call the examiner for evaluation only ONCE when you feel that experiment is complete4. You are NOT permitted to make changes to your programs once you call the examiner for evaluation.5. Do NOT WRITE anything on this paper except your Name and Roll No. and Sec6. Exploring other than EXAM DIRECTORY is considered as MALPRACTICEDesign question

Write a program to do the following

1. Identify the patterns ‘DESIGN’ followed by ‘ANALYSIS’ in the given random text such as DESIGN * ANALYSIS *. Here, * represents any random sequence of characters but not ‘DESIGN’ or ‘ANALYSIS’. Implement a brute force technique to display the patterns followed by their indices.

2. Imagine a long text containing the substrings ‘DESIGN’ and ‘ANALYSIS’ along with other random sequence of characters. For all possible pair of patterns ‘DESIGN’ and ‘ANALYSIS’ in the text, it is required to perform the action as detailed below.

Task numbers

Pattern occurrences Action

2(a) ‘DESIGN’ followed by ‘ANALYSIS’

Retain the sequence

2(b) ‘ANALYSIS’ followed by ‘DESIGN’

Exchange the pattern such that the output is ‘DESIGN’ followed by ‘ANALYSIS’

2(c) ‘DESIGN’ followed by ‘DESIGN’

Remove the second occurrence and replace it by the pattern‘ANALYSIS’

2(d) ‘ANALYSIS’ followed by ‘ANALYSIS’

Remove the first occurrence and replace it by the pattern ‘DESIGN’

Implement brute-force technique and test it on the text given below. DESIGN * ANALYSIS * ANALYSIS * ANALYSIS * DESIGN * DESIGN * ANALYSIS * DESIGN The output should be DESIGN *ANALYSIS * DESIGN * ANALYSIS * DESIGN * ANALYSIS * DESIGN * ANALYSIS.

Evaluation Scheme: The marking scheme is shown below:

Write-up

1(04)

2(a)(03)

2(b)(03)

2(c)(03)

2(d)(02)

Total(15)

Execution

1(07)

2(a)(05)

2(b)(05)

2(c)(05)

2 (d)(03)

Total(25)

Signature of student: