Question
Fact: We cannot take the inner product of two vectors of different dimensionality. We illustrate this with an example next. using LinearAlgebra: dot a = [1, 2, 3, 5] [4, 5, 6] 4 b 5 dot (b, a) Run Revert LoadError: Dimension Mismatch("first array has length 3 which does not match the length of the second, 4.") Dimensio
Question image 1

This question hasn’t solved by tutor

Solution unavailable? No problem! Generate answers instantly with our AI tool, or receive a tailored solution from our expert tutors.

Found 10 similar results for your question:

2. Given below is SML code that implements a simple way to define expressions and operations on them: datatype exp = Constant of int Negate of exp | Add of exp * exp fun eval e = case e of Constant (i) => i Negate el => ~ (eval el) | Add (el, e2) => (eval el) + (eval e2) eval (Add (Constant 19, Negate (Constant 4))); (* result is 15 *)

2. Write a function that takes a list of strings and a suffix, and returns a list of strings, in which each string is built by appending the suffix to each string in the original list. eg: (my- append (list "util" "main" "delta") ".cpp") will return ("util.cpp", "main.cpp", "delta.cpp"). Use the builtin string-append function to append strings.

A list of 5 unsigned numbers (1H,68H,64H,65H,0H,34,100,101,70H,4,98H) is stored starting at memory location LIST in code memory (ROM). Write a program that will: Copy the numbers from code memory (ROM) to program memory (RAM)starting at address 40H. Sum the value of the numbers then output the result on PO. Find the number of values that are greater than 1510 and output the result on P1 LEDS. 2. (5 points) Write a program that will convert a string of characters in to an all-upper-case string: The string named "MyString " defined using appropriate assembler directives and ended with 0. The original string consists of a mixture of upper- and lower-case characters in addition to spaces. - The converted string should be stored RAM starting at address 40H.

1. public int summation (int start, int end) { 3.return start; 2. if (start == end) 4.else 5.return start + summation (start+1, end); Show the runtime stack that is built in order to calculate summa-tion(3,6). You should show the stack's state whenever an activation record is pushed on or popped off. Be sure your representation of the stack includes all dynamic links, current values for all parameters, and,when appropriate, give the return value of the function.

5. Write a class Fraction to represent a fraction. It has a constructor to accept a numerator and denominator. The denominator should be 1 by default. The constructor should automatically simplify the fraction. So if 2 and 4 are passed to the constructor the fraction should be 1/2. Implement a method that takes another Fraction, adds it to the current fraction. The addition function should be chain able, i. e. if function name is add, the we should be able call f.add (1/2).add (1/3). Leverage the add function to implement a + function that can add two fractions and returns the result, (1/2 + 1/3 should return 5/6). Use helper methods as needed, with appropriate access levels. The numerator and denominator attributes should not be accessible outside the class. Implement a to_s to return the fraction as a string in proper format (like "1/2").

3. In an academic institute, students records include id, first name and last name. Write a function that accepts a list of student records. Each record is a list of integer, string, string - eg: '(1, "Sam", "Roger"), and records of new students may not have the id, they have only first and last name as in' ("Kang" "Lee"). The function should return a list ids. If the student has an id then that is used, if the student does not have an id, full name is used as id so the returned list would look like (1 "Kang Lee" 2 3 "Ravi Kumar" "Sarah Smith")

3. (2 points) Answer the following questions. If necessary, consult a reference on C (and cite your source). (a) What is the scope and what is the lifetime of a static local variable? (b) What is the scope and what is the lifetime of a static global variable?

1. Write a recursive function (range) that takes 3 numbers as arguments (begin, end, inc) and return a list that starts at begin and each subsequent number increases by inc and the list has a last value which is less than or equal to end. Assume that end > begin and inc is always +ve. (range 2 15 3) should return (2, 5, 8, 11, 14) 1

Programming Languages - Project WJ Inc., is a company with offices around the world. The HR team wants to build reports on the number of employees around the world, in different departments. But they do not want to use the raw data for the reporting purpose. They want some consolidation and aggregation to be done prior to being loaded into their reporting system. The data is provided to the software engineer in CSV files. There are 3 CSV files, each holding the department, location and employee headcount data. The department and location information is provided as a flattened hierarchy. Given below is a snapshot of the department file content: level1 WJ Group WJ Group WJ Group level2 WJ Inc. WJ Inc. WJ Ino level? level3 level4 level5 level5 DEPT 1 DEPT 11 DEPT 111 DEPT 1111 DEPT 11111 DEPT 1 DEPT 12 DEPT 1 DEPT 13 DEPT 133 level! The department hierarchy has 7 levels. The file has columns level1 - level7 and an additional column to indicate the the bottom level. The department hierarchy is a jagged hierarchy meaning not all hierarchies have 7 levels. Similarly the location data is also provided. The screen shot is given below: level1 level2 laval3 World North America USA Califomia World North America USA Califomia World North America USA Califomia laval7 level5 loval6 leve! bottom_level Northern California San Jose Main Campus SJG1 8JC 1 Northern Califomia San Jose Main Campus SJC2 SJC2 Southern California Los Angeles LA Techspace LA 1 LA 1 The head count data includes the department, location. Each row in the file gives the number of employees for a particular department at a particular location. The headcount data is only available at bottom levels. Given below is a screenshot of the data: location department DEPT_11111 SJC 1 SJC 1 SJC 1 SJC 1 SJC 1 DEPT 12 DEPT 133 bottom_level DEPT 11111 DEPT 12 DEPT 133 DEPT_2222 DEPT_2244 head_count 12 42 122 3 12

Write a shellscript to append two files accepted as command line input, if they exist. Display the content of the new file, and the number of words in all the files. Write a shell script to input a file name. If the file exist, perform the following using menu-driven programming according to the options given below: Option 1 2 Any other value Process to be done Display the line at the middle of the file Display the background processes display all the files in the current directory that has size ranging from 100 kb to 500 kb A user is typing a Shell script in vi editor. He wants to delete a line in his file. To which mode should he change and how? A user wants to get a list of devices and the points at which they will be attached to the main filesystem. From Choose... which of the following files can he get the required information? An administrator types the following command on an RPM- based Linux distribution: # rpm -ev nx-3.5.0- Choose... 2.el6.centos.i686.rpm What is the effect of is command? Choose... ◆ * What is the output of the following shell script? #! /bin/bash x=3 y=5 if [ $x -eq 3 -a $y -ge 5 ] then echo -n $(($x+2)) FL echo "$y+2 Choose... Match the Following: A user is typing a Shell script in vi editor. He wants to delete a line in his file. To which mode should he change and h✓ Choose... A user wants to list of devices ar points at which will be attached main filesystem. which of the foll files can he get t required informa An administrato types the follow command on an based Linux Choose... 3+27 5 5+2 Command, press Esc key /etc/fstab Remove the package Insert, press Esc key /etc/filestab enable the package distribution: # rpm -ev nx-3.5.0- el6.centos.i686.rpm Choose... ◆