New Semester
Started
Get
50% OFF
Study Help!
--h --m --s
Claim Now
Question Answers
Textbooks
Find textbooks, questions and answers
Oops, something went wrong!
Change your search query and then try again
S
Books
FREE
Study Help
Expert Questions
Accounting
General Management
Mathematics
Finance
Organizational Behaviour
Law
Physics
Operating System
Management Leadership
Sociology
Programming
Marketing
Database
Computer Network
Economics
Textbooks Solutions
Accounting
Managerial Accounting
Management Leadership
Cost Accounting
Statistics
Business Law
Corporate Finance
Finance
Economics
Auditing
Tutors
Online Tutors
Find a Tutor
Hire a Tutor
Become a Tutor
AI Tutor
AI Study Planner
NEW
Sell Books
Search
Search
Sign In
Register
study help
business
principles algorithms and systems
Computer Systems 5th Edition J Stanley Warford - Solutions
13. Write a machine language program to output the three characters Cat on the output device.Write it in a format suitable for the loader and execute it on the Pep/9 simulator.
12. Write a machine language program to output the four characters Frog on the output device.Write it in a format suitable for the loader and execute it on the Pep/9 simulator.
11. Write a machine language program to output your name on the output device. The name you output must be longer than two characters. Write it in a format suitable for the loader and execute it on the Pep/9 simulator.
10. Suppose you need to process a list of 31,000 integers contained in Pep/9 memory at one integer per word. You estimate that 20% of the instructions in a typical program are unary instructions. What is the maximum number of instructions you can expect to be able to use in the program that
9. Determine the output of the following Pep/9 machine language program. The left column in each part is the memory address of the first byte on the line:*(a)0000 C1000A 0003 81000C 0006 F1FC16 0009 00 000A A94F 000C FFFD(b)0000 C10008 0003 06 0004 F1FC16 0007 00 0008 F0D4
8. Determine the output of the following Pep/9 machine language program if the input is tab. The left column is the memory address of the first byte on the line:0000 D1FC15 0003 F1001F 0006 D1FC15 0009 F10020 000C D1FC15 000F F10021 0012 D10020 0015 F1FC16 0018 D1001F 001B F1FC16 001E 00
7. Determine the output of the following Pep/9 machine language program. The left column is the memory address of the first byte on the line:0000 D10013 0003 F1FC16 0006 D10014 0009 F1FC16 000C D10015 000F F1FC16 0012 00 0013 4A6F 0015 79
6. Repeat Exercise 5 for the following statements:(a) C90A3F(b) D90A3F(c) F10A41(d) E10A41(e) 690A3F(f) 710A41(g) 890A3F(h) 990A3F(i) 06
5. Suppose Pep/9 contains the following four hexadecimal values:A: 19AC X: FE20 Mem[0A3F]: FF00 Mem[0A41]: 103D If it has these values before each of the following statements executes, what are the four hexadecimal values after each statement executes?(a) C10A3F (b) D10A3F (c) D90A41 (d) F10A41 (e)
4. Answer the questions in Exercise 3 for the machine language instructions 7B00AC and F70BD3.
3. Answer the following questions for the machine language instructions 6AF82C and D623D0.(a) What is the opcode in binary? (b) What does the instruction do? (c) What is the register-r field in binary? (d) Which register does it specify? (e) What is the addressing-aaa field in binary? (f) Which
2. (a) Suppose the main memory of the Pep/9 were completely filled with unary instructions.How many instructions would it contain? (b) What is the maximum number of instructions that would fit in the main memory if none of the instructions is unary? (c) Suppose the main memory is completely filled
1. (a) How many bytes are in the main memory of the Pep/9 computer? (b) How many words are in it? (c) How many bits are in it? (d) How many total bits are in the Pep/9 CPU? (e)How many times bigger in terms of bits is the main memory than the CPU?
21. Perform the following logical operations, assuming a nine-bit cell: 0 1001 0011 AND 1 0111 0101 N = (a) 7 = AND N = 0 0000 1111 10111 0101 (b) Z = 0 1001 0011 OR 1 0111 0101 N = (c) 7 = 0 0000 1111 OR 10111 0101 N = (d) 7 = 0 1001 0011 XOR 1 0111 0101 N = (e) 7 = 0 0000 1111 XOR 1 0111 0101 N =
20. Perform the following logical operations, assuming a seven-bit cell: 010 1100 AND 110 1010 N = (a) Z = 000 1111 AND 101 0101 N = (b) Z = 010 1100 OR 110 1010 N = (c) Z = 000 1111 OR 101 0101 N = (d) Z = 010 1100 XOR 110 1010 N = (e) Z =
18. Perform the following additions, assuming nine-bit two’s complement binary representation.Show the effect on the status bits: 0 1010 1100 ADD 00011 1010 N = z = V = (a)C= 11110 0101 ADD 00011 0101 N = z= V = (b) C. = 1 0001 1011 ADD 1 0101 0100 N = Z= V = (c) C = 1 1000 0101 ADD 11101 0110 N
17. Perform the following additions, assuming seven-bit two’s complement binary representation. Show the effect on the status bits: 010 1011 ADD 000 1110 N = Z= V = (a) C =
9. Perform the following additions on unsigned integers, assuming a nine-bit cell. Show the effect on the carry bit: 0 0100 1011 ADD 01101 0001 (a) C= 1 0001 1101 ADD 0 1110 1000 (b) C.= 1 1111 1111 ADD 0 0000 0001 (c) C = 1 1111 1111 ADD (d) C = 1 1111 1111
8. Perform the following additions on unsigned integers, assuming a seven-bit cell. Show the effect on the carry bit: ADD (a) C = 010 1011 100 1001
18. Declare the following node for a binary search tree:struct node {node *left;int data;node *right;};where left is a pointer to the left subtree and right is a pointer to the right subtree. Write a C program that inputs a sequence of integers with –9999 as a sentinel and inserts them into a
17. The program in Figure 2.41 creates a linked list whose elements are in reverse order compared to their input order. Modify the first loop of the program to create the list in the same order as the input order. Do not modify the second loop.Sample Input 10 20 30 40 -9999 Sample Output 10 20 30 40
16. Write a function int maximum (int list[], int n)that recursively finds the largest integer between list[0] and list[n]. Assume at least one element is in the list. Test it with a main program that takes as input an integer count followed by the values. Output the original values followed by the
15. Write a recursive void function called rotateLeft() with two parameters, an array and an integer count n, that rotates the first n integers in the array to the left. To rotate n items left, rotate the first n – 1 items left recursively, and then exchange the last two items. For example, to
14. Write a C program that prints the solution to the Towers of Hanoi puzzle. It should ask the user to input the number of disks in the puzzle, the peg on which all the disks are placed initially, and the peg on which the disks are to be moved.Sample Input/Output How many disks do you want to
13. Write a C program that asks the user to input a small integer. Then use a recursive function that returns the value of that Fibonacci number as defined in Exercise 4. Do not use a loop.Output the value in the main program, not in the function.Sample Input/Output Which Fibonacci number? 8 The
12. Write a C function void rect(int *ar, int *per, int len, int wid)that computes the area ar and perimeter per of a rectangle with length len and width wid. Test it with a main program that inputs the length and width of a rectangle and outputs its area and perimeter. Output the value in the main
11. Write a C function int rectArea (int len, int wid)that returns the area of a rectangle with length len and width wid. Test it with a main program that inputs the length and width of a rectangle and outputs its area. Output the value in the main program, not in the function.Sample Input 6 10
10. Write a C program that inputs two integers and outputs the sum of the integers between them.Sample Input 9 12 Sample Output The sum of the numbers between 9 and 12 inclusive is 42.
9. Write a C program that inputs an integer and outputs whether the integer is even.Sample Input 15 Sample Output 15 is not even.
8. Write a C program that inputs two integers and outputs their quotient and remainder. To output the % character, you must write it as %% in the format string.Sample Input 13 4 Sample Output 13/4 has value 3.
7. Examine the C program that follows: (a) Draw the run-time stack just after the procedure is called for the last time, including the stack frame for main(). (b) What is the output of the program?#include void what(char *word, int j) {if (j > 1) {word[j] = word[3 - j];what(word, j - 1);} // ra2}
6. The mystery numbers are defined recursively as myst(n)={2ifn=0,1ifn=1,2×myst(n−1)+myst(n−2)ifn>1.(a) Draw the call tree in the style of Figure 2.30 for myst(4).(b) What is the value of myst(4)?
5. For your solution to the Towers of Hanoi in Problem 2.14, draw the call tree for the fourdisk problem. How many times is your procedure called, including the call from main()? What is the maximum number of stack frames on the run-time stack, not including the stack frame for main()?
4. The Fibonacci sequence is 0 1 1 2 3 5 8 13 21 . . .Each Fibonacci number is the sum of the preceding two Fibonacci numbers. The sequence starts with the first two Fibonacci numbers and is defined recursively as fib(n)={0ifn=0,1ifn=1,fib(n−1)+fib(n−2)ifn
3. Draw the call tree in the style of Figure 2.30 for the program in Figure 2.32 to reverse the letters of an array of characters, assuming the initial string is "Backward". How many times is function reverse() called, including the call from main()? What is the maximum number of stack frames
2. Each exercise below has five parts, as follows: (1) Draw the call tree in the style of Figure 2.30 for the function binCoeff() of Figure 2.28 assuming the given call statement from the main program. (2) Write down the sequence of calls and returns using the indentation notation on page 92. (3)
1. The function sum() in Figure 2.25 is called for the first time by the main program. From the second time on, it is called by itself. *(a) How many times is it called altogether, including the call from main()? (b) Draw a picture of the main program variables and the run-time stack just after the
23. (a) Write the statements to produce Result2 in Figure 1.32, but with the project command before the select. (b) Write the statements to produce Result3 in Figure 1.22, but with join as the last statement.
22. Write the statements for the following queries of the database in Figure 1.31. *(a) Find Beth’s home state. (b) List the fraternity members who are English majors. (c) List the sorority and fraternity members who have the same home state, and indicate what that home state is.
21. Write the relations Temp5 and Temp6 from the discussion in Section 1.5 of the chapter.
20. A tablet has a 7.5- × 5.8-inch screen size with a resolution of 326 pixels per inch. (a) How many pixels does it have? (b) With 256 levels of brightness for each color subpixel, what is the MiB size of the display memory?
19. A mobile phone has a 3.48- × 1.96-inch screen size with a resolution of 326 pixels per inch.(a) How many pixels does it have? (b) With 256 levels of brightness for each color of subpixel, what is the MiB size of the display memory?
18. An eReader has a 956- × 1290-pixel grayscale display with each pixel able to display 32 shades of gray. What is the KiB size of the display memory for the device?
17. (a) A desktop laser printer has a 300 dots-per-inch resolution. If each dot is stored in one bit of memory, how many MiB of memory are required to store the complete image of one 8.5- ×11-inch page of paper? (b) How many MiB of memory are required for a 1200 dots-per-inch printer?
16. (a) How many bits are available for storing information in a 57 × 57 Version 10 QR code?This version has four alignment patterns that do not intersect a timing pattern and two that do intersect a timing pattern. It also has two 18-bit version information areas. (b) If the overhead for the
15. (a) How many bits are available for storing information in a 49 × 49 Version 8 QR code?This version has four alignment patterns that do not intersect a timing pattern and two that do intersect a timing pattern. It also has two 18-bit version information areas. (b) If the overhead for the mode,
14. How many total bits are stored in the grid of a Version 4 QR code?
13. A typist is entering text on a keyboard at the rate of 30 words per minute. If each word is 6 characters long on average, what bandwidth in bits per second between the keyboard and main memory is required to transmit the information? A space is also a character. Assume that each word is
12. A typist is entering text on a keyboard at the rate of 40 words per minute. If each word is 5 characters long on average, what bandwidth in bits per second between the keyboard and main memory is required to transfer the information? A space is also a character. Assume that each word is
11. How long would it take to transfer a 600-MB database from disk to memory over a DMA channel with a bandwidth of 2.5 GB/s?
10. If an app requires the execution of 30 million instructions to complete a task and your CPU is rated at 2.8 GHz, what is the execution time of the task? Assume that each ISA3 instruction executes an average of 7.3 Mc2 instructions.
9. If an app requires the execution of 20 million instructions to complete a task and your CPU is rated at 2.1 GHz, what is the execution time of the task? Assume that each ISA3 instruction executes an average of 4.5 Mc2 instructions.
8. Determine how to perform each of the following procedures with your operating system. (a)Set up a new user account. (b) Display the names of the files and subdirectories at the root directory. (c) Delete a file from the disk. (d) Change the name of a file. (e) Duplicate a file.(f) Display the
7. Answer the following questions about your operating system. (a) What is the name of your operating system? (b) Are certain characters disallowed or problematic in the names of the files? (c) Does your operating system distinguish between uppercase and lowercase characters in a file name?
(b) What is a program?
6. (a) What is an algorithm?
(f) Main memory has faster access time than disk memory. True or false?
(e) Main memory has greater storage capacity than disk memory. True or false?
(d) Disk memory is accessed sequentially True or false?.
(c)Disk memory is volatile. True or false?
(b) Main memory is accessed sequentially. True or false?
(a) Main memory is volatile. True or false?
4. A full binary tree is a tree whose leaves are all at the same level, and every node that is not a leaf has exactly two nodes under it. FIGURE 1.36 is a full binary tree with three levels. *(a) Draw the full binary tree with four levels. *(b) How many nodes total are in a full binary tree with
3. In the Bible, Exodus Chapter 18 describes how Moses was overwhelmed as the single judge of Israel because of the large number of trivial cases that were brought before him. His father-in-law, Jethro, recommended a hierarchical system of appellate courts where the lowest-level judge had
2. Genghis Khan organized his men into groups of 10 soldiers under a “leader of 10.” Ten“leaders of 10” were under a “leader of 100.” Ten “leaders of 100” were under a “leader of 1000.” *(a) If Khan had an army of 10,000 soldiers at the lowest level, how many men in total were
1. (a) Draw a hierarchy diagram that corresponds to the United States Constitution. (b) Based on Figure 1.5, draw a nesting diagram that corresponds to the organization of the hypothetical publishing company.
A GPS system in an automobile has a 4.5- × 2.5-inch screen with 120 color pixels per inch. Each subpixel color can display 64 levels of brightness. What is the KiB size of the display memory?
Example 1.6 An eReader has a 1072- × 1448-pixel grayscale display, with each pixel able to display 16 shades of gray. What is the KiB size of the display memory for the device?
Example 1.5 How many ASCII characters can be stored in a 29 × 29 Version 3 QR code with one alignment pattern that does not intersect a timing pattern using Level L error correction with 25%overhead?
1.4 How many bits are available for storing information in the Version 7 QR code of Figure 1.22(a)?
A typist is entering some text on a computer keyboard at the rate of 35 words per minute. How large must the bandwidth of the channel be to accommodate the information flow between the typist and the computer system? Assume that each word is followed by one space character, on average.Including one
1.2 The bandwidth of a DMA channel between the hard drive and main memory in a computer system is quoted as 3 Gb/s. How long would it take to do a DMA transfer from the hard drive to main memory of the 400-MB thumbnail database from the photo library in your computer?
Suppose your CPU is rated at 2.5 GHz and you execute a program task on your app that requires the execution of 16 million ISA3 instructions. If each ISA3 instruction executes an average of 3.7 Mc2 instructions, what is the execution time of the program task?
41. This problem is a project to write a simulator in C for the Pep/9 computer.(a) Write a loader that takes a Pep/9 object file in standard format and loads it into the main memory of a simulated Pep/9 computer. Declare main memory as an array of integers as follows:int Mem[65536]; // Pep/9 main
40. Translate to Pep/9 assembly language your C solution from Problem 2.18 that inputs an unordered list of integers with –9999 as a sentinel into a binary search tree, then outputs them with an inorder traversal of the tree.
39. Insert the following C code fragment in main() of Figure 6.48 just before the return statement:first2 = 0; p2 = 0;for (p = first; p != 0; p = p->next) {p2 = first2;first2 = (struct node *) malloc(sizeof (struct node));first2->data = p->data;first2->next = p2;}f or (p2 = first2; p2 != 0; p2 =
38. Insert the following C code fragment between the declaration of node and main() in Figure 6.48:void reverse(struct node *list) {if (list != 0) {reverse(list->next);printf("%d ", list->data);}}and the following code fragment in main() just before the return
37. Insert the following C code fragment in main() of Figure 6.48 just before the return statement:sum = 0; p = first;while (p != 0) {sum += p->data;p = p->next;}printf("Sum: %d", sum);and translate the complete program to Pep/9 assembly language. Declare sum to be a local variable along with the
36. Translate to Pep/9 assembly language the C program from Figure 6.48 that manipulates a linked list, but declare first, p, and value as global variables.
35. Translate to Pep/9 assembly language the C program from Figure 6.46 that accesses the fields of a structure, but declare bill as a local variable in main().
34. Translate the following C program to Pep/9 assembly language.#include int main () {int guess;printf("Pick a number 0..3: ");scanf("%d", &guess);switch (guess) {case 0: printf("Not close"); break;case 1: printf("Too low"); break;case 2: printf("Right on"); break;case 3: printf("Too high");
33. Translate the following C program to Pep/9 assembly language:#include int main () {int guess;printf("Pick a number 0..3: ");scanf("%d", &guess);switch (guess) {case 0: case 1: printf("Too low"); break;case 2: printf("Right on"); break;case 3: printf("Too high");}printf("");return 0;}The program
32. Translate to Pep/9 assembly language the C program from Figure 2.32 that reverses the elements of a local array using a recursive procedure. Initialize word to "star" with five pairs of load byte, store byte instructions (including the zero sentinel), and translate the printf()statement with
31. Translate to Pep/9 assembly language the C program from Figure 2.25 that adds four values in an array using a recursive function.
30. Translate the C program in Problem 29 to Pep/9 assembly language, but declare list and numItems to be global variables.
29. Translate the following C program to Pep/9 assembly language:#include void getList(int ls[], int *n) {int j;scanf("%d", n);for (j = 0; j < *n; j++) {scanf("%d", &ls[j]);}}void putList(int ls[], int n) {int j;for (j = 0; j < n; j++) {printf("%d ", ls[j]);}printf("");}void rotate(int ls[], int n)
28. Translate the C program in Problem 27 to Pep/9 assembly language, but declare list, j, numItems, and temp to be local variables in main().
27. Translate the following C program to Pep/9 assembly language:#include int list[16];int j, numItems;int temp;int main() {scanf("%d", &numItems);for (j = 0; j < numItems; j++) {scanf("%d", &list[j]);}temp = list[0];for (j = 0; j < numItems - 1; j++) {list[j] = list[j + 1];}list[numItems - 1] =
26. (a) Rewrite the C program of Figure 2.22 to compute the factorial recursively, but use procedure times() in Problem 24 to do the multiplication. Use one extra local variable in fact()to store the product. (b) Translate your C program to Pep/9 assembly language.
25. Translate the C program in Problem 24 to Pep/9 assembly language, but declare product, n, and m to be local variables in main().
23. The recursive binomial coefficient function in Figure 6.25 can be simplified by omitting y1 and y2 as follows:int binCoeff(int n, int k) {if ((k == 0) || (n == k)) {return 1;}else {return binCoeff(n - 1, k) + binCoeff(n - 1, k - 1);}}Write a Pep/9 assembly language program that calls this
22. Translate to Pep/9 assembly language your C solution from Problem 2.14 that outputs the instructions for the Towers of Hanoi puzzle.
21. Translate to Pep/9 assembly language your C solution from Problem 2.13 that computes a Fibonacci term using a recursive function.
20. Write a C program that defines int minimum(int j1, int j2)which returns the smaller of j1 and j2. (a) Write your program with a global variable for the actual parameter. Translate your C program to Pep/9 assembly language. (b) Write your program with a local variable for the actual parameter.
19. Write a C program that converts an uppercase character to a lowercase character. Declare function char toLower(char ch);to do the conversion. If ch is not an uppercase character, the function should return ch unchanged. If it is an uppercase character, add the difference of 'a' and 'A' to ch as
18. Translate the following C program to Pep/9 assembly language. It multiplies two integers using a recursive shift-and-add algorithm. mpr stands for multiplier and mcand stands for multiplicand.A recursive integer multiplication algorithm #include int times(int mpr, int mcand) {if (mpr == 0)
17. Translate the C program in Problem 16 to Pep/9 assembly language, but declare myAge to be a local variable in main().
16. Translate the following C program to Pep/9 assembly language.#include int myAge;void putNext(int age) {int nextYr;nextYr = age + 1;printf("Age: %d", age);printf("Age next year: %d", nextYr);}int main () {scanf("%d", &myAge);putNext(myAge);putNext(64);return 0;}
15. Translate the following C program to Pep/9 assembly language.#include int main() {int numItms, j, data, sum;scanf("%d", &numItms);sum = 0;for (j = 1; j
14. Translate the C program in Figure 6.12 to Pep/9 assembly language but with the do loop test changed to while (cop
Showing 300 - 400
of 640
1
2
3
4
5
6
7
Step by Step Answers