Pseudocode for Determining Increasing Sequences, Quizzes of Computer Science

Instructions for writing pseudocode to determine if a given sequence of unique integers is increasing or not. The sequence is defined as one where each value is greater than the preceding one, and is terminated by the special value -999. The pseudocode should be detailed enough to be converted into java code by a competent programmer, but should not contain java-specific details.

Typology: Quizzes

Pre 2010

Uploaded on 07/30/2009

koofers-user-p5q-1
koofers-user-p5q-1 🇺🇸

9 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CMSC131 Fall 2004 Quiz #3, Duration 25 Minutes
First Name:
Last Name:
Student Id:
Section time (10am/11am): TAs:
Write pseudocode for a program that reads a sequence of unique integer values and determines
whether it is an increasing sequence. An increasing sequence is one where each value is greater
than the preceding one. The sequence will be terminated by the special value -999, which is not
considered to be part of the sequence. The program will print the message "Increasing" for an
increasing sequence and "Non-Increasing" otherwise. For example, here are two increasing
sequences:
2 45 90 134 -999
-2 -1 0 5 6 -999
The following are two non-increasing sequences:
10 20 15 30 -999
11 100 2 90 -999
You may assume that the sequence will have at least two integer values and no two values will be
equal.
To keep things simple, you can read in the next integer and store it in some variable x as follows:
x = read()
You can print a value x or message as follows:
print(x) or print(“Hello”)
You do not need to implement any Java code for this problem, just the pseudocode.
Remember, pseudocode should be detailed enough that it can be converted by a
competent programmer into Java, but should not contain Java-specific details.
1
pf3

Partial preview of the text

Download Pseudocode for Determining Increasing Sequences and more Quizzes Computer Science in PDF only on Docsity!

CMSC131 Fall 2004 Quiz #3, Duration 25 Minutes

First Name: Last Name: Student Id: Section time (10am/11am): TAs:

Write pseudocode for a program that reads a sequence of unique integer values and determines whether it is an increasing sequence. An increasing sequence is one where each value is greater than the preceding one. The sequence will be terminated by the special value -999, which is not considered to be part of the sequence. The program will print the message "Increasing" for an increasing sequence and "Non-Increasing" otherwise. For example, here are two increasing sequences:

The following are two non-increasing sequences:

You may assume that the sequence will have at least two integer values and no two values will be equal.

To keep things simple, you can read in the next integer and store it in some variable x as follows:

x = read()

You can print a value x or message as follows:

print(x) or print(“Hello”)

You do not need to implement any Java code for this problem, just the pseudocode.

Remember, pseudocode should be detailed enough that it can be converted by a

competent programmer into Java, but should not contain Java-specific details.