Swine1 sol - CSCI.1100 Computer Science I Swine Quiz 1...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CSCI.1100 Computer Science I Swine Quiz 1 November 30, 2009 Closed book, closed notes, no computers or calculators of any kind. Name: RCS login: Circle your lab section: (01 MTh 10:00) (02 MTh 12:00) (03 MTh 2:00) (04 MTh 4:00) (05 MTh 6:00) (06 MTh 10:00) (07 TF 10:00) (08 TF 12:00) (09 MTh 12:00) (10 TF 2:00) (11 MTh 4:00) You will have 15 minutes to complete this test. Make sure you do not spend too much time on any question. 1. Write a function to count the number of times the value 6 is stored in a list of integers. (5 points)? int count_six ( int list[], int size) { int count = 0; for ( int i = 0; i < size; i++) { if (list[i] == 6) count++; } return count; } 1 point for function header 1 point for variable and initialization 1 point for for loop 1 point for conditional 1 point for correct result
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2. Write a function to find and return the length of the longest string (most characters) in a list containing at least one string (5 points)? int longest(string list[],
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

Swine1 sol - CSCI.1100 Computer Science I Swine Quiz 1...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online