Skip to content

Commit

Permalink
Updated
Browse files Browse the repository at this point in the history
- Solutions
- Date
  • Loading branch information
ramagururadhakrishnan authored May 13, 2024
1 parent 827b569 commit 5433287
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Assets/Solutions/Mid-Term/Mid-Term.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
![](https://img.shields.io/badge/Lecture-2-orange) ![](https://img.shields.io/badge/Practical-3-orange) ![](https://img.shields.io/badge/Credits-3-orange)

## Mid-Term Question Paper with Solutions
![](https://img.shields.io/badge/MidTerm_Exam-24th_Apr-orange)

#### 1. Write the _type signature_ of the below functions.
(a) **zip :: [a][b][(a, b)]** <br/>
Expand Down Expand Up @@ -39,10 +40,10 @@ Successfully solved by [Aishwarya G](), [Dyanesh S](), [Aravind S](), [Ashwin An
(d) [ x^2 | x ← [1..10], even x ] <br/>

**Solution:** <br/>
(a) <br/>
(b) <br/>
(c) <br/>
(d) <br/>
(a) **map reverse (filter (even . length) strs)** <br/>
(b) **map length (filter (\word → length word > 10) words)** <br/>
(c) **map (\x -> (x, 6 - x)) (filter (\x -> x + (6 - x) == 6) [1..5])**<br/>
(d) **map (^2) (filter even [1..10])** <br/>

#### 6. Write a Haskell code to generate the below HTML file with custom _body_ and _footer_ as mentioned.
- body = "Mid-Term Examination"
Expand Down Expand Up @@ -72,7 +73,11 @@ Successfully solved by [Aishwarya G](), [Dyanesh S](), [Aravind S](), [Ashwin An

**Solution:**
```
html bcontent fcontent = "<!DOCTYPE html><html lang='en'><head><meta charset='UTF-8'><title>Haskell Generated HTML</title></head>" <> body bcontent fcontent <> "</html>"
body bcontent fcontent = "<body><main><p> Content generated by Haskell: </p> <div id='haskell-generated-content'>" <> bcontent <> "</div></main><footer>" <> fcontent <> "</footer></body>"
main = do
putStrLn(html "Mid-Term Examination" "19-March-2024")
```

#### 7. Implement a Queue with the isEmpty, enqueue, dequeue and front function using Haskell data type with Maybe.
Expand Down

0 comments on commit 5433287

Please sign in to comment.