summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormokha <mokha@cisco.com>2019-05-18 13:47:05 -0600
committermokha <mokha@cisco.com>2019-05-18 13:47:05 -0600
commit3693d1ea87e29507c5a257cd2c659e9379ec90ab (patch)
tree21ba123b53578bcd131b83d8a35e4bba0902306d
parentfedaffb18b96f5d492ca8e9f31216ca0ceb9d093 (diff)
solve 7.7
-rw-r--r--README.md43
-rw-r--r--exercises/chapter-7.713
2 files changed, 45 insertions, 11 deletions
diff --git a/README.md b/README.md
index db19ca4..083a6bd 100644
--- a/README.md
+++ b/README.md
@@ -1,19 +1,40 @@
For Assignment 1, you are going to complete the following learning activities taken from your textbook.
Use the script command to save the terminal session wherever necessary. Saving the terminal starts with the script filename command and ends with exit.
-Combine all required problems in this set in one file, name it 1COMP325_1_YYMM`
+Combine all required problems in this set in one file, name it `COMP325_1_YYMM`
(replacing ‘YYMM’ with the current year and month, e.g., 1309),
and upload it here to submit it to your tutor for marking and feedback.
Be sure to complete the final step—click on the Send for Marking button to notify your tutor.
-Solve problems 7–11 and 15–17 at the end of Chapter 7.
-Solve problems 7–17 at the end of Chapter 8.
-Do problem 9 (What do the following commands do?) in Chapter 9.
-Enter a C program that reads a temperature in Celsius entered from a keyboard and displays the corresponding temperature in Fahrenheit and complete the steps below. (Hint: Look for such a program in the textbook or online.)
+
+1. Solve problems 7–11 and 15–17 at the end of Chapter 7.
+ 7. Give three commands that you can use to list the absolute pathname of your home directory.
+
+```bash
+```
+ 8. Write down the line in the /etc/passwd file on your system that contains information about your login. What are your login shell, user ID, home directory, and group ID? Does your system contain the encrypted password in the /etc/passwd or /etc/shadow file?
+ 9. What would happen if the last field of the line in the /etc/passwd file were replaced with /usr/bin/date? Why?
+ 10. What are the inode numbers of the root and your home directories on your machine? Give the commands that you used to find these inode numbers.
+ 11. Create a directory, called memos, in your home directory. Go into this directory and create a file memo.james by using one of the editors discussed in Chapter 5. Give three pathnames for this file.
+
+
+
+2. Solve problems 7–17 at the end of Chapter 8.
+3. Do problem 9 (What do the following commands do?) in Chapter 9.
+4. Enter a C program that reads a temperature in Celsius entered from a keyboard and displays the corresponding temperature in Fahrenheit and complete the steps below.
+(Hint: Look for such a program in the textbook or online.)
Compile this program using the cc compiler, or any other compiler. Fix any errors, and recompile.
-Your program must have declaration statements, such as float c, f; . Delete the semicolon from the end of the statement. Recompile and report the kind of error. The C compiler often provides cryptic error messages. Interpret this message.
-Change the float c, f; statement to (float c; char f;). Do you get any errors during compilation? What are they and why? Do you see any difference between running this program and the earlier version? Why?
-If your program uses a cout statement, then replace it with a printf statement that does the same thing and vice versa. If you have used neither cout nor printf in the first version, then replace what you have with printf.
-Explain how you can schedule the executable program to run at 1:00 a.m. and to take the input from a file, rather than the keyboard, without any changes to the source program.
-Explain how you can find the time it took the computer to execute your program.
-Explain how the output of your program can be automatically emailed to your friend upon completion.
+5. Your program must have declaration statements, such as float c, f;.
+Delete the semicolon from the end of the statement.
+Recompile and report the kind of error.
+The C compiler often provides cryptic error messages.
+Interpret this message.
+6. Change the float c, f; statement to (float c; char f;).
+Do you get any errors during compilation?
+What are they and why?
+Do you see any difference between running this program and the earlier version? Why?
+7. If your program uses a cout statement, then replace it with a `printf`statement that does the same thing and vice versa.
+8. If you have used neither cout nor printf in the first version, then replace what you have with printf.
+9. Explain how you can schedule the executable program to run at 1:00 a.m. and to take the input from a file, rather than the keyboard, without any changes to the source program.
+10. Explain how you can find the time it took the computer to execute your program.
+11. Explain how the output of your program can be automatically emailed to your friend upon completion.
diff --git a/exercises/chapter-7.7 b/exercises/chapter-7.7
new file mode 100644
index 0000000..6be4409
--- /dev/null
+++ b/exercises/chapter-7.7
@@ -0,0 +1,13 @@
+Script started on Sat May 18 13:44:33 2019
+bash-3.2$ cd
+bash-3.2$ pwd
+/Users/mokha
+bash-3.2$ echo %$HOME
+/Users/mokha
+bash-3.2$ cd ~/
+bash-3.2$ pwed
+/Users/mokha
+bash-3.2$ exit
+exit
+
+Script done on Sat May 18 13:44:45 2019