import Prelude hiding (lookup) data Exp = Num
Q: Race.RaceDate is not nullable Questions: Question 10 What constraints would the following command vi...
A: Here i give answer one by one(According to guidelines we solve first three): =======================...
Q: he source IP address for an IPv4 datagram is stored where in the header?
A: c. 4th longword (bytes 13-16) The answer is 4th longword ( bytes 13-16) The ip datagram consistm o...
Q: Breaking the Code by CodeChum Admin ATTENTION SOLDIER! This will be the hardest mission of your ...
A: Here I have created the function hasConsonant(). In this function, I have created a loop to traverse...
Q: 14) Suppose FSA M1 and M2 are defined as follows: M1(Q, S, qo, A, 8) = ({I, II, III }, {a, b}, I, {I...
A: According to the information given:- we have to follow the instruction and perform the task.
Q: What components must a PHP program that enables a dynamic Web site contain?
A: Introduction: PHP stands for "PHP: Hypertext Preprocessor." PHP is a popular open-source programming...
Q: Is there a list of the hard drive's contents?
A: A hard drive is secondary storage which stores data permanently.
Q: Client host Server host 2 3 5 ...
A: Solution:
Q: 3. Is Recursive Descent Parser (RDP) more powerful than LL(1) parser ( or LL(1) is a subset of RDP)?...
A: answer is
Q: [RC4) RC4 is a stream cipher standard that was used widely on the Internet. Read the below pseudocod...
A: Here i explain about RC4: ==========================================================================...
Q: The job of the __________ is to fetch instructions, carry out the operations commanded by the instru...
A: Lets see the solution.
Q: What does it mean to “visualize a program running”? What is the value of suchan activity?
A: Lets see the solution.
Q: What is the source of your computer's strength?
A: The computer's capabilities are built on three primary characteristics: its ability to calculate, it...
Q: Which of the following is T(n)=4T(n/2) + log n A) 0 (n2) B) 0(n² log n) C) 8 (2") D) 0 (n!)
A: T(n) = 4T(n/2) + n² ---- (1) Now, T(n/2) can be further divided as T(n/2) = [4T(n/4) + n²/4] So, equ...
Q: The Python programming language is what I'm interested in."
A: A scripting language written in Python Because of its complexity, Python is referred to be a high-le...
Q: When the performance of the whole system is dependent on the correct operation of all of its compone...
A: Let's understand parallel processing: Parallel processing can be described as a class of techniques ...
Q: You are to use the started code provided with QUEUE Container Adapter methods and provide the implem...
A: //used headesr#include<iostream>#include<string>using namespace std; //queueu structstru...
Q: At the time of its conception, how large was the computer?
A: Introduction: ENIAC-Electronic Numerical Integrator and Computer was one of the first electronic dig...
Q: Describe the advantages of three-tier architectures.
A: Lets see the solution.
Q: The Python programming language is what I'm interested in.
A: Introduction: It is possible to write machine code from texts or graphical program components in the...
Q: Step-By-Step Assignment Instructions Assignment Topic: How data breaches occur and are discovered....
A: In questions with many questions, we must answer the first one. А dаtа breасh оссurs when inf...
Q: Write a brief description for WriteChar.
A: The function of which the main file that can be specified as the main ASCII code as the main convert...
Q: We replaced the bios of my laptop but still no display but has power in all the systems. What is the...
A: According to the information given:- We have to find the issue in no display problem.
Q: What database APIs are commonly used to access databases from various programming languages?
A: Lets see the solution.
Q: le discussed in class that with n agents, there are n! permutations of agents which n! different det...
A: Pareto ideal A Pareto diagram is a reference chart. The lengths of the bars address recurrence or co...
Q: Let X and Y be two arrays. Let them contain the same distinct k keys but the keys are ordered differ...
A: prefixAverages(X,Y,n) Input array X,Y and n integers Output array X,Yof n doubles Let X,Y be an a...
Q: What will be the impact of quantum computing on programming?
A: Computing power is growing exponentially, both in the number of transistors that can be packed onto ...
Q: Consider the following function: int get_random(int start, int end){) int * rand_int = new int; std:...
A: We nee to answer: Consider the following function: int get_random(int start, int end){ int * rand_in...
Q: Is a syntax error (such as misspelling a key word) found by the compiler or when the program is runn...
A: Lets see the solution.
Q: e 3 microp
A: Below the 3 microprocessor operations
Q: What is the first sector of a PC hard disc?
A: What is Sector in PC Hard Disk? A sector is a specifically sized division of a hard disk drive, opti...
Q: Describe the disadvantages of three-tier architectures.
A: Lets see the solution.
Q: What problems can arise during view integration or merging relations?
A: Lets see the solution.
Q: Explain the difference between an object file and an executable file.
A: Lets see the solution.
Q: Create a simple webpage that allows users to create and input data in a Form. it must contain your ...
A: HTML Code: <html><head><title>Login Page</title></head><style>.b...
Q: Write an algorithm to find the maximum in an array
A: Dear student, As per guidelines, I can do only first question. Please re-post your pending question ...
Q: What are the problems involved with mixed data? Discuss with suitable examples four ways of converti...
A: Mixed data is a data that is created from multiple sources, each of which may have different attribu...
Q: Q4. Why does kernel need data structure? If O means busy and 1 means free, what does 1001101 bitstre...
A: Kernel needs data structure to store about the current state of the system. That means if any new da...
Q: What are VLANs? copy/paste 3 VLANs separated by routers. Why are Vlans important and on what layer...
A: basic definition of vlan and its importance with types.
Q: User authoriza Input validatio
A: NOTE: ACCORDING TO COMPANY POLICY WE CAN SOLVE ONLY 1 QUESTION. YOU CAN RESUBMIT THE QUESTION AGAIN ...
Q: Provide a brief description for ReadDec.
A: The ReadDec in leading spaces are ignored.
Q: In what ways are computer structure and computer function distinguished from one another?
A: Computer Systems: The system is a term used in computer science to refer to desktop computers. Gener...
Q: Concisely define each of the following keydatabase design terms: relation, primarykey, functional de...
A: Lets see the solution.
Q: 1 Write a python program that will calculate the function exp(x) Make sure your program meets...
A: 1. code: import mathdef expo(x): summ = 0.0 n = 0 while math.exp(x) - summ > 0.0000001...
Q: wer the following: Let R be a subset of pixels in an image. We call R a region of the image if R is ...
A: Neighbors of a Pixel . N4 (p) : 4-neighbors of p.• Any pixel p(x, y) has two vertical and two flat n...
Q: Why must programs written in a high-level language be translated into machine language before they c...
A: Lets see the solution.
Q: Complete the below function in Python language def checkPassword(pass): #pass must have length betwe...
A: Required:- Complete the below function in Python language def checkPassword(pass): #pass must have a...
Q: Given the following function: f(a, b, c, d, e) = abcē + bad + čēbd + ade + āce Use Shannon's expansi...
A:
Q: Instructions: 1. Create a console program that will perform the following: • Ask the user to enter f...
A: To print message on screen, Console.WriteLine function is used To take input from user, Console.Read...
Q: 3. Evaluate the following expressions: a. abs(5); _______________________________ 88 b. floor(5.5); ...
A: a. abs(5); __________5_____________________b. floor(5.5); __________5_____________________c. ceil(5)...
Q: The process control block (PCB) is a critical part of process management. Discuss the relevance of t...
A: Role of PCB in management of processes and resources is mentioned below,
import Prelude hiding (lookup) data Exp = Num Int | Add Exp Exp | Sub Exp Exp | Mul Exp Exp | Div Exp Exp | Var String | Let String Exp Exp | App Exp Exp | Fnc String Exp deriving (Show) type Env = [(String, Val)] data Val = CVal Int | FnVal String Exp Env | Error String deriving (Show) {-Implement a function lookup:: Env -> String -> Val that looks up the value of a variable within a context. This function returns the value of the variable if found and returns an error otherwise. -} lookup :: Env -> String -> Val -- code here-- {- Implement a function eval:: Exp -> Env -> Val to evaluate an expression with an initial context and return a value. Errors occur in the following cases: (a) Left-hand-side of a function application is not a function. (b) Use an undefined variable (c) Arithmetic expression where operand is not a number -} eval :: Env-> Exp -> Val
-- code here --
Step by step
Solved in 2 steps
- package ch08.apps;import ch08.maps.*; public class HMapDriver { public static void main(String[] args) { boolean result; HMap<String, String> test; test = new HMap<String, String>(10,0.75); /*String s = null;test.put(s,"value");test.put("s",null);System.out.println("Expect 'null':\t" + test.get("s"));System.out.println("Expect 'true':\t" + test.contains("s"));test = new ArrayListMap<String, String>();*/ System.out.println("Expect 'true':\t" + test.isEmpty()); System.out.println("Expect '0':\t" + test.size()); System.out.println("Expect 'null':\t" + test.put("1", "One")); System.out.println("Expect 'false':\t" + test.isEmpty()); System.out.println("Expect '1':\t" + test.size()); System.out.println("Expect 'One':\t" + test.put("1", "One")); System.out.println("Expect 'false':\t" + test.isEmpty()); System.out.println("Expect '1':\t" + test.size()); test.put("2", "Two"); test.put("3", "Three");…sortLecNotes sortsearchassigncodeex1.java sort, search for a specific student package sortsearchassigncodeex1; import java.util.Scanner; import java.io.*; // // public class Sortsearchassigncodeex1 { // public static void fillArray(Scanner inputFile, int[] arrIn){ int indx = 0; //Complete code { arrIn[indx] = inputFile.nextInt(); indx++; } } //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- public static void displayArray(int[] arrIn){ for(int indx=0; indx<arrIn.length;indx++) System.out.printf("student %2d sID: %5d\n",(indx+1),arrIn[indx]); } //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- public static int searchArray(int[] arrIn, int sValue){ int retValue = -1; // if the value is not found method will return -1 for(int indx=0; //Complete code ;indx++) if(arrIn[indx] == sValue) retValue = indx; return retValue; }…java: Run length coding is a method to represent a string in a more compact manner. Each character that occurs more than 2 times in a row is represented by the character and a number following it. Two examples are: "abba" → "abba""abcccbbbba" → "abc3b4a"Write a function that calculates how many characters the encoded string is shorter than the original.
- Make the code output sentence starts with a capitalization, and ends with a period. public class Word implements IWord{ private String word; public Word(String word){ this.word = word; } @Override public String getWord(){ return word; }} public class CompoundWord implements IWord { private IWord word1; private IWord word2; public CompoundWord(IWord w1, IWord w2){ word1 = w1; word2 = w2; } @Override public String getWord(){ return word1.getWord() + word2.getWord(); } } import java.util.ArrayList;public class Sentence { private ArrayList<IWord> words; public Sentence(){ words = new ArrayList<IWord>(); } public Sentence add(IWord word){ words.add(word); return this; } public String getSentence(){ String result = ""; for(IWord word:words) result += word.getWord()+" "; return…sortsearchassigncodeex1.java sort, search for a specific student package sortsearchassigncodeex1; import java.util.Scanner; import java.io.*; // // public class Sortsearchassigncodeex1 { // public static void fillArray(Scanner inputFile, int[] arrIn){ int indx = 0; //Complete code { arrIn[indx] = inputFile.nextInt(); indx++; } } //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- public static void displayArray(int[] arrIn){ for(int indx=0; indx<arrIn.length;indx++) System.out.printf("student %2d sID: %5d\n",(indx+1),arrIn[indx]); } //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- public static int searchArray(int[] arrIn, int sValue){ int retValue = -1; // if the value is not found method will return -1 for(int indx=0; //Complete code ;indx++) if(arrIn[indx] == sValue) retValue = indx; return retValue; }…javascript only: Write a function `popularLetters(string)` that takes a string as an argument and returns an array of all of the characters that appear five or more times in the string. Examples: console.log(popularLetters('apple')); // [] console.log(popularLetters('bananas in pajamas')); // [ 'a' ] console.log(popularLetters('Yes, we have no bananas, we have no bananas today!')); // [ 'e', ' ', 'a', 'n' ]
- JAVA Language: Transpose Rotate. Question: Modify Transpose.encode() so that it uses a rotation instead of a reversal. That is, a word like “hello” should be encoded as “ohell” with a rotation of one character. (Hint: use a loop to append the letters into a new string) import java.util.*; public class TestTranspose { public static void main(String[] args) { String plain = "this is the secret message"; // Here's the message Transpose transpose = new Transpose(); String secret = transpose.encrypt(plain); System.out.println("\n ********* Transpose Cipher Encryption *********"); System.out.println("PlainText: " + plain); // Display the results System.out.println("Encrypted: " + secret); System.out.println("Decrypted: " + transpose.decrypt(secret));// Decrypt } } abstract class Cipher { public String encrypt(String s) { StringBuffer result = new…For any element in keysList with a value greater than 40, print the corresponding value in itemsList, followed by a semicolon (no spaces). Ex: If the input is: 32 105 101 35 10 20 30 40 the output is: 20;30; import java.util.Scanner; public class Compare { public static void main(String args[]) {final int SIZE_LIST = 4;int[] keysList = new int[SIZE_LIST];int[] itemsList = new int[SIZE_LIST];int i;Scanner input = new Scanner(System.in); keysList[0] = input.nextInt();keysList[1] = input.nextInt();keysList[2] = input.nextInt();keysList[3] = input.nextInt(); itemsList[0] = input.nextInt();itemsList[1] = input.nextInt();itemsList[2] = input.nextInt();itemsList[3] = input.nextInt(); /* Your code goes here */ System.out.println();} }Write a for loop to print all elements in courseGrades, following each element with a space (including the last). Print forwards, then backwards. End each loop with a newline. Ex: If courseGrades = {7, 9, 11, 10}, print: 7 9 11 10 10 11 9 7 Hint: Use two for loops. Second loop starts with i = courseGrades.length - 1. import java.util.Scanner; public class CourseGradePrinter {public static void main (String [ ] args) {Scanner scnr = new Scanner(System.in);final int NUM_VALS = 4;int [ ] courseGrades = new int[NUM_VALS];int i; for (i = 0; i < courseGrades.length; ++i) {courseGrades[i] = scnr.nextInt();} /* Your solution goes here */ }}
- Question-2: Write a Python program that takes a string as an input where multiple numbers are separated by hashes(#). Your first task is to create a list of numbers and print it. Your second task is to create a dictionary that will have the index of the list as key, and for the even indices, multiplication from start to that index as value, while for the odd indices, summation from start to that index as value. Finally, print the dictionary. . ================================================ Sample Input 1: 1#2#3#4 Sample Output 1: [1, 2, 3, 4] {0: 1, 1: 3, 2: 6, 3: 10} Explanation 1: key 0 → value 1 key 1 → value 1+2 = 3 key 2 → value 1x2x3 = 6 key 3 → value 1+2+3+4 = 10 ================================================ Sample Input 2: 5#6#7 Sample Output 2: [5, 6, 7] {0: 5, 1: 11, 2: 210} Explanation 2: key 0 → value 5 key 1 → value 5+6 = 11 key 2 → value 5x6x7 = 210..Question-2: Write a Python program that takes a string as an input where multiple numbers are separated by hashes(#). Your first task is to create a list of numbers and print it. Your second task is to create a dictionary that will have the index of the list as key, and for the even indices, multiplication from start to that index as value, while for the odd indices, summation from start to that index as value. Finally, print the dictionary. . ================================================ Sample Input 1: 1#2#3#4 Sample Output 1: [1, 2, 3, 4] {0: 1, 1: 3, 2: 6, 3: 10} Sample Input 2: 5#6#7 Sample Output 2: [5, 6, 7] {0: 5, 1: 11, 2: 210}//import java.util.List; import javax.swing.*; import javax.swing.event.*; import java.awt.*; /** * JList basic tutorial and example * * @author wwww.codejava.net */ public class JListTask1_Student_Version extends JFrame { //define a Jlist Component // Define a String array that use to create the list private JPanel ContryPanel; // To hold components private JPanel selectedcontryPanel; // To hold components // define a TextFiles to show the result private JLabel label; // A message /** Constructor */ public JListTask1_Student_Version(){ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setTitle("JList Task1"); setSize(200, 200); setLayout(new BorderLayout()); // Build the month and selectedMonth panels. // Add the panels to the content pane. // add(new JScrollPane(countryList)); setLocationRelativeTo(null); setVisible(true); } public void buildcontryPanel() { // Create a panel to hold the list. ContryPanel = new JPanel(); //create the list // Set the selection mode to single…