Logo  

CS256 - Fundamentals of Structured Programming

Displaying exercises/e3/files/e3.txt

Exercise #3

Edit this file and add your answers to each question below the question. 

1) Complete Unix command to copy the func.c file located in the h2 sub-
   directory located in the cs256 accounts home directory to your current
   working directory:
 
 
 
2) Complete command to read the online manual for the scanf C function:
 
 
 
3) Answer the following, given the following ls listing:
  -rw-r----- 1 root sys 215 Apr 29  2019 x.c

 a) Size of the file: 
 b)     Type of file: 
 c)Group permissions: 
 d)       File owner: 

4) Define the C grammar for the following:

 a) A block statement:
 
 
 b) An if statement:
 
 
 c) An if-else statement:
 
 
 d) A while loop:
 
 

5) Give a data literal example of each data-type:

 a)  char: 
 b)   int: 
 c) float: 

6) If the variable M holds some value that represents miles, define a
  variable called K and assigns it number of miles in M converted to kilometers
  (Hint: there are 1.609344 kilometers / mile):
 
 
 
7) Read the man page for getchar and tell:
 a) What is the return data-type for the function:
 
 b) What is the return value for the the function:
 

8) Write an example scanf() function that would read an integer followed
  by two floating point numbers.  Define the variables used in the scanf() as
  well:
 
 
 
9) Define a Boolean expression for the variable 'x' that would be true
  when x is in the range 10-100 or it is 300: