Computer Systems: A Programmer's Perspective (3rd Edition)
3rd Edition
ISBN: 9780134092669
Author: Bryant, Randal E. Bryant, David R. O'Hallaron, David R., Randal E.; O'Hallaron, Bryant/O'hallaron
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 7, Problem 7.9HW
Consider the following program, which consists of two object modules:
When this program is compiled and executed on an x86-64 Linux system, it prints the string 0×48\n and terminates normally, even though function p2 never initializes variable main. Can you explain this?
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
write a program to encrypt outgoing messages and decrypt incoming messages using a Vigenere Cypher. Parse a string of words from a file into tokens using the strtok_s command with pointers. In your “client” code, you will need to declare a character array that will hold 1000 characters. Using the character array, your client should call the function strtok_s() to tokenize the character array into separate words.
There should be two classes: Vigenere and Message.
Vigenere Class: Data Member: string key
Functions: Vigenere() ßconstructor
void setKey(string k)
string getKey()
string toUpperCase(string k)
string encrypt(string word)
string decrypt(string word)
The class should have a one-argument constructor. The encryption key must be in all capital letters.
Use the following code for the encrypt and decrypt functions in your Vigenere class.
string Vigenere::encrypt(string word){
string output;
for (int i = 0, j = 0; i < word.length(); ++i)…
Write an address book program that stores your contacts' names and their email addresses. The names and email addresses are originally stored in a file called phonebook.in, in the format: Harry Potter t..d@hogwarts.edu Hermione Granger b..h@hogwarts.edu Ron Weasley r..b@hogwarts.edu Draco Malfoy m..s@hogwarts.edu Severus Snape h..e@hogwarts.edu Albus Dumbledore a..x@hogwarts.edu Your program should read from the file, storing the names and corresponding email addresses in a dictionary as key-value pairs. Then, the program should display a menu that lets the user enter the numbers 1 through 5, each corresponding to a different menu item: 1) look up an email address 2) add a new name and email address 3) change an email address 4) delete a name and email address 5) save address book and exit When the user enters 1, the program should prompt them for a name, and then print the corresponding email address. If there is no dictionary entry under that name, the program should print, "Sorry,…
The following Python code returns this error, and I have no idea how to fix it. Any and all help would be appreciated
Traceback (most recent call last): File "D:\Grand Canyon University\CST_580\Topic 4\project 6a.py", line 40, in <module> agent.move() File "D:\Grand Canyon University\CST_580\Topic 4\project 6a.py", line 13, in move new_location = self.current_location + direction ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~TypeError: unsupported operand type(s) for +: 'int' and 'str'
<start of Python code>
import random
class Agent: def __init__(self, start_location, destination_location): self.current_location = start_location self.destination_location = destination_location
def move(self): # Randomly choose a direction to move in direction = random.choice(['up', 'down', 'left', 'right'])
# Move in the chosen direction new_location = self.current_location + direction
# Calculate the distance to the…
Chapter 7 Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
Ch. 7.5 - Prob. 7.1PPCh. 7.6 - Practice Problem 7.2 (solution page 718) In this...Ch. 7.6 - Practice Problem 7.3 (solution page 718) Let a and...Ch. 7.7 - Prob. 7.4PPCh. 7.7 - Prob. 7.5PPCh. 7 - This problem concerns the m. o module from Figure...Ch. 7 - Without changing any variable names, modify bar5.c...Ch. 7 - Prob. 7.8HWCh. 7 - Consider the following program, which consists of...Ch. 7 - Let a and b denote object modules or static...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Phone Book Program Design a program that you can use to keep all of your friends names and phone numbers in a f...
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Consider the adage Never ask a question for which you do not want the answer. a. Is following that adage ethica...
Using MIS (10th Edition)
Solve the differential equation dydx=xy1x+y+3 by finding h and k so that the substitutions x=u+h, y=v+k transfo...
Differential Equations: Computing and Modeling (5th Edition), Edwards, Penney & Calvis
List the functions of a database application.
Database Concepts (8th Edition)
Write a SELECT statement that will return the TradingSymbol column only from the rows where SellingPrice is gre...
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
What, if anything, prints when each of the following statements is performed? If nothing prints, then answer No...
C How to Program (8th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- What is the distinction between the static and extern storage classes? Give appropriate examples to back up your response.arrow_forwardYou are given a class with synchronized method A and a normalmethod B. If you have two threads in one instance of a program, can they both execute A at thesame time? Can they execute A and B at the same time?arrow_forwardWrite a carpet bombing program in code blue that zeros out all of memory( with the possible exception of the program location)arrow_forward
- What is the distinction between the static and extern storage classes? Give appropriate instances in in support of your responsearrow_forwardWhen I attempt to run this program, I am getting an ArrayIndexOutOfBounds Exception on line 21 of the given Main. What is causing this to occur and what can be done to fix it? import java.io.BufferedReader;import java.io.FileReader;import java.io.IOException;import java.util.LinkedList;public class Main{public static void main(String[] args) throws IOException {// Create a new LinkedList object for holding the ValueData object:LinkedList<ValueData> linkedList = new LinkedList<>();// Create a new ObjectStack objectObjectStack objectStack = new ObjectStack();// Read a text file containing lines (records) of ValueData.// This is in order to fill the LinkedList with ValueData from the file.BufferedReader reader = new BufferedReader(new FileReader("values.txt"));String line = reader.readLine();while (line != null) {String[] parts = line.split(",");String name = parts[0].trim();int value = Integer.parseInt(parts[1].trim());ValueData data = new ValueData(name,…arrow_forwardWrite a program that replaces all occurrences of a word with anew word in all the files under a directory, recursively. Pass the parameters fromthe command line as follows:java Exercise18_31 dirName oldWord newWordarrow_forward
- You have written a C program which was stored in file someProgram.c, under directory /home/chloe/TestingCode; in that same directory, you have a sub-folder called Old. Answer the following questions (by typing the appropriate single command line instruction in each case), assuming you are currently in /home/chloe/TestingCode: Compile the code in someProgram.c. Create a new sub-folder called New under /home/chloe. Show the location (i.e., the full path) of the current directory. Make a copy of the file someProgram.c and call it someProgram_v2.c.arrow_forwardHey there I am struggling with creating a second class module in PYTHON - that would import an already existing class I have finished from another module file called LANDINGSPOT, the class I am struggling with follows the exact order below* - class PLANE first-class which is done (Landingspot CLASS with objects ID, city, country ) and am trying to create another class module PLANE. (flightNumber, Start, goingTo). Each class would be eventually reading from text files with some spaces and commas separating randomly that’s where they would be getting data but that's for another module, which would need to import PLANE class. 'As suggested by its name, this class represents a 'Plane' from one landingSpot to another landingSpot in the program. Each Plane object must have a flightNumber (the unique 6-character code containing 3 letters followed by 3 digits), Start place, and a goingTo. Both the Start and goingTo must be LandingSpot objects within the…arrow_forwardIs overloading correct?arrow_forward
- Implement a simple version of the linux cat command in C++. Use the system calls open(), get() and close(). cat - reads a file as specified by the user and prints its contents. A typical usage is as follows: If from my terminal y run ./cat main.cpp the contents of main.cpp. will be printed. Your program cat can be invoked with one or more files on the command line; it should just print out each file in turn. Example: [terminal]$ ./cat main.cpp main2.cpp #include <iostream>using namespace std;int main(){cout << "Hello, World!"; return 0;}#include <iostream>using namespace std;int main(){cout << "Programming is great fun!";return 0;} As you can see content of main.cpp was printed first and the content of main2.cpparrow_forwardWrite in C for STM32F446RE microcontroller on the Nucleo-64 dev board uncluding proper header files Write a source library that contains the with the following public functions: void keypadInit(void); /Initiallized the GPIO to read the keypad. uint16_t readKeypad(void); //Returns the state of all of the keypad buttons in the return value at the moment the function is called. void decodeKeypad(uint16_t, char *); //Takes the state of the keypad and returns (by reference) an array of the key's pressed. The library should work with the following main: int main (void) { uint16_t key; char carray[17]; keypadInit(); while(1) { while(!(key = readKeypad())); /*Get which keys pressed*/ decodeKeypad(key, carray); /*What are those keys*/ printf("%s\n",carray); /*Print those keys to screen*/ while(readKeypad() == key); /*Wait for the keypad to change*/ }} Problem 1: Write a library that works with the following…arrow_forwardThis is a MASM Project Assembly Code for x86 Processors ! The code below is supposed to copy whatever's in the source variable into the target variable. However, there is a single error, which will cause it to work correctly if fixed. What is it? .datasource WORD 10 DUP("AO")target WORD 10 DUP(?).codemov esi, OFFSET sourceadd esi, 18mov edi, OFFSET targetadd edi, 18mov ecx, LENGTHOF targetstdrepe movsw Group of answer choices: A: 18 should not be added to the ESI and EDI registers B: ECX should be set to the length of the source, not the target C: The direction flag should be cleared with CLD, not set with STD D: The REPE prefix should be replaced with REParrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Instruction Format (With reference to address); Author: ChiragBhalodia;https://www.youtube.com/watch?v=lNdy8HREvgo;License: Standard YouTube License, CC-BY