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

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

View Full Document Right Arrow Icon
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 ?
Image of page 1
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern