Not Secure - cslabserver2.cs.mtsu.edu cal2 7.5 - Calculus II - MATH-1920-002 Lab 11 -- More Functions Question Tutor What is the output of the following code fragment? def main(): vall= 3 val2= 8 print("Mainl:", vall, val2) DoThis() print("Main2:", vall, val2) def DoThis(): vall = 15 val2 = 80 print("DoThis:", vall, val2) main() A. Mainl: 3 8 DoThis: 15 80 Main2: 15 80 B. Mainl: 3 8 DoThis: 15 80 Main2: 3 8 C. Mainl: 3 8 Main2: 15 80 DoThis: 15 80 D. Mainl: 3 8 Main2: 3 8 DoThis: 15 80 submit MacBook 000 F3 F4 F5 F6 F7 F8 F1 F2 ! %23 2$ & 1 3 4 Q 00
Q: It seems like the 'stoi' function doesn't work for my version of C++. How could I change this?…
A: From the problem described in question, looks like you are using an older version of c++ compiler.…
Q: a switch statement that checks origLetter. If 'a' or 'A', print "Alpha". If 'b' or 'B', print…
A: I have provided a detailed code below.
Q: 6- How to make a C++ function work with multiple data types? C++ 7- Every class has a default copy…
A: Make use of multiple data type in C++ functions As per our policies we will answer only 1st…
Q: What is the issue with the code below? (assume this function is part of a larger program that can e…
A: We are given a C code where we are using malloc function to allocate the memory and simply passing 2…
Q: Create a function that accepts a string (of a person's first and last name) and returns a string…
A: Coded using C#.
Q: convert.py, define a function decimalToRep that returns the representation of an integer in a given…
A: Please Indent the code as shown below in the screenshot : Make sure to save both convert.py and…
Q: What's Hiding Amongst the Crowd? Language - Java Script A word is on the loose and now has tried to…
A: Here, in the problem we need to find the lowercase letters which are hidden among the mixture of…
Q: What will happen when the following function runs? 2)What will happen to(1 ?the Stack memory def…
A: What will happen when the given function runs? The given function is recursively calling itself…
Q: You are required to make changes in the below programs and introduce the use of compaction where…
A: C programming is a general-purpose, procedural, imperative computer programming language developed…
Q: Which of the following is part of the library header file? (Check all applicable answers)…
A: As per guidelines, we are supposed to answer only one question. Kindly repost other question as a…
Q: 9. Write a program for function overloading - define int function ADDint ( Int x, Int y ) Return x+y…
A: int add(int x, int y){ return x + y;} This trivial function provides two integers and returns an…
Q: Fill in the missing blank for the given code.
A: This is very easy. Question 1) 1) ostream 2) istream 3) s1.os 3) s1.is Question 2) 1) &number…
Q: Hello, I was making a hangman simulation in C++. The code runs, but not fully. Could you identify…
A: I have found the errors and modified the code. Now it is working completely. The changes were:…
Q: Does the submission include the is_divisible function from Section 6.4 of the textbook? Does the…
A: Program Code: def is_divisible(a, b): # No conditional necessary; this patter already returns…
Q: hey, copy this code put it in a compiler, debug its a code was java but converted to c++, i want…
A: In this program, you need to check all opening and closing brackets { } , it seems, there are extra…
Q: 2. Write a function that draws a similar grid with four rows and four columns. Solution:…
A: To perform a specific task some set of grammatical rules and vocabulary used for give instruction to…
Q: Replace (????) with relevant code for the program to function. Details about the programs are…
A: After completing the code, I have provided JAVA CODE along with CODE SCREENSHOT and…
Q: Write a function that inserts a white space between every instance of a lower character followed…
A: Step-1: Start Step-2: function insertWhitespace(string) Step-2.1 Declare variable newStr = "", temp…
Q: Computer Science Write in Javascript please and use high order functions liek map or filter or…
A: Introduction: The function is a collection of instructions to perform a particular task. Syntax:…
Q: 9. Write a function to deal a hand of five cards from the deck. The function should accept a…
A: Code in Step 2:
Q: FOR C++, PLEASE SEND THE CODE IN 30 MINUTES!!! PLEASE ANSWER THIS QUESTION IN THE GIVEN CODE Write…
A: Everything is mentioned in the comments make sure you check them for understanding…
Q: The program has to be in c++ Can someone help with this program? Create a Student class with…
A: A Class is a user defined data-type which has data members and member functions. Member functions…
Q: Solution in JS Write a function that inserts a white space between every instance of a lower…
A: Algorithm - Take input from user. Now use the below logic - return…
Q: Solution in JS Write a function that inserts a white space between every instance of a lower…
A: logic - return s.replace(/([a-z])([A-Z])/g, "$1 $2"); Input - String Output - String with white…
Q: main.c > + č 2. Odd-Even-inator 1 #include<stdio.h by CodeChum Admin 2 int isEven(int); My friends…
A: Algorithm: Start Read n value Iterate through the loop n times Read a number m Call isEven(m) If…
Q: Write a function in Java. Also, write a JUnit test output the following things should be output…
A: Solution:-- 1)The given question has required for the solution which is to be provided in the form…
Q: Questions 1 Part a, Develop a Class Library in C# that print prime numbers between 1 and 30 Part B…
A:
Q: What gets printed by executing the following code? def teststrings(): str1 = 'X University' str2 =…
A: If running same code it giving the error due to some mistake using " ' in same statement opening…
Q: C++, PLEASE SEND THE CODE IN 30 MINUTES!!! PLEASE ANSWER THIS QUESTION IN THE GIVEN CODE Write a…
A: We need to define the 3 functions as per the given description.
Q: You are required to make changes in the below programs and introduce the use of compaction where…
A: The required code is: #include<stdio.h>#include<conio.h> #define max 20void main(){int…
Q: 2. Replace (????) with relevant code for the program to function. Details about the programs are…
A: package finalexamtakehome2; import java.util.*; // for Arrays class /** * * @author sweetkim */…
Q: In C++, what is the difference when using :: and the . symbol in OOP?
A: The dot operator is used to call the members of the class. Also by using :: we can call the members…
Q: Solution in JS Write a function that inserts a white space between every instance of a lower…
A: The Javascript code is given below with code and output screenshot Happy Coding?
Q: Please answer it in python Write a ReadListInteger function without arguments that reads positive…
A: As all the questions are not related to each other. As per the rules of Bartleby I can only solve 1…
Q: 1. Replace the (????) with relevant code to make th eprogram function. Details about the code are…
A: hasNextLine() is used to check whether there is next line or not whereas hasNext() is used to check…
Q: C++ Assume the following declaration: vector* ages; Which statement is syntactically correct?…
A: syntactically c++ vector code from give syntax of code.
Q: This is a python Programming Fix this issue: -2 no attribute of type date (year was integer)…
A: from datetime import date class Person: def…
Q: Activity 7: Shapes (I/O operator overloading) In this program, you must implement I/O operator…
A: We need to update the definition of the Triangle and Square classes to add the declaration of the…
Q: Command Line Arguments
A: We can provide 2 command line arguments in double format and use Double.parseDouble for parsing the…
Q: EECE1080C/CS1021C Lab Functions 2 Topics covered: C++ Program Development Practice, Loops, Functions…
A: #include<bits/stdc++.h> using namespace std; vector<int> dp(10005, 0); int…
Q: Hello, I'm working on this hangman simulation in C++. The code runs but it doesn't count wrong…
A: #include <iostream> #include <cstdlib> #include <ctime> #include <string>…
Q: can someone help me with this in C++ In this program, you must implement I/O operator overloading…
A: We need to update the definition of the Triangle and Square classes to add the declaration of the…
Q: Python def fancy_quadratic(a: float, b: float, c: float, x: float) -> float: """ fancy_quadratic(a,…
A: 1. Already given in the question in fancy quadratic return the value of ax²+bx+c so return the…
Q: Hello, I was making a hangman simulation in C++. The code runs, but not fully. Could you identify…
A: C++ Code :- #include<iostream>#include<cstring> // for string class…
Q: #include #include #include #include #include #include "card.h" #include "deck.h" #include…
A: Programming is a way to instruct the computer devices to operate. Every computer needs a set of…
Q: What do the keywords virtual and override do in C++?
A: Function overriding is redefinition of base class work in its inferred class with same mark i.e…
Q: What will be the output of the following C++ program? #include using namespace std; class A{…
A: Given, Code: #include <iostream> using namespace std; class A{ public: A(){…
Q: What gets printed by executing the following code? def sets() : - {'a','b','c','d'}…
A: Question:-
Q: tinclude using namespace std; void run1b(int&, int, int); int run2b((); int x=2; int main(){ int x,…
A: Explanation: initially read the value of x is 2. Take the y value is 1 and z value is 1. next call…
Q: Solution in JS Write a function that inserts a white space between every instance of a lower…
A: In this problem, we need to design the code in the Js programming language. Input - String Output…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- An “inverted file” is a critical data structure for implementing applications like the index of a book, or a web search engine. Given a document D (which can be viewed as an unordered, numbered list of words), an inverted file is an ordered list of words L such that for each word W in L, we store the indices of the places in D where W appears. Write a C# program (from scratch please, written by yourself (ask instructor if you are stuck), not borrowed from any other sources) that reads in a list of words separated by spaces from a text file, then uses an efficient O(N) algorithm to create the inverted file index (hint: consider the topic of this chapter, consider using a Dictionary/hashtable to help you), and writes this index out to another file or prints it to the screen. Each line of the output file should start with the next word (the words should be listed in alphabetical order, and this sorting does not have to be part of the O(N) runtime complexity, e.g. you can use regular…Please explain the flow of this C++ Program. It doesn't have to be long as long as you explain the each function of the program, if you can explain it line by line then it is better and I will give you a good rating. #include <cstdlib> #include <math.h> #include <cstring> #include <iostream> using namespace std; class HashTable { string* table; int N; int count; // TODO: Polynomial Hash Code using a=7 int hash_code(string key) { int code; int hash = 0; for (int i = 0; i < key.size(); i++) { char ch = key[i]; code += ((ch - 96) * pow(7, key.size() - (i + 1))); } return code; } // TODO: This hash table uses a MAD compression function // where a = 11, b = 461, p = 919 int compress(int code) { return (((11*code)+461) % 919) % N; } // Using the knowledge that a hash function is composed of two portions int hashfn(string key) { return compress(hash_code(key)); } public:…i need comments on the code example: int x; // declare x and life cycle VB Code Imports SystemImports System.Collections.GenericImports System.ComponentModelImports System.DataImports System.DrawingImports System.LinqImports System.TextImports System.Threading.TasksImports System.Windows.Forms Namespace StudentPublic Partial Class Form1Inherits Form Public Sub New()InitializeComponent()End Sub Private Sub btnCalculatePerc_Click(ByVal sender As Object, ByVal e As EventArgs)txtPercentage.Text = ((Convert.ToInt32(txtMark1.Text) + Convert.ToInt32(txtMark2.Text) + Convert.ToInt32(txtMark3.Text)) / 3).ToString()End Sub Private Sub btnDisplayGrade_Click(ByVal sender As Object, ByVal e As EventArgs)If Convert.ToDouble(txtPercentage.Text) >= 80 ThentxtLevel.Text = "Excellent"ElseIf Convert.ToDouble(txtPercentage.Text) >= 70 AndAlso Convert.ToDouble(txtPercentage.Text) <= 79 ThentxtLevel.Text = "Very Good"ElseIf Convert.ToDouble(txtPercentage.Text) >= 60 AndAlso…
- Could you help me with this one too, please Regex, APIs, BeautifulSoup: python import requests, refrom pprint import pprintfrom bs4 import BeautifulSoup complete the missing bodies of the functions below: def group_chat(text_message, friend):"""Question 2- Your friends are blowing up your group chat. Given a string of text messagesfrom your friends and a specific friend's name, return the first text messagethey sent, excluding their name.- Each text message ends with either a ?, !, or .- Your code must be written in one line. Args:text_message (astr)friend (astr)Returns:str of first match>>> text_message = "Madison: How are you guys going today?" + \"Anna: I'm doing pretty well!" + \"Madison: That's good to hear. How is everyone else?">>> friend = "Madison">>>group_chat(text_message, friend)How are you guys going today?"""pass test code: # text_message = "Madison: How are you guys going today?" + \# "Anna: I'm doing pretty well!" + \#…Define a class StatePair with two template types (T1 and T2), constructors, mutators, accessors, and a PrintInfo() method. Three vectors have been pre-filled with StatePair data in main(): vector<StatePair <int, string>> zipCodeState: ZIP code - state abbreviation pairs vector<StatePair<string, string>> abbrevState: state abbreviation - state name pairs vector<StatePair<string, int>> statePopulation: state name - population pairs Complete main() to use an input ZIP code to retrieve the correct state abbreviation from the vector zipCodeState. Then use the state abbreviation to retrieve the state name from the vector abbrevState. Lastly, use the state name to retrieve the correct state name/population pair from the vector statePopulation and output the pair. Ex: If the input is: 21044 the output is: Maryland: 6079602 #include<iostream>#include <fstream>#include <vector>#include <string>#include "StatePair.h"using namespace…Define a class StatePair with two template types (T1 and T2), constructors, mutators, accessors, and a PrintInfo() method. Three vectors have been pre-filled with StatePair data in main(): vector<StatePair <int, string>> zipCodeState: ZIP code - state abbreviation pairs vector<StatePair<string, string>> abbrevState: state abbreviation - state name pairs vector<StatePair<string, int>> statePopulation: state name - population pairs Complete main() to use an input ZIP code to retrieve the correct state abbreviation from the vector zipCodeState. Then use the state abbreviation to retrieve the state name from the vector abbrevState. Lastly, use the state name to retrieve the correct state name/population pair from the vector statePopulation and output the pair. Ex: If the input is: 21044 the output is: Maryland: 6079602 #include<iostream>#include <fstream>#include <vector>#include <string>#include "StatePair.h"using namespace…
- Define a class StatePair with two template types (T1 and T2), constructors, mutators, accessors, and a PrintInfo() method. Three vectors have been pre-filled with StatePair data in main(): vector<StatePair <int, string>> zipCodeState: ZIP code - state abbreviation pairs vector<StatePair<string, string>> abbrevState: state abbreviation - state name pairs vector<StatePair<string, int>> statePopulation: state name - population pairs Complete main() to use an input ZIP code to retrieve the correct state abbreviation from the vector zipCodeState. Then use the state abbreviation to retrieve the state name from the vector abbrevState. Lastly, use the state name to retrieve the correct state name/population pair from the vector statePopulation and output the pair. Ex: If the input is: 21044 the output is: Maryland: 6079602 -main.cpp: #include<iostream> #include <fstream> #include <vector> #include <string> #include "StatePair.h"…Regex, APIs, BeautifulSoup: python import requests, refrom pprint import pprintfrom bs4 import BeautifulSoup complete the missing bodies of the functions below: def mathmatic(target):"""Question 1You are doing fun math problems. Given a string of combination of '{}', '[]','()', you are required to return the substring included by the outermost '{}'.You need to write your code in one line.Args:target (str): the string to search inReturns:str>>> mathmatic('{[[[[]()]]]}')'[[[[]()]]]'>>> mathmatic('[(){([{}])}]')'([{}])'"""pass test code: # print(mathmatic('{[[[[]()]]]}'))# print(mathmatic('[(){([{}])}]'))This question was rejected because lack of a text file, which I do not see a way to upload. I saved the first part of the file as an image because that is all I can upload. If that doesn't suffice, please advise how to include a text file. In C++, I would like some help improving or making a better password lookup function for a Hash Table class/program I made, The function: it is supposed to lookup a user password using their ID and name which I read in from a text file. The one I have only works for the first 10 records, which I highlighted below in the program. string lookupPassword (string inUserID, string inUserName){ string thePassword; ... return thePassword; } Here is part of the program thus far: // Hash.cpp #include <iostream>#include<string>#include<iomanip>#include<fstream>using namespace std;//node classclass nodeBST {private: //user data string userID; string userName; string userPW; //BST left and right children nodeBST*…
- Could u help in making function headers and type contracts in the following? def aragorn(x: int, y: str, z: float) -> str: def gandalf(x: list) -> list: def elrond(x: list, y: bool) -> bool: If the following code runs without errors, what is a header and type contract for treebeard? a = aragorn(11, 'good', 2.0) b = treebeard(5, gandalf([1, 2, 3]), a) print(elrond(gandalf([4, 5]), b))I am having a hard time understanding the output of this program with shadow and deep binding. Can someone explain it more in detail? I posted the answers below x : integer – – globalprocedure set x(n : integer)x := nprocedure print x()write integer(x)procedure foo(S, P : function; n : integer)x : integer := 5if n in {1, 3}set x(n)elseS(n)174 Chapter 3 Names, Scopes, and Bindingsif n in {1, 2}print x()elsePset x(0); foo(set x, print x, 1); print x()set x(0); foo(set x, print x, 2); print x()set x(0); foo(set x, print x, 3); print x()set x(0); foo(set x, print x, 4); print x() Here are the answers to the questions. The program prints = 10 20 30 40 with shallow binding The program prints = 10 52 00 44 with deep binding,Analyze the time complexity of this program in big-O notation, assuming the size of L1 is n and the size of L2 is n too public static <AnyType extends Comparable<? super AnyType>>void intersection(List<AnyType> L1, List<AnyType> L2,List<AnyType> Intersect){ ListIterator<AnyType> iterL1 = L1.listIterator();ListIterator<AnyType> iterL2 = L2.listIterator(); AnyType itemL1=null, itemL2=null; // get first item in each listif ( iterL1.hasNext() && iterL2.hasNext() ){itemL1 = iterL1.next();itemL2 = iterL2.next();} while ( itemL1 != null && itemL2 != null ){int compareResult = itemL1.compareTo(itemL2); if ( compareResult == 0 ){Intersect.add(itemL1);itemL1 = iterL1.hasNext()?iterL1.next():null;itemL2 = iterL2.hasNext()?iterL2.next():null;}else if ( compareResult < 0 ){itemL1 = iterL1.hasNext()?iterL1.next():null;}else{itemL2 = iterL2.hasNext()?iterL2.next():null;}}