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 9.8, Problem 9.5PP
Practice Problem 9.5 (solution page 882)
Write a C
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
[PYTHON]
For this programming assignment I want you to write a program that calculates bigram frequencies for a set of text.
Your program should assess the text and calculate the frequency of word pairs that occur throughout the entire file.
Your program should ignore case (meaning "the dog" and "The dog" should count as the same phrase).
Your program should write out the frequency count for each uniquely occurring bigram to a file with the count and the bigram separated by a tab.
As an example, bigram frequencies for the following sentence are:
Sentence: The dog and the cat do not get along because the dog is mean to the cat and the cat is aloof to the dog.
Bigrams:
the cat
3
the dog
3
and the
2
to the
2
along because
1
aloof to
1
because the
1
cat and
1
cat do
1
cat is
1
do not
1
dog and
1
dog is
1
get along
1
is aloof
1
is mean
1
mean to
1
not get
1
[no. 19] When would you use a while loop?
a. when you want some code to continue running as long as some condition is true
b. when you want to run code in one file while code in another file is also running
c. when you want to minimize the use of strings in your code
d. when you need to run two or more chunks of code at once within the same file
Problem 2 (Cipher module)• Create a Python file named cipher_module.py with functions to encode and decodestring inputs using the basic Caesar cipher (see here for more informationhttps://en.wikipedia.org/wiki/Caesar_cipher). This cipher is a basic encryptiontechnique that supports encoding and decoding operations on strings.• The encoding operation replaces each character in a string with another charactersome fixed number (shift) of positions down the ASCII table. The string can beencoded using any characters on the ASCII table and no need to use the circular list(where ‘Z’ is followed by ‘A’) image shown below. Your module must have a functionnamed encode() that takes a string and an integer shift (can be positive or negative)as parameters and returns the encoded string using the shift value. This module must
Page 3 of 4also have a second function name decode() that takes an encoded string and aninteger shift as parameters and returns the decoded string. The decoding…
Chapter 9 Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
Ch. 9.2 - Prob. 9.1PPCh. 9.3 - Prob. 9.2PPCh. 9.6 - Prob. 9.3PPCh. 9.6 - Prob. 9.4PPCh. 9.8 - Practice Problem 9.5 (solution page 882) Write a C...Ch. 9.9 - Prob. 9.6PPCh. 9.9 - Prob. 9.7PPCh. 9.9 - Prob. 9.8PPCh. 9.9 - Prob. 9.9PPCh. 9.9 - Prob. 9.10PP
Ch. 9 - Prob. 9.11HWCh. 9 - Repeat Problem 9.11 for the following address....Ch. 9 - Repeat Problem 9.11 for the following address....Ch. 9 - Given an input file hello.txt that consists of the...Ch. 9 - Determine the block sizes and header values that...Ch. 9 - Prob. 9.16HWCh. 9 - Prob. 9.17HWCh. 9 - Prob. 9.18HWCh. 9 - Prob. 9.19HWCh. 9 - Write your own version of malloc and free, and...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Briefly describe what each of the following statements does. file.seekp(100L, ios::beg); file.seekp(-10L, ios::...
Starting Out with C++: Early Objects (9th Edition)
How does the typing system of PHP and JavaScript differ from that of Java?
Concepts Of Programming Languages
(Diameter, Circumference and Area of a Circle) Write a program that reads in the radius of a circle and prints ...
C How to Program (8th Edition)
Consider the adage Never ask a question for which you do not want the answer. a. Is following that adage ethica...
Experiencing MIS
Find the errors in the following code: 2. // Warning! This code contains an ERROR! if (average = 100) System.ou...
Starting Out with Java: Early Objects (6th Edition)
Use the following tables for your answers to questions 3.7 through 3.51 : PET_OWNER (OwnerID, OwnerLasst Name, ...
Database Concepts (7th 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
- File system implementation: a. Given a filename in a directory’s data block, how does OS locate the data block of a file? b. Compare between direct pointers and indirect pointers in referencing data blocks. c. Given a 6GB file, identify the number of index level needed when using indirect pointer.arrow_forwardProblem 0. Suppose a file contains 100 bytes of data. A program successfully opens it for both reading and writing (i.e., passing the mode O_READWR to open()), and gets back a file descriptor number fd. a. The program, which has a 40-byte buffer, issues a call to read() for 40 bytes. It processes that data, and then repeats the call. Both calls return the exact amount requested. Then it issues a third read, again requesting 40 bytes. What value will it return? (Assume no other program has the file open.) b. Next the program calls write (fd, buffer, 40), and the call returns 40. Then it issues another read() call for 40 bytes. What value does that call return? c. Suppose the programmer needs to read back the 40 bytes just written. First it must use 1seek() to reposition the file pointer. What parameters should it invoke 1seek () with so that the next read call will return the 40 bytes just written?arrow_forward(3) Create the final cpp file under Source files and name it 2D Imaging. Write a C++ program to replace the star or asterisk (*) character with any other character of your choice. You may choose to use that ascii code of one of the characters. You must write a 2-Dimenional loop to programmably replace the character. To do this you must list on paper the row and column pairs of the 2D array that stores the given character. You may see a pattern of number series. Use this pattern to write the loops. The image pattern draws a V shape on the 12rows-11column 2D Grid or board. { {' }; '}, '}, '}, '},arrow_forward
- (1) Create a cpp file Array Operations under Source files folder. Write a program in C++ to declare an array called mark. This array will store marks of an assessment like practical, assignment or test for 16 students. Therefore, the size of the array should be 16. a. Number of available marks are 10 for ten students, however there are 16 students, therefore, the remaining marks will be read into the program while the program is running. For now, initialize the array with given marks. 7.3 8.6 10.65 16.4 13.5 6.35 17.3 4.4, 8.5, 12.7 b. With reference to unavailability of remaining 6 marks in part a, write codes to read these remaining six marks and add them at the end as you read. c. Write codes to count the numbers above the average. d. Write codes to determine the highest mark a student scored. e. Display all the important data and results with descriptive relevant labels. [At the end of this activity, comment out your program, so that you next program of activity 2 below will…arrow_forwardI am having difficulties with reverse geocoding.1) Read the comma-separated file (coords.csv, first table) containing coordinates (latitudes and longitudes), 2) Reverse geocode each coordinate, using the GeoPy - Nominatim reverse geocoding service, and 3) Save the result to a file named "regeo.csv" in an output directory.5) The resulting CSV file, "regeo.csv" should have only six columns displaying Name, Address, City, State, ZIP, and Country (see example below). coords.csv Latitude Longitude 37.365825 -121.932533 37.760816 -122.45099 34.040961 -118.279955 32.732594 -117.182865 38.577309 -121.437613 37.714513 -119.53361 36.416937 -116.969059 33.304015 -115.811139 41.199164 -124.008404 39.120116 -120.061495 format for regeo.csv Name Address City State ZIP County from geopy.geocoders import Nominatim filename = "./data/coords.csv"out_file = "./output/regeo.csv" data = [] with open(filename, 'r') as file: for line in file: line =…arrow_forwardI need help with this: (Address book) Write a program that stores, retrieves, adds, and updates addresses as shown in Figure 17.20. Use a fixed-length string for storing each attribute in the address. Use random access file for reading and writing an address. Assume that the size of name, street, city, and zip is 32, 32, 20, 2, 5 chars, respectively.arrow_forward
- Problem 2. Suppose a certain file contains only these letters with the following frequencies AEGILP|R|SUV 14 13 12 3 3 1 1 (b) (a) Construct the comma-free code that enables you to compress the file so that you can store it the least number of bits. In case two or more letters have the same frequency, order them alpha- betically from left to right. Use the comma-free code you construct from part (à) to decrypt the following: 001/1/0001 συμψbi|p1110111000x44130xpaoooq|1001111001111101001000101arrow_forwardUsing C program, thanks appreciate your help! Program Requirements: There should be 2 separate programs for write and Read. mknod() - Creates the named pipes Define the length of your message on a buffer Define your descriptor Use the open() O_WRONLY O_RDWR In your program, consider the following: Use the read() function to read nbytes from the file associated with the andle, and places the characters read into the buffer. Make sure you indicate the number of characters on the reader output. Use gets() to read the characters from stdin() that are stored in your buffer. Show the Parent and Chile terminal screenshots (During the code simulation).arrow_forwardQuestion 4 (PROGRAMMING) A classification algorithm is a kind of machine learning algorithm which is used to assign a label to an object, based on the knowledge of similar objects. Write a C program able to implement the classification algorithm 1-NN. The program receives as input two files and , whose names are passed as arguments from the command line: The file contains a set of N objects (one for each line), each one with the corresponding label. This file is used to train the classification algorithm, which learns how to recognize the known objects. Each line of the file contains the name of the object represented as a string at most 5 characters, a set of M real numbers T1 T2 T3 .. TM, followed by an integer L. The space character is used to separate the elements. The M real numbers are the features that represents an object. The integer L is the object label. The file contains a set of objects to be classified. The format is similar to the file, but the number of rows is NOT…arrow_forward
- Purpose: To practice write a list of records to a tabular text file Degree of Difficulty: Moderate. In this question, your program will define a function named fnWriteState(), with two input parameters: · A list of records (the list of state of all days) · A string of a path name of the output file And there is no return values of this function. In this function, your program will write the list of state to a tabular file. It is notable that the output file should locate in the same folder of the a6.py file. In the state output file, the first line is names of the time, S, I and R. And lines from the second to the last line of the output file contain every day's state of S, I and R in the list of state, and also with the item of time (indicates the index of the day). Each record in the list of state will be written in one line. And the items of each line will be separated by commas. Basically, the format of the state output file is the same as the state input file. But in the state…arrow_forward2. Peter likes singing songs and playing music with an electric piano. (a) Peter uses an electric piano to play and record some music in a file. He then plays the file back with the sound of violin. (i) What is the file format? (ii) Other than file size, give an advantage of using the file format in (a)(i).arrow_forward(a) Write a C function readNums() that takes a filename and an integer array, reads the integer numbers in the file and stores into the array, returns the number of numbers stored in the array. Assume that the file only contains integer numbers, and nothing else. Prototype: int readNums(char filename[], int arr[]); (b) Write a C function delWordN() that takes a string and an integer (n) as parameter, removes from the string the words that are n character long. A word is a group of consecutive alphanumeric characters; words are separated by non-alphanumeric characters. ps: please do not copy paste from chegg or anywhere else. write unique codearrow_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