MSU Programming Datatype to Represent Student Grade Questions

1. Create a datatype to represent student grade, with id (int) and grade (int option) asattributes. Write a function to accept a student grade and returns pass or fail based on
pass mark of 75. Use a custom datatype to denote pass or fail.
2. Write a function that takes a list of students’ grade results and nal grades. Returns the
number of misgrades. A misgrade is when the student gets > 75 but marked fail and vice
versa.
Input
Return Value
[(fail, {id = 1, grade=88}), (pass, {id = 2,
grade=68}), (pass, {id = 3, grade=95})]
2
3. Write a recursive function that takes a string (inputString) and a list of strings (inputList) and
returns SOME of list of strings that contains all the strings in inputList with the exception of
inputString. Should return NONE if the inputString is not present in the inputList. Calling the
function with (“Xing”, [“Hello”, “Xing”, “World”]) should return SOME [“Hello”,”World”].
Where as calling the function with (“Ra “, [“Hello”, “Xing”, “World”]) should return NONE.
4. Write a function that returns names substitutions. It takes string list list and a
string as input. The rst input is a list of list of name equivalents, and the second input is
a name. The function returns a list of names that can be substitutes for the name passed in.
Given below are inputs and expected return values:
Input
Return Value
[[“Sitha”, “Seetha”, “Sita”], [“Lakshman”,
“Laxman”, “Lucky”], [“Jacob”, “Jake”, “Jack”]],
“Jacob”
[“Jake”, “Jack”]
The returned list can contain duplicates. Make use of the function written for 1 and inbuilt @
operator for appending to lists.
5. Write a tail recursive version for problem 1.
6. Write a tail recursive version for problem 2.
7. Create a datatype that has attributes rst name, middle name and last name. Write a
function that accepts string list list (list of list of name equivalents), and a full name, and
returns list of equivalent full names. The returned list includes the full name sent as input.
Equivalent names are found only for rst names. Duplicate values are OK.
Input
Return Value
fi
fi
fi
fi
fi
[[“Sitha”, “Seetha”, “Sita”], [“Lakshman”, “Lucky”], [{fn:”Lakshman”, ln:”Dev”, mn: “Kumar”},
[“Jacob”, “Jake”, “Jack”]], {fn:”Laxman”, ln:”Dev”, {fn:”Laxman”, ln:”Dev”, mn: “Kumar”}, {fn:”Lucky”,
mn: “Kumar”}
ln:”Dev”, mn: “Kumar”}]
3. Write a recursive function that takes a string (inputString) and a list of strings (inputList) and
returns SOME of list of strings that contains all the strings in inputList with the exception of
inputString. Should return NONE if the inputString is not present in the inputList. Calling the
function with (“Xing”, [“Hello”, “Xing”, “World”]) should return SOME [“Hello”,”World”].
Where as calling the function with (“Rafi”, [“Hello”, “Xing”, “World”]) should return NONE.
4. Write a function that returns names substitutions. It takes string list list and a
string as input. The first input is a list of list of name equivalents, and the second input is
a name. The function returns a list of names that can be substitutes for the name passed in.
Given below are inputs and expected return values:
Input
Return Value
[[“Sitha”, “Seetha”, “Sita”], [“Lakshman”,
“Laxman”, “Lucky”], [“Jacob”, “Jake”, “Jack”]],
“Jacob”
[“Jake”, “Jack”]
The returned list can contain duplicates. Make use of the function written for 1 and inbuilt @
operator for appending to lists.
5. Write a tail recursive version for problem 1.
6. Write a tail recursive version for problem 2.
7.
Create a datatype that has attributes first name, middle name and last name. Write a
function that accepts string list list (list of list of name equivalents), and a full name, and
returns list of equivalent full names. The returned list includes the full name sent as input.
Equivalent names are found only for first names. Duplicate values are OK.
Return Value
Input
[[“Sitha”, “Seetha”, “Sita”], [“Lakshman”, “Lucky”],
[“Jacob”, “Jake”, “Jack”]], {fn:”Laxman”, In:”Dev”,
mn: “Kumar”}
[{fn:”Lakshman”, In:”Dev”, mn: “Kumar”},
{fn:”Laxman”, In:”Dev”, mn: “Kumar”}, {fn:”Lucky”,
In:”Dev”, mn: “Kumar”}]

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper
Still stressed from student homework?
Get quality assistance from academic writers!

Order your essay today and save 25% with the discount code LAVENDER