Difference between revisions of "CSC231 Final Exam Fall 2017"

From dftwiki3
Jump to: navigation, search
Line 47: Line 47:
 
=Problem 2: C function=
 
=Problem 2: C function=
 
<br />
 
<br />
Write a C function called zap2() that will work similarly to the zap() function of Homework 9, but will replace '''all''' occurrences of the second string in the first string.
+
Write a C program and its header file containing a function called zap2() that will work similarly to the zap() function of Homework 9, but will replace '''all''' occurrences of the second string in the first string.   The C program should be called '''final.c''' and the header file '''final.h'''.
  
zap2() will return 1 if one or more substitutions occur, and 0 otherwise.  Note that zap2() does not return the number of substitutions, just 1 if one or more substitutions occurred.  
+
''zap2()'' will return 1 if one or more substitutions occur, and 0 otherwise.  Note that zap2() does '''not''' return the number of substitutions, just 1 or 0.  
  
 
For example, zap2( "Mississippi", "ss" ) will change the first string in "Mi--i--ppi", and will return 1.  zap2( "Mississipi", "tt" ) will not change the first string and will return 0.
 
For example, zap2( "Mississippi", "ss" ) will change the first string in "Mi--i--ppi", and will return 1.  zap2( "Mississipi", "tt" ) will not change the first string and will return 0.
  
Store your program in a file containing zap2() and any other function you need.  Your program should not contain a main function, as it will be linked with a test program that will contain main().
+
You may add other helper function(s) in your final.c and final.h files.  Your C file should '''not''' contain a main function, as it will be linked with a test program that will contain main().
 +
<br />
 +
==Submission==
 +
<br />
 +
* Submit your file in the Problem 3 section of the final exam on Moodle.
 +
 
 
<br />
 
<br />
 
=Problem 3: Bash Script=
 
=Problem 3: Bash Script=

Revision as of 21:10, 10 December 2017


...