# Computer Science Programming Skills Assessment-CS 1131 Placement Test

TEST DIRECTIONS: Give yourself about an hour to take the test. Do the best you can with the programming knowledge you currently have and without any help. Trying to do better than your current skills level will set you up for a class which you are not prepared for. CS1131 is a very fast-paced course.

You may use any programming language you know to complete this test (Pascal, Basic, C++, etc.). Use the same language throughout the test - do not switch between two or more. Don't worry about precise syntax - we do not care if you forget a comma as long as we can figure out what you mean. When writing code to read data, you can make any assumptions you want about how the data are formatted. Likewise, when printing results you may format them in any way you like.

Note - If you have any questions relating to CS1131 and/or this skills test please call (906) 487-2209 during normal business hours or send email to csdept@mtu.edu.

This information is required for us to be able to appropriately contact you with your results.
This is a required question
This is a required question
This is a required question
This is a required question
This is a required question

## Question #1

Define in a sentence (or two) the following terms
This is a required question
This is a required question
This is a required question
This is a required question

## Question #2

Write a program that reads in three whole numbers (integers) and prints them out in increasing order (i.e., the smallest first).
This is a required question

## Question #3

Write a program that reads in a sequence of positive integers and prints out 'increasing' if each successive number is greater than the previous one or prints out 'not increasing' otherwise. Assume the end of the input numbers occurs when you read a negative number.
This is a required question

## Question #4

Write a program that reads in a whole number (integer) and then prints one of the following messages depending on the value of that number: print "infant" if the number is equal to 1 print "toddler" if the number is equal to 2 or 3 print "preschooler" if the number is equal to 4 print "kindergartener" if the number is equal to 5 print "elementary age" if the number is equal to 6, 7, 8, 9 or 10 print "middle schooler" if the number is equal to 11, 12 or 13 print "high schooler" if the number is equal to 14, 15, 16, or 17 print "too cool" if the number is equal to 18 print "old" if the number is greater than 18
This is a required question

## Question #5

Write a program that computes and prints the sum of the odd numbers from 17 up to and including 329 (i.e., 17 + 19 + ... + 327 + 329). You must use a loop.
This is a required question

## Question #6

Assume you have a 100 element array called XS, with each element containing a real (floating point) number. Assume the array is already declared and values are already stored in the first N elements (N is a variable). Write a short segment of code (not a whole program) to set the variable X to the smallest of those N elements.
This is a required question

## Question #7

Write a program that prints the following 45 pairs of numbers: 1 1 2 1 2 2 3 1 3 2 3 3 4 1 4 2 4 3 4 4 5 1 . . . . 9 7 9 8 9 9 Note that the first numbers go from 1 to 9, and the second numbers start at 1 and go up to the value of the first number (9 times). You must use loops to do this, not 45 print statements.
This is a required question

## Question #8

Write a segment of code (not a whole program) that sets the elements of a two-dimensional (10 by 10) array called MAP as follows: the top and bottom rows and the left-most and right-most columns contain the value 0, all other elements (the 'inside' ones) contain the value 99
This is a required question

## Question #9

Write a program that reads in 50 positive or negative whole numbers (e.g., 5, 946, -32, 0) and prints out only those numbers that are perfect squares. The program MUST use a function (or subroutine, procedure, method, or whatever you call it) to decide if a number is a perfect square. The main program should just read a number, call the function, then print the number if the function indicates it is a perfect square. If you do not know what a function (or subroutine, procedure, method) is, then DO NOT do this problem.
This is a required question