91.101 Computing I

Fall 2006

M-W-Th-F

9:30 am – 10:20 am

Jim Canning

Olsen Hall 231

Office Hours M-W-F 10:30 – Noon

This is your time to be a student.

Be a student.

As a student in this course,

What am I Going to Do?

Mostly - You are going to

build

solutions

to programming problems

using the C programming language

in a Unix environment.

You can do this.

It is not difficult.

It requires effort and time.

This is your time to be a student.

Be a student.

Example Programming Problem

Write a C program that will input a positive integer from the keyboard and print out EVEN if the integer is even or print out ODD if the integer is odd.

Solution

/*************************************************************************/

/* Programmer: Jim Canning */

/* Problem 1: Odd or Even */

/*************************************************************************/

#include <stdio.h>

int main ( int argc, int argv[] ) {

int n ;

printf(“Please enter a positive integer: ” );

scanf( “%d”, &n ) ;

printf(“\n”);

if ( n % 2 ) printf(“ODD\n);

else printf(“EVEN\n”);

return ( 0 ) ;

}


Some Unix Commands and Utilities

Command / General Idea
cd / Change your working directory
pwd / Present working directory
ls / List the files in my working directory
ls -l / List the files and give more information
chmod / Change mode – change the protection bits on the file(s)
lpr / Line printer utility
man / Help on a topic
emacs -nw / Call up the emacs editor with the no window option
gcc / Call up the gnu gcc translation environment.
gdb / Call up the gnu debugger
grep / Search a file for a pattern
passwd / Change your password


Execution Environment

Once your C program has been successfully written, preprocessed, compiled, assembled, linked, and loaded the operating system will create a process image. This process image resides in main memory and it has four areas that we need to know about.

They are:

  1. Code Area
  2. Global and Static Data Area
  3. Heap
  4. Run Time Stack

Process Image

Course Prerequisites

A meaningful and personal commitment to excel in school.

Time to devote to your studies. Energy. Enthusiasm. A positive attitude.

Time.

Ability to walk away from distractions.

Know how to locate a quiet, well-lit place with no visual clutter so that you can practice the art of studying.

Ability to use the location that you found.

Time.

Ability to sit in a chair for multiple consecutive hours either reading, doing homework, or programming.

Ability to encourage yourself to read slowly. You can do it.

Ability to spell the words receive and separate correctly.

Know how to find ways to stay in Olsen Hall and work on your studies.

Time.

The phrase "I hate math" has lost its meaning to you.

The phrase “I hate to read” has lost its meaning to you.

Ability to get to bed at a decent hour so you are fresh the next day.

A willingness to push yourself academically.

A realization that you are trying to become the best scholar you can.

A willingness to better understand your reading skills and how to improve them.

You can do all of these things and more.

Time.


Four Boolean Operators


Attendance Is Important

You need to come to work.

It does not matter if you feel you already know the material.

Your ability to get out of bed and get here is part of the course. It is a point of evaluation.

Attendance will be taken.

In class, on-time, alert A

In class, on-time, not alert C

In class, somewhat late B

In class, very late C

Not in class F

Not in class, written acknowledgement*C

In class, but disruptiveC

Adjustments to attendance grade ( +, - ) may be made.

*should not be abused

Single Bit Binary Addition


A single bit binary adder can be built by using

Boolean Exclusive OR

and

Boolean AND
Honesty is Important

You can do this work by yourself.

You must become independent.

Solutions to programming assignments should not be shared.

Cheating on examinations is a no-no.

Homeworks should be done by yourself.

You can do these things if you keep up and apply yourself.

If you get information off of the web, it should be cited.

If you are not academically honest and I can document it, the university and department rules concerning dishonesty will be applied.

It is much better to do it late than to copy.

Feel good about yourself.

Never mistake activity for achievement. (John Wooden)

Famous Threesomes


Note: taken from wikipedia



A transistor can be used as a

BOOLEAN NOT

operator.

Four transistors can be used to build a

BOOLEAN AND

operator.

Three transistors can be used to build a

BOOLEAN OR

operator.

The BOOLEAN EXCLUSIVE OR operator can be

built with NOT and AND operators.

What is a C program?

A C program is a collection of

  • Comments
  • Preprocessor directives
  • Declarators

that have been appropriately spread across multiple files.

Comments

/****************************/

/* Programmer: Jim Canning */

/* Problem: Recursive Tiling */

/****************************/

All programs handed in to me must include a header comment that is in the form above. We will call this 101 Standard Form. You may include more information in the header comment if you wish.

No spelling errors should exist.

Use additional comments sparingly. Our programs are not complex.

Words likely to be misspelled

Receive

Separate

Programmer

Integer

Acquire


Preprocessor Directives

#include

#define

#ifndef

#endif

#include <stdio.h>

#include <stdlib.h>

#include <math.h>

#include “globals.h”

#define pi 3.14

Declarators

There are two kinds of declarators:

  1. Definitions
  2. Declarations only

There are two kinds of definitions:

  1. Function definitions
  2. Variable definitions

There are two kinds of declarations only:

  1. Function declarations only
  2. Variable declarations only

Biggy #1

Type

Type is a property of an identifier or an expression that conveys what the identifier represents.

For variables and expressions it mainly provides two pieces of information:

  • Size (how many bytes to store it)
  • Interpret the bits in those bytes.

If an identifier is a function it conveys the type of the value that the function returns.

The C Programming Language’s Base Types

Base Type / Representation
How do we interpret the bits? / Storage in bytes on mercury.cs.uml.edu
char / Ascii chart
(Unsigned integer) / 1
short int / Twos complement / 2
int / Twos complement / 4
long int / Twos complement / 4
long long int / Twos complement / 8
unsigned int / Unsigned integer / 4
pointer / Unsigned integer / 4
float / IEEE 754 Single precision / 4
double / IEEE 754 Double precision / 8

Motivating Students to Become Responsible for Learning, Part I

J. Dirk Nelson, Ph.D

The Successful Professor, Volume 3 – Issue 1

This is wonderful article for you and me to read. I agree with it wholeheartedly. In many ways it summarizes what I have been trying to accomplish in my classroom.

Albert Bandura uses the term self-efficacy to mean having a sense that one can meet challenges that present themselves.

Students with high self-efficacy will be active in the learning process, display greater effort as well as persistence in class, and attain higher levels of performance.

Students with low self-efficacy will have less persistence and try to avoid learning.

Traits of Excellent Teachers ( Baiocco & DeWaters (1998) )

I. Intrapersonal Intelligences

A. Optimism

B. Expressiveness

1. Enthusiasm

2. Sociability/Friendliness

C. Empathy

1. Available

2.Skill of good listening

3. Quality of valuing student ideas

II. Interpersonal Intelligences

A. Organization

B. Leadership

C. Ability to Inspire

D. Rigor

E. Conscientiousness

Education is a partnership. Students must have similar traits if success is to occur.

Success in our relationship means an improved quality of life for you, as well as for all of the individuals whom you come into contact throughout your lifetime.

Evaluation of All Student Work

Criteria

  • Accuracy
  • Thoroughness
  • Writing skills (word usage, punctuation, spelling)
  • Creativity
  • Professionalism (neatness, references)
  • Completion of work on time

I will not discuss individual grades on any work in class.

I would be happy to discuss them in my office.

Characteristics of “A” Students

(John Williams, The Teaching Professor. 7:7 (1993) )

  • have virtually perfect attendance. Their commitment to the class is similar to the professor’s.
  • are prepared for class. Read material before class.
  • show curiosity. They research what they do not understand.
  • have retentive minds. Can connect past learning with the present.
  • have a winning attitude. They have both determination and self-discipline. They show initiative. They do things that they have not been necessarily told to do.
  • Have special qualities. Exceptional intelligence or the ethic of hard work and a drive to learn. Organization, creativity, commitment, etc. These abilities are obvious to the professor as well as to the other students in the class.

Characteristics of “C” Students

(John Williams, The Teaching Professor. 7:7 (1993) )

  • Miss class and/or are frequently tardy. Lack good time management, scheduling, and prioritizing skills and place other issues before their classes. Occasionally, poor health or constant fatigue renders them unable to perform well.
  • Prepare their work in an apathetic, careless manner, submit it late and/or incomplete.
  • Are obviously not committed to the course. They may participate but without enthusiasm. Their appearance or language displays boredom.

You can do this.

Believe in yourself.

Recognize your weaknesses and improve.

Practice reading for detail.

You need to give yourself time.

You can remove accumulated past error.

Make learning your full-time job.

You are trying to become a scholar.

It is your time to be a student.

Be a student.