Assessment Arrays Easy

From Progzoo
Jump to: navigation, search

You can use arrays to solve these problems. In each example your program must read in a file of numbers and output true or false.

For each problem there is a set of test files.

Check 1 to 20

Read in some numbers from 1 to 20. Print true if all of the numbers from 1 to 20 are present; print false otherwise.

You may find the following tutorial useful:

The test files used are:



[Font] [Default] [Show] [Resize] [History] [Profile]

Palindromes

Read in a list of numbers. Print true if the list of numbers is "palindromic" – that is it reads the same backwards as forwards; print "false" otherwise.

You may assume that there are fewer than 100 numbers in the list.

The test files used are:



[Font] [Default] [Show] [Resize] [History] [Profile]

Duplicates

Read in 20 numbers, each between 1 and 100, inclusive. Print true if the list includes at least one duplicate; print false otherwise.

You will find the frequency list used in the first question useful here.

The test files used are:



[Font] [Default] [Show] [Resize] [History] [Profile]