CMPT 128 Introduction to Computing Science for Engineering Students
CMPT 128 Introduction to Computing Science for Engineering Students
description
Transcript of CMPT 128 Introduction to Computing Science for Engineering Students
© Janice Regan, CMPT 128, Sept 2007-2012 1
CMPT 128Introduction to Computing
Science for Engineering Students
Course Organization
© Janice Regan, CMPT 128, Sept. 2007 -2012 2
CMPT 128: Introduction to Computing Science for Engineering Students
Monday, Wednesday, Friday D100: 12:30-13:20 D200: 15:30-16:20
Textbook: Problem Solving with C++, Walter Savitch, Addison-Wesley, 2012, 9th Edition
Additional References: The C++ Programming Language, third edition,
Bjarne Stroustrop, Addision Wesley, 1997: Not easy to read, but this is the definitive C++ reference.
© Janice Regan, CMPT 128, Sept. 2007 -2012 3
Class web-site All the information discussed today and more
can always be found on the class web-sitehttp://www.cs.sfu.ca/CourseCentral/128/jregan/
You have received an email containing this address
Course Central is also a useful link to abundant information useful to students taking a computing science course
Class web-site You can also find links to the class web-
site by going to the course management system at
http://courses.cs.sfu.ca
More useful information for students can be found at
http://www.sfu.ca/computing/current-students/undergraduate-students/student-resources.html
© Janice Regan, CMPT 128, Sept. 2007 -2012 4
Exceptions to Grading rules In order to obtain a clear pass (C- or
better) you MUST Have a combined score on the Lab Quizzes and
Midterm Quizzes (weighted as indicated on the previous slide) that exceeds 50% (35/70)
Have a combined score on lab reports and assignments (weighted as on the previous slide) that exceeds 50% (12/24)
© Janice Regan, CMPT 128, Sept. 2007 -2012 13
© Janice Regan, CMPT 128, Sept. 2007 -201215
In lecture Midterm Quizzes Will be multiple choice exams
Practice midterm quiz Oct. 5
Midterm quiz Oct. 19, Nov. 23
TO RECEIVE A GRADE YOU MUST WRITE QUIZZES IN THE SECTION (LECTURE TIME) YOU OFFICIALLY REGISTERED IN
NO EXCEPTIONS
© Janice Regan, CMPT 128, Sept. 2007 -201216
In lab Lab Quizzes In lab programming quizzes
Practice lab quiz Oct. 6, 8
Lab quizzes Oct. 27,29, Nov. 24, 26
TO RECEIVE A GRADE YOU MUST WRITE QUIZZES IN THE LAB SECTION (LAB TIME) YOU OFFICIALLY REGISTERED IN
NO EXCEPTIONS
© Janice Regan, CMPT 128, Sept. 2007 -2012 17
In lab quizzes During two of your scheduled lab periods a lab
quiz will be given. You will be asked to answer one or two programming questions based on material covered in previous labs
You will be asked to write code that demonstrates your understanding of the concepts practiced in the preceding labs.
You will be given 100 minutes to write your code. Your answer will be graded out of 50
© Janice Regan, CMPT 128, Sept. 2007 -2012 18
Assignments Two assignments
Each assignment is worth 9.5% of your course grade
Problems similar to parts of the assignments may appear on the midterms and the final.
Assignments will combine many concepts learned in lectures and the labs
© Janice Regan, CMPT 128, Sept. 2007 -2012 19
Final Exam One 3 hour final examination 50% multiple choice problems 50% longer problems that utilize several
important concepts and require integration of those concepts. Will Include coding (written on paper)
A sample exam, including solutions, will be posted two weeks before the final exam
© Janice Regan, CMPT 128, Sept. 2007 -2012 20
Labs There will be no labs
In the first week of classes (Sept. 2-5) Each lab includes two lab problems
For the first lab you will receive full points for successfully submitting the lab solutions
For 1 labs you will submit a lab report that will be graded
Complete solutions of all labs will be posted. Lab report solutions will be posted
© Janice Regan, CMPT 128, Sept. 2007 -2012 21
Lab participation / attendance Lab participation points (you may earn >1.5%)
Participation in some labs, awarded by TA’s and instructor ( 1/3% good, 2/3% outstanding)
AEP 1%
Lab attendance points (you may earn > 1.5% ) Attendance in same labs Sign in at start of lab, Sign out at end of lab (1/3%
per lab)
Not all labs have attendance/participation points. See the class website for details (assignment schedule page)
Return, Grading questions Marked work will be returned as soon as
possible (1-2 weeks from the due date of the work)
You must review your work and the grading when you received the marked work. You have 1 week from the return date to review and submit any questions about grading.
© Janice Regan, CMPT 128, Sept. 2007 -2012 24
© Janice Regan, CMPT 128, Sept. 2007 -2012 25
Assignments At least two weeks before the due date the
assignment will be posted on the website Assignments will require you to combine and use
many concepts and tools you have learned Assignments will be much more demanding than lab
problems Complete solutions to all assignments will be posted Information of proper preparation of assignments and
lab problems is available on the class website at.http://www.cs.sfu.ca/CourseCentral/128/jregan/assignstand.html
Grading Assignments, Lab Report A minimum of 60% of the grade for each
assignment, and 30% of the grade for the lab report will be given for running the code you submit.
If your code does not run on CSIL windows computers you do not get these points
© Janice Regan, CMPT 128, Sept. 2007 -2012 26
© Janice Regan, CMPT 128, Sept. 2007 -2012 27
Labs On or before Saturday of each week Lab
problems will be posted for the next week. Lab Problems are to be completed
individually or in a small group (up to five students in the same lab section) Collaboration within your groups is
encouraged Complete solutions to all problems will be
posted One exception, the lab you write a report for
© Janice Regan, CMPT 128, Sept. 2007 -2012 28
Grading Information Assignments and Lab Reports (and code)
should be: submitted electronically using the course
management system Bonus points (5%) are available for submitting
and assignment or lab report more than 48 hours early
No late assignments or lab problems will be accepted
Unofficial grades will be available on the course management system https://courses.cs.sfu.ca/
© Janice Regan, CMPT 128, Sept. 2007 -2012 33
Information about the class Be sure to check your SFU email account
regularly Email regarding the class will be sent to your
Campus mail Account, so check it regularly
© Janice Regan, CMPT 128, Sept. 2007 -2012 34
Computing Science Instructional Labs (CSIL) The CSIL is available for your use at all times
beginning in the second week of classes. Either ASB 9838 or ASB 9840 or ASB9700 will be
available If there is a lab for another course in one or more of
these rooms the other will be available At particular times the instructor and/or TAs will
be available in the lab (ASB 9838) to answer your questions. Instructor and TAs:
Tuesday 8:30-12:30, 2:30-4:30 Thursday 8:30 – 12:30
http://www.sfu.ca/computing/about/school-facilities/access-card.html#requisite-02
© Janice Regan, CMPT 128, Sept. 2007 -2012 37
© Janice Regan, CMPT 128, Sept. 2007 -2012 38
Access to CSIL CSIL is protected by a security card
access system As a student in a computing science course
you are eligible to have a security access card for CSIL
If you are pre-registered your access card may be picked up from the card office at traffic and security (there is a refundable deposit and a processing fee)
© Janice Regan, CMPT 128, Sept. 2007 -2012 39
CSIL Rules Before you can use any of the computers
in the CSIL you should Read the policies governing the use of CSIL These policies can be found on the CMPT
web site (see following slides) When you log in you will be asked to confirm
that you agree to abide by these policies
© Janice Regan, CMPT 128, Sept. 2007 -2012 40
http://www.sfu.ca/computing/about/school-facilities/csil.html
IMPORTANTRead the Policies
© Janice Regan, CMPT 128, Sept. 2007 -2012 41
Getting Started in CSIL Before you try programming in CSIL read
the information provided for you Read the general information pages Browse the FAQs, Now you are ready to start
Your CSIL computer ID and password and the ID an password you use for your SFU email account.
© Janice Regan, CMPT 128, Sept. 2007 -2012 42
Labs and using CSIL Computers in CSIL are available 24/7
Labs for many classes are scheduled in CSIL When a lab (not your own) is scheduled in one of the
CSIL areas you are requested to work in another area of CSIL. The schedule showing which areas are in use can be found at
http://www.sfu.ca/content/dam/sfu/computing/csil/csil_lab_schedule_burnaby.pdf
© Janice Regan, CMPT 128, Sept. 2007 -2012 43
Required Lab Hours Attendance at Lab hours is required
Lab Hours are held in the Windows area of CSIL labs Lab Hours provide an opportunity to work with others
sharing knowledge and experience. Lab Hours give you an opportunity to ask the
instructor or TA one on one questions about problems and assignments.
Lab Hours help you learn the required concepts one by one and allow you to ask questions to assure you understand each one.
© Janice Regan, CMPT 128, Sept. 2007 -2012 44
Reading Assignment Visit and read the information on the class
website Be sure you can find
Posted notes Reading assignments for each lecture Assignment due dates Instructions on using the CSIL labs Instructions on using your own computer for
assignments Have any questions ready for next lecture
© Janice Regan, CMPT 128, Sept 2007-2012 45
CMPT 128Introduction to Computing
Science for Engineering Students Computer Components
© Janice Regan, CMPT 128, Sept. 2007 -2012 46
Hardware and Software A computer is a machine designed to perform
operations specified with a set of instructions called a program.
Hardware refers to the computer equipment. Peripheral Input devices: keyboard, mouse, Peripheral Output devices: screen, disk, DVD, printer Processing/storage devices: cpu, RAM, ROM, DVD
Software refers to the programs that describe the steps we want the computer to perform.
© Janice Regan, CMPT 128, Sept. 2007 -2012 47
CPU
Computer Hardware CPU –
Central processing unit ALU –
Arithmetic and logic unit ROM –
Read only memory RAM –
Random access memory
InternalMemory
ExternalMemory
InputDevices
?
OutputDevices
?
Processor
ALU
Cache/Memory
© Janice Regan, CMPT 128, Sept. 2007 -2012 48
Central Processing Unit (CPU, ALU) Performs arithmetic
The processor adds, subtracts, multiplies and divides binary numbers using the Arithmetic Logic Unit, ALU
Makes comparisons The processor can check if two “numbers” are equal,
and determine if one is “larger” or “smaller” than the other
Moves bits (binary digits) Knows how to access any RAM (or ROM) address Can copy data to or from any memory address and
its own onboard memory
Information storage Primary Storage: RAM, ROM
requires power to store information Secondary Storage: Disk, DVD, thumb
drives, SD cards … Less expensive (so more plentiful) Information persists even without power Stores information that is loaded into primary
storage (like programs and data) to be used
© Janice Regan, CMPT 128, Sept. 2007 -2012 49
© Janice Regan, CMPT 128, Sept. 2007 -2012 52
Computer Software: Applications
Application Software (Software Tools) Word processors (Microsoft Word, WordPerfect, ...) Spreadsheet programs (Excel, Lotus1-2-3, ...) Computer games Communication software (email, chat, web
browser…) Telecommunication software (VOIP, …) Programming environments (Visual Studio, Eclipse) OTHERS?
© Janice Regan, CMPT 128, Sept. 2007 -2012 53
Computer Software: Languages Some Computer Languages
Machine language (machine instruction set) assembly language high level languages
C, C++, Ada, Fortran, Basic, Java Do YOU know of any others? mathematical computation and symbolic manipulation tools
(MATLAB, Mathematica, ...) Application software is written using computer
languages.
© Janice Regan, CMPT 128, Sept. 2007 -2012 54
Machine language Each type of processor (like i7, Pentium 4,
Athalon, Z80, …) has its own instruction set Each instruction in an instruction set does a
single thing like access a piece of data, add two pieces of data, compare two pieces of data …
Each instruction is represented by a unique number This # may be different for different instruction sets, but no two instructions in the same instruction set will have the same #
© Janice Regan, CMPT 128, Sept. 2007 -2012 55
Machine Language programs In machine language a program is a list of
instructions Each instruction is represented by a number Inside the memory of the computer each
number is represented in binary (as a constant length string of 1’s and 0’s)
The long string of 0’s and 1’s is easy for the computer to understand and very difficult for a Human to read or write
© Janice Regan, CMPT 128, Sept. 2007 -2012 56
Assembler Assembler languages make it easier for
the programmer. Assembler is easier for humans to read/write The numbers that identify each of the
instructions in the instruction set are replaced with mnemonics like ADD, CMP, …
The code, written using these mnemonics is written into a text file.
© Janice Regan, CMPT 128, Sept. 2007 -2012 57
Assembler Programs The code for an Assembler program is written
into a text file. The computer read 1’s and 0’s not text How do we translate to machine readable form?
A computer program called a compiler is used to translate the text file (called a source file) containing the assembler code into machine readable code
The compiler writes a binary file containing the machine readable code (called an object file)
© Janice Regan, CMPT 128, Sept. 2007 -2012 58
Programs in High Level Languages Assembler is easier to read/write than machine
language. It is still very cumbersome High level languages are easier to write than
assembler The compiler is more complex, but that is a tool you
use, not one you write In this course we will learn the language C++ Many ideas we will discuss in this course are
equally applicable to C++ or to any other compiled high level language (C, Fortran, …)