Question: Question 1 What does this command line do? ./solve_eqns < my.data > log Question 1 options: A Runs the solve_eqns program in the working directory
Question 1
What does this command line do?
./solve_eqns < my.data > log
Question 1 options:
| A | Runs the solve_eqns program in the working directory hooking up stdout to file my.data and hooking up stdin to file log. File my.data must be in the working directory, and file log will be created in the working directory. |
| B | Replaces file solve_eqns with file my.data and writes a log message to stdout. |
| C | The shell prints an error message about illegal syntax. |
| D | Runs the solve_eqns program in the working directory hooking up stdin to file my.data and hooking up stdout to file log. File my.data must be in the working directory, and file log will be created in the working directory. |
Question 2
Use the man command and a bit of experimentation to find out what this shell command does
grep scanf *.c
Question 2 options:
| A | Finds all occurrences of string scanf in the files in the working directory and all its subdirectories whose names end in .c. |
| B | Finds all occurrences of string scanf in the files in the working directory whose names end in .c. |
| C | Globally replaces calls to scanf with the empty string in all C programs in the working directory. |
| D | Globally removes programs written in C that call scanf. Only the executables are removed. The source code is not touched. |
Question 3
When does the following command print hurrah?
./my_pgm && echo hurrah
Question 3 options:
| A | When there's a file named hurrah in the working directory. |
| B | When my_pgm returns a value different from 0. |
| C | When my_pgm compiles without errors. |
| D | When my_pgm returns 0. |
Question 4
What's the effect of passing the -g option to gcc?
Question 4 options:
| A | It checks the C program more thoroughly in preparation for debugging. |
| B | It turns off all code optimizations. |
| C | It directs gcc to include debugging information in the executable file. This information includes the cross reference between machine instructions and source code lines. |
| D | It tells gcc to call gdb directly on the executable it produces. |
Question 5
What's the difference between the gdb commands next and step?
Question 5 options:
| A | step moves forward by one machine instruction, while next moves forward by one C line. |
| B | They are synonyms. |
| C | step steps into functions, while next skips over them. |
| D | step advances one line in the program, while next skips one line. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
