Introduction to Programming

X52.9239 – 003

Final Exam

 

The final exam for the class includes a final project and a set of questions. Your complete solution should be turned in at the beginning of the next session, so the exam can be graded in class.

I. Final Project:

(a) Write a function named square that returns a float value, which is the square of a float argument. Call the function with an argument from main, and print the return value in main. Hand in a printed copy of the program, and a printed copy of the output.

(b) Write a function that takes four int arguments, and returns an int value. This single function should find the minimum or maximum based on the following specification.

Call the function with arguments from main, and print the return value in main. Hand in a printed copy of the program, and a printed copy of the output.

(c) Specify the C development environment you used for the various projects in this class, and comment on the issues you found the most "user hostile".

 

II. Questions:

All questions are equally weighted.

  1. Given the following C program, fill in the code to print all the elements of the array backwards, using a loop. For example, the program must print the last value, the second-to-last value, etc.
  2.  

    #include <stdio.h>

    main( )

    {

    static float ar[10] = {5.0, 3.0, 13.0, 19.75, 3.5, 2.59,

    17.5, 18.0, 5.5, 0.0};

     

     

     

     

     

    }

     

  3. Which of the following characteristics of functionality is provided by an operating system?
  4. Please answer True of False.

    ________ a virtual memory manager

    ________ the execution of integer arithmetic calculations

    ________ a file manager

    ________ the allocation of peripheral devices

  5. Would the relational expression below evaluate to be true or false? ___________
  6. int a = 10;

    int b = 11;

    if (b <= 10 || a >= 10)

  7. Match the application below with the best generation of programming language to develop that application.
  8. A payroll database _____

    The Windows 95 operating system _____

    Expert system using artificial intelligence _____

    Choices of programming languages: 1st generation, 2nd generation, 3rd generation, 4th generation, 5th generation.

  9. What variable data type would be best to represent the following information?
  10. Your name __________

    A fractional number __________

    A single alphabetic symbol __________

    The number of electoral votes a candidate received __________

  11. Which of the following data structures would be the best for information that must be searched quickly (select only one)?
  12. An unsorted array

    A sorted linked list

    A sorted binary tree

    An unsorted double-linked list

  13. Convert the binary number 10010 to a decimal (base 10) number. Please show all the steps.
  14. True or False? An index lets you sort a database to rearrange the records in a sequence based on a selected field. __________
  15. True or False? Reading and writing files from an application involves features of the programming language, the operating system and the physical hardware. __________
  16. Using the traditional (waterfall or linear) method for program development, what is the correct sequence for the following steps? (please fill in 1, 2, 3, etc.)

Coding or implementation _____

Design _____

Installation _____

Maintenance _____

Specification or analysis _____

Test and debug _____