Compilation Techniques The program snippet is known as follows: a = 10; b = 1; c = 2; do { b = b + 1 while (b <= 10) { if (a%2==0) c = c + b; a = a + 1; } } while (c < = 30); Make a code generator for the above program fragment.
Q: Cs10 Quiz 1 100% Name Login 27. Implement the following RECURSIVE function named starString: //…
A: Given: To write a recursive function to print the function starString.
Q: Before the checkout customer can remove any item from the cart at any time.
A: The code for the above-given question is given below:
Q: Fill-in-the-Blank When a program is finished with a chunk of dynamically allocated memory, it should…
A: When a program is finished with a chunk of dynamically allocated memory, it should free it with the…
Q: def recursive_sequence(self, n): """ Calculate a sequence where the value is 3 times the previous…
A: Program Code:- class Sequence: def recursive_sequence(self, num): if num<0:…
Q: strings. It's actually such a common task that modern distributions of the Linux operating system…
A: Sample Screenshot:
Q: X275: Recursion Programming Exercise: Check Palindrome Write a recursive function named…
A: Palindrome: A word or phrase that reads the same backward as forward.
Q: Create a program that finds all the prime factorials of numbers from 2 to 1000. Note: proof that all…
A: In Python, append() function is used to add the element at the end of the list. Syntax:…
Q: Define a function named get_word (words_list) that takes a list of words as a parameter. The…
A: In this question we have to write a code which will give the random word from the list using a…
Q: Population Count Description: The population count is the number of 1s (ones) in the binary…
A: Write a Java program to input the population(a non-negative integer) from the user and count the…
Q: Please code in python Forbidden concepts: recursion, custom classes Create a program that…
A: # program to get name and category they belong on babsis of parental income # class class Student:…
Q: 305. A program that runs in parts on several computers is said to be a. delegated b. spread c.…
A: Recursive means calling itself so, this is not correct
Q: calculate(tokens): Takes one list of tokens as input corresponding to a mathematical equation. The…
A: code : - def calculate(li): try: # create new answer list ans = [] # find…
Q: Write Java Program Mr. Patrick is fond of reading books he is looking for a computerized way to keep…
A: To write a java program to keep record fo book collections. Must have following functions like…
Q: please code in python Forbidden concepts: recursion, custom classes Create a program that asks…
A: # program to get name and gender of users and show them # class class person: def __init__(self,…
Q: • calculate(tokens): Takes one list of tokens as input corresponding to a mathematical equation. The…
A: calculate( tokens): Takes one list of tokens as input corresponding to a mathematical equation. The…
Q: X275: Recursion Programming Exercise: Check Palindrome Write a recursive function named…
A: Given To complete the given function public boolean cheakPalindrome(string s) { }
Q: Write a code in C language for Tuition Payment System Must include the following: Arithmetic…
A: Try this answer, It is working well in compiler:
Q: Variable t has been assigned a tuple whose elements are numbers. Write a code that uses while loop…
A: According to the information given:- We have to write a code that uses while loop that counts the…
Q: Please code in python Forbidden concepts: recursion, custom classes A grocery store needs to…
A: apple_type = int(input("Enter the number of different type of apples: "))stock = {}for i in…
Q: Creat a program which can process multiple groups. These groups are on the input separated by…
A: Define the function named read_student_and_grades() that reads file report.txt and calculate and…
Q: Peacn I need help to write down the descri[tion of this prgramm coding for example, like you give…
A: from tkinter import * import math import parser import tkinter.messagebox root = Tk()…
Q: Java only Design, implement and test a Java class that processes a series of triangles. For this…
A: Here, we have to provide a java code for the above question.
Q: JavaScript function that takes an array of numbers as argument and returns the largest number in the…
A: Introduction of the Program: The JavaScript program declares the array and then the program finds…
Q: Objective: To design an algorithm and implement a solution using Python programming. To write…
A: According to the information given:- We have to create palindrome game program in python .
Q: Write a word problem that corresponds to the following model for subtraction Missing addend
A: Explanation: An addend is indeed an integer that is appended to some other number, and it is…
Q: ndng 2. Modular Programming: Your program should be modular and consists of the following functions:…
A: the code is an given below : Raw_Code: def read():#prompting and reading Z value from userZ =…
Q: (Same-number subsequence) JAVA Class Name: Exercise22_05 Write an O(n) program that prompts the…
A: Java program: import java.util.Scanner; public class Main { public static void main(String[] args) {…
Q: def thing2(lst: List[int]) -> None: """TODO: Enter your description of the runtime complexity of…
A: Time Complexity - Time complexity is used to measure computer time taken by algorithm/program, Ou…
Q: python only** define the following function: This function must set the value of a task in a…
A: Python is an Object-oriented programming language Python is a simple and easy to learn programming…
Q: Develop software that can calculate monthly electricity bill based on the following: a. user can…
A: Solution:-- 1)The given question has required for the solution to be provided with the help of the…
Q: write a recursive version. The function takes two string parameters, s1 and s2 and returns the…
A: The Code for the problem is written below , Proper Commenting Has been added to the functions and…
Q: Purpose of this assignment: To allow student to be able to implement a Java-based application by…
A: In This program, We to execute Java Program for which - Customer Data in input.txt file -> Here,…
Q: Write a program that will allow two users to play tic-tac-toe. The program should ask for moves…
A: Actually, program is an executable software that runs on a computer.
Q: We want to build an address book that is capable of storing name, address & phone number of a…
A: public class Person{ //declaring instance variables public String name; //used to…
Q: low many activation records doos this recursive function create if it is.called as fun(E nt fun(int…
A: Here the main function will call fun(7, 2) and then each function fun () will call itself untill…
Q: uld write a .py program that rolls two dices using random library 10 times and shows the results as…
A: Hey there, I am writing the required solution of the questin mentioned above. Please do find the…
Q: Using JAVA language f. Create the principal program, which will complete the following tasks : a.…
A: Details of the student are ID, name, semester, gender, age, modules list, assessment in each module.…
Q: in C++ Write an inductive function, called IndFn, for adding 12+10+8+6+4 Write a function with a…
A: Note: This code should be rewritten instead of copying to the compiler otherwise it will throw a…
Q: Debugging Lists File: debugging.py Similar to the previous practical's debugging exercises: Copy…
A: Answer :
Q: Build the loop function by R-studio build a function that assigns each student to be evaluated 4…
A: Answer:
Q: Develop a body mass index (BMI) caleultor program that reads body weight and height as inputs and…
A: The complete C program is shown below. Sample Response: //C program#include<stdio.h>//main…
Q: Searching and Sorting Sort a singly linked sequential list using bubble sort algorithm. Sort a…
A: Given: To Sort a singly linked sequential list using bubble sort algorithm. Note: As per rules we…
Q: Allocate the required memory space with a dynamic memory structure to store your name as string.…
A: Given: The last appearance of your name must be as follows (For example; Emir, 1810206037). Perform…
Q: rite a program in C that creates a simplified railways network. The program starts by offering the…
A: Note: Due to limited time and as per bartleby's guidelines, only first three parts were completed in…
Q: Searching and Sorting Sort a singly linked sequential list using selection sort algorithm. Sort a…
A: Given: To write a program to Sort a singly linked sequential list using a selection sort…
Q: Note: Write the program in C ++ One of your colleagues has started to a new project, which is a…
A: ALGORITHM:- 1. Take input for the items. 2. Store them into the array object of class Equipments. 3.…
Q: KEYWORDS: array, for, nested loops. LAB EXERCISE: Program 1: Write a program for implementation of…
A: According to the Question below the Complete Program: Program Output:
Q: the file Ackermann.cpp. Inside the file the recursive Ackermann function is implemented (described…
A: It is defined as a direct descendant of C programming language with additional features such as type…
Q: • File names: pokemon.py Pokemon was a worldwide cartoon, video game and card-game phenomenon. My…
A: Here is the solution with an output:-
Q: # Debug the following program and submit the CORRECT version ####### Lists names = ["chris","dan",…
A: The modified code is kept in bold for your reference.
Compilation Techniques
The
a = 10;
b = 1;
c = 2;
do {
b = b + 1
while (b <= 10) {
if (a%2==0)
c = c + b; a = a + 1;
}
} while (c < = 30);
Make a code generator for the above program fragment.
Step by step
Solved in 2 steps
- JAVA CODE PLEASE Functions With No Parameters and Return Values Quiz by CodeChum Admin Create a function named banner that prints “CodyChum” with a newline. In the main function, write a program that accepts an integer input which would serve as an inclusive stopping point of a loop iteration that starts at the value of 1. If the number that loops through the range is divisible by either 2 or 3, then call the banner function, otherwise just print the number. Input 1. One line containing an integer Output First line is the integer user input. Succeeding multiple lines containing an integer or “CodyChum” 10 1 CodyChum CodyChum CodyChum 5 CodyChum 7 CodyChum CodyChum CodyChumModular Programming: Your program should be modular and consists of the following functions: a) read(): - Ask the user for a valid atomic number (Z) b) compute_binding_energy(Z, table): - Build the table (a list of lists) of binding energy where the columns are: the mass number (A), the binding energy (Eb) and the binding energy per nucleon (BEN), while the rows range from A = Z to A = 4Z c) most_stable(table) : - Find and return the row that contains the highest binding energy per nucleon, which corresponds to the most stable configuration. d) print_table(table): - Print the table in a neat tabular format as shown in the sample run in figure 2. e) write_to_file(table, file_name): - Save the table in a text file output.txt as shown in figure 3. 4 f) main(): - The main function is set up to make the calls to the functions as specified in points a) to e)Complete the program 'Bcast-Reduce-Assignment.c' (Refer to 'Bcast-Reduce-Example.c') to make the program have the output as follows if we run the program using 2 processes. The input sequence is: 0 1 2 3 The output sequence is: 0 2 6 12 #include <stdio.h>#include <stdlib.h>#include <mpi.h> int main(void) { int my_rank, comm_sz; int i; int Count = 4; int Number[4]; int Result[4]; MPI_Init(NULL, NULL); MPI_Comm_size(MPI_COMM_WORLD, &comm_sz); MPI_Comm_rank(MPI_COMM_WORLD, &my_rank); if(my_rank == 0) { printf("The input sequence is: \n"); for (i = 0; i < Count; i++) { Number[i] = i; printf("%d ", Number[i]); } printf("\n"); } // Process 0 sends data to all of the processes MPI_Bcast(Number, Count, MPI_INT, 0, MPI_COMM_WORLD); for (i = 0; i < Count; i++) Number[i] += my_rank;…
- (Numerical) Write a program that tests the effectiveness of the rand() library function. Start by initializing 10 counters to 0, and then generate a large number of pseudorandom integers between 0 and 9. each time a 0 occurs, increment the variable you have designated as the zero counter; when a 1 occurs increment the counter variable that's keeping count of the 1s that occur; and so on. finally display the number of 0s, 1s, 2s, and so on that occurred and the percentage of the time they occurred.Complete the program 'Bcast-Reduce-Assignment.c' (Refer to 'Bcast-Reduce-Example.c') to make the program have the output as follows if we run the program using 2 processes. The input sequence is: 0 1 2 3 The output sequence is: 0 2 6 12 The code below must be used, please #include <stdio.h>#include <stdlib.h>#include <mpi.h> int main(void) { int my_rank, comm_sz; int i; int Count = 4; int Number[4]; int Result[4]; MPI_Init(NULL, NULL); MPI_Comm_size(MPI_COMM_WORLD, &comm_sz); MPI_Comm_rank(MPI_COMM_WORLD, &my_rank); if(my_rank == 0) { printf("The input sequence is: \n"); for (i = 0; i < Count; i++) { Number[i] = i; printf("%d ", Number[i]); } printf("\n"); } // Process 0 sends data to all of the processes MPI_Bcast(Number, Count, MPI_INT, 0, MPI_COMM_WORLD); for (i = 0; i < Count; i++)…(Data processing) Your professor has asked you to write a C++ program that determines grades at the end of the semester. For each student, identified by an integer number between 1 and 60, four exam grades must be kept, and two final grade averages must be computed. The first grade average is simply the average of all four grades. The second grade average is computed by weighting the four grades as follows: The first grade gets a weight of 0.2, the second grade gets a weight of 0.3, the third grade gets a weight of 0.3, and the fourth grade gets a weight of 0.2. That is, the final grade is computed as follows: 0.2grade1+0.3grade2+0.3grade3+0.2grade4 Using this information, construct a 60-by-7 two-dimensional array, in which the first column is used for the student number, the next four columns for the grades, and the last two columns for the computed final grades. The program’s output should be a display of the data in the completed array. For testing purposes, the professor has provided the following data:
- Build the loop function by R-studio build a function that assigns each student to be evaluated 4 other students’ projects. The function is such that each student must have 4 classmates evaluating projects without replacement. the outcome of a random selection process or it can be the outcome of a deterministic process (meaning that every time you run the function, it gives the same output).Write in c language please, The Fibonacci sequence begins with 0 and then 1 follows. All subsequent values are the sum of the previous two, for example: 0, 1, 1, 2, 3, 5, 8, 13. Complete the Fibonacci() function, which has an index n as a parameter and returns the nth value in the sequence. Any negative index values should return -1. Ex: If the input is: 7 the output is: Fibonacci(7) is 13 Note: Use a for loop and DO NOT use recursion.def thing2(lst: List[int]) -> None: """TODO: Enter your description of the runtime complexity of this function below, after the phrase Runtime:. Use one of the descriptions: constant, linear, quadratic, or 'something else' Runtime: enter answer here* Precondition: len(lst) > 0 """ n = len(lst) if n == 1: helper(lst) else: helper(lst[0:1]) def thing3(lst: List[int]) -> None: """TODO: Enter your description of the runtime complexity of this function below, after the phrase Runtime:. Use one of the descriptions: constant, linear, quadratic, or 'something else' Runtime: something else Precondition: len(lst) > 0 """ n = len(lst) i = 0 while i < n * n: helper(lst) helper(lst) i = i + n
- Rolling a single six-sided die produces a random number between 1 and 6 with a uniform distribution. Rolling two dice produces a number between 2 and 12 with a binomial distribution. In this lab you will simulate a number of dice rolls and graph the number of occurrences of each value. 1) Create a function called rollDie() that takes no parameters, and returns a random value between 1 and 6. Do not seed the random number generator in this function. int rollDie() 2) Create a function called initArray() that takes a data array and the size of the array as parameters and fills each element with the summed results of rolling two dice. Do not assume that the data array has been initialized. void initArray(int data[], int size) 3) Create a function called sortArray() that takes an array and the size of the array as parameters, and sorts the array using the sediment sort. void sortArray(int data[], int size) The sediment sort works as follows: start with the second element in the array if…Python Scrabble is a word game in which words are constructed from letter tiles, each letter tile containing a point value. The value of a word is the sum of each tile's points added to any points provided by the word's placement on the game board. Write a program using the given dictionary of letters and point values that takes a word as input and outputs the base total value of the word (before being put onto a board). Ex: If the input is: PYTHON the output is: 14 part of the code: tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, 'S': 1, 'T': 1, 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 }C++ - Rolling a single six-sided die produces a random number between 1 and 6 with a uniform distribution. Rolling two dice produces a number between 2 and 12 with a binomial distribution. In this lab you will simulate a number of dice rolls and graph the number of occurrences of each value. 1) Create a function called rollDie() that takes no parameters, and returns a random value between 1 and 6. Do not seed the random number generator in this function. int rollDie() 2) Create a function called initArray() that takes a data array and the size of the array as parameters and fills each element with the summed results of rolling two dice. Do not assume that the data array has been initialized. void initArray(int data[], int size) 3) Create a function called sortArray() that takes an array and the size of the array as parameters, and sorts the array using the sediment sort. void sortArray(int data[], int size) The sediment sort works as follows: start with the second element in the array…