worksheet4

# worksheet4 - Worksheet 4 Chapter 7 Transfer your answers to...

This is a preview. Sign up to view the full content.

Worksheet 4 Chapter 7 Transfer your answers to all questions to Chi-Tester. ONCE YOU START YOUR CHI- TESTER SESSION, YOU CANNOT CLOSE IT AND RESTART - TRANSFER ALL OF YOUR ANSWERS TO CHI-TESTER AT ONE TIME. The first 27 questions are from the textbook; question numbers from the text are given in square brackets at the beginning of the question on Chi-Tester. Please take a few moments to read the feedback. Worksheet 4 consists of the questions 1 - 23, 25, 28, 29, and 30 from the text (pp. 311-313), plus the following. (Answers for the textbook questions are found in Appendix G.) 28. Write a statement that finds the string "cat" in the c-string s1. a. char* s2 = s1.strstr("cat"); b. char* s2 = strstr(s1, "cat"); 29. Write a statement that finds the first 'c' (reading from the left) in the c-string s1. a. char* s2 = strchr(s1, 'c'); b. char* s2 = s1.strchr('c'); 30. Write a statement that copies c-string s2 to c-string s1. a. s1 = s2; b. strcpy(s1, s2); 31. Write an expression that tests two c-strings for equality. a. s1 == s2 b. strcmp(s1, s2) == 0 32. The prototype given in the documentation for c-style string concatenation is strcat(char* s1, const char* s2); Which of the following is the best definition of the variable s1 ?
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern