Question: Using racket software Q 1 ( 1 5 pts ) . Write scheme code to calculate the following equations: a . 2 4 + 3

Using racket software
Q1(15 pts). Write scheme code to calculate the following equations:
a.24+315-72
b.234-456
c.(24+32)15-72
Q2(15 pts). Write a scheme function named number Type that takes one number parameter
and returns one of the following strings using an if statement: "Positive odd", "Positive even",
"Negative odd", "Negative even", "Zero". Define a list L having numbers 9,-4,0,12,-5,7,-12
and apply your function to each element of your list. The output should be
("Positive odd" "Negative even" "Zero" "Positive even" "Negative odd"
"Positive odd" "Negative even")
Q3(10 pts). Define a,b, and c as 2,(471),12 using let and change the first element of b with
a+c by getting the tail of b and adding a+c as new head. Your code should print (1471).
Q4(10 pts). Write a scheme function named Multiple3or 4? that returns true if the number
is divisible by 3 or 4, false otherwise. Filter all numbers divisible by 3 or 4 in a list containing 5,
9,15,20,22,34,24,14,4.
Q5(10 pts). Write scheme expressions with car's and cdr's to access symbol D for each of the
following lists. Note that you can combine at most 4 car's or cdr's using shorter notation such as
(cdadar L). If you need to use more, you can write it separately such as (cadar (cdadar L)).
a.(ABCDEF)
b.((ABC)(DEF))
c.((AB)(CD)(EF)
d.(A(BCD)EF)
e.(AB((CD)E)F)
Q6(10 pts). Write a non-tail recursive scheme function countStrings that returns the
number of strings in a list. You can use string? function to check each list element. For instance,
(countStrings '(P "123"0 #t -57 "abc")) should return 2.
Q7(10 pts). Write a tail recursive version of the same function named countStrings T that
returns the number of strings in a list. Your function should get a second argument to store
accumulated result. For instance, (countStringsT '(P "123"0 #t -57 "abc")
0 should return 2.
Q8(10 pts). Write a tail recursive scheme function named difference that takes two lists
'([6,3,11])0) should return 9 as the sum of differences of elements
|7-11|). Assume that the lists only contain numbers. So, you don't need to check the types.
Your function should stop when it reaches the end of any list. For instance, (difference
Q9(10 pts). Write a scheme function named sequence that takes two number parameters I
and u, and returns a list that contains the sequence of numbers (by a difference of 1) from I to
u. You can write your function tail recursive or non-tail recursive. For instance, (sequence 3
should return ({:[3,4,6,7,9,10]),(sequence 66) should return (6),
(sequence 75) should return ().
Using racket software Q 1 ( 1 5 pts ) . Write

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!