name:
memo.txt
to user bob3
of the system slowcomputer.psu.edu
. The message
should arrive with the subject line: a memo for you
. You can assume
that the file memo.txt
is in the current working directory.
jill27
, and your current working
directory is assignments
, which is a subdirectory of your home
directory. You want to use vi to edit the file toMom.txt
, which
is in the directory correspondence
, also a subdirectory of your home
directory.
toMom.txt
from my
home directory (taw2
) to your correspondence
directory
without changing the file name. What happens to your original
toMom.txt
file?
int i = 27; printf("%d", (i <= 20)? i - 1: i + 1);
int i1 = 0, i2 = 1, i3 = 2; float f1 = 3.0, f2 = 4.0; double d1 = 5.0, d2 = 6.0;Give the result of evaluating each of the following expressions and the type of that result, or indicate that evaluating the expression would cause a run time error in a C program. If the result is a float or double, your answer only needs to show one place after the decimal point.
i1 - i2 + (float) d1
d1 * f1 / i1 + f2
i3 / (int) f2
i3 - f2 * d1
count
when the following
program finishes execution?
#include <stdio.h> main() { int count = 1; do { count++; if (count > 5) exit(1); } while (count <= 10); if (count > 8) count = 23; else count = 24; }
for
loop.
int i, sum = 0; for (i = 2; i <= 10; i += 2) { printf("The current value is %d\n", i); sum += i; }
sum
after the for
loop
executes?
while
loop that produces the same output and
final value of sum
as this for
loop.
<Enter>
or <Esc>
).
ls -l
while in that directory
produces:
-rw-r--r-- 1 taw2 3289 Jan 19 11:47 vi.txtWho has permission to change the contents of the file
vi.txt
? Who
has permission to look at the contents of this file?
char c = 'b'; switch (c) { case 'a': printf("the value of c is a\n"); break; case 'c': printf("the value of c is c\n"); break; case 'b': printf("the value of c is b\n"); case 'd': printf("the value of c is d\n"); default : printf("the value of c is unknown\n"); break; }
int i1 = 0, i2 = 1, i3 = 2; float f1 = 3.0, f2 = 4.0; double d1 = 5.0, d2 = 6.0;
((i2 > 7.0) || (!(d1 == f1)))
((f1 != 3) && ((f2/i1) == 7))
((f1 != 3.0) || ((f2/i1) == 7))
#include <stdio.h> const int foo = 10; main() { foo = 37; printf("%d\n", foo); }