Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Quiz #2 Solutions for COSC 235B by David A. Sykes - Prof. David A. Sykes, Quizzes of Computer Science

The solutions for quiz #2 of the cosc 235b course taught by david a. Sykes. The quiz includes questions that require writing code to implement the steps of an algorithm, such as reading input, printing values, and manipulating strings. Students can use this document as a reference to check their answers and understand the expected output.

Typology: Quizzes

Pre 2010

Uploaded on 08/19/2009

koofers-user-df9
koofers-user-df9 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
COSC 235B David A. Sykes
- 1 –
Quiz #2
September 22, 2006
Name: Pledged:
Answer all questions. Write legibly.
1. Write the code to match the steps in the algorithm expressed as comments .
# read a line of input into a string variable named s with
# a prompt to enter a non-empty line of text
# print the value read in
# display the first character of s
# display the ASCII value of the first character of s
# display the last character of s
# display all but the first character of s
# display the length of s
# Remove all leading spaces from s and print the result

Partial preview of the text

Download Quiz #2 Solutions for COSC 235B by David A. Sykes - Prof. David A. Sykes and more Quizzes Computer Science in PDF only on Docsity!

COSC 235B David A. Sykes

- 1 –

Quiz

September 22, 2006

Name: Pledged: Answer all questions. Write legibly.

  1. Write the code to match the steps in the algorithm expressed as comments.

    read a line of input into a string variable named s with# a prompt to enter a non-empty line of text

    print the value read in

    display the first character of s

    display the ASCII value of the first character of s

    display the last character of s

    display all but the first character of s

    display the length of s

    Remove all leading spaces from s and print the result