Review for midterm exam Dilshad M. Shahid Spring NYU.

Slides:



Advertisements
Similar presentations
Engineering EG167C - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect M1 P. 1Winter Quarter Midterm I Review.
Advertisements

Lecture 2 Introduction to C Programming
Chapter 5 C Functions The best way to develop and maintain a large program is to divide it into several smaller program modules, each of which is more.
COMP1180 Review Date: 4 March, 2009 Time: 10:30am - 12:20pm Venue: –CS students -- FSC801C and FSC801D –IS and other students -- OEE1017 Remarks: – 1)
C Lecture Notes 1 Program Control (Cont...). C Lecture Notes 2 4.8The do / while Repetition Structure The do / while repetition structure –Similar to.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 5 - Functions Outline 5.1Introduction 5.2Program Modules in C 5.3Math Library Functions 5.4Functions.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 5 - Functions Outline 5.1Introduction 5.2Program.
Wednesday, 12/11/02, Slide #1 CS 106 Intro to Comp. Sci. 1 Wednesday, 12/11/02  QUESTIONS??  Today: CLOSING CEREMONIES!  HW #5 – Back Monday (12/16)
Wednesday, 10/9/02, Slide #1 CS 106 Intro to CS 1 Wednesday, 10/9/02  QUESTIONS ??  Today:  Discuss HW #02  Discuss test question types  Review 
 2007 Pearson Education, Inc. All rights reserved C Functions.
 2007 Pearson Education, Inc. All rights reserved C Functions.
CS 117 Spring 2002 Review for Exam 2 March 6, 2002 open book, 1 page of notes.
16/27/ :53 PM6/27/ :53 PM6/27/ :53 PMLogic Control Structures Arithmetic Expressions Used to do arithmetic. Operations consist of +,
Topic R3 – Review for the Final Exam. CISC 105 – Review for the Final Exam Exam Date & Time and Exam Format The final exam is 120-minutes, closed- book,
Functions Dilshad M. Shahid New York
 2007 Pearson Education, Inc. All rights reserved C Program Control.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 4 - Program Control Outline 4.1Introduction 4.2The Essentials of Repetition 4.3Counter-Controlled.
C Lecture Notes Functions (Cont...). C Lecture Notes 5.8Calling Functions: Call by Value and Call by Reference Used when invoking functions Call by value.
COMP1170 Midterm Preparation (March 17 th 2009) Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education.
CMSC 104, Version 8/061L18Functions1.ppt Functions, Part 1 of 4 Topics Using Predefined Functions Programmer-Defined Functions Using Input Parameters Function.
13&14-2 Know the forms of loop statements in C (while,do/while,for). Understanding how data conversion occurs. Read/Write data in files using Unix redirection.
 2000 Prentice Hall, Inc. All rights reserved. 1 Chapter 4 - Program Control Outline 4.1Introduction 4.2The Essentials of Repetition 4.3Counter-Controlled.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. C How To Program - 4th edition Deitels Class 05 University.
 2007 Pearson Education, Inc. All rights reserved C Functions.
Lecture 4 C Program Control Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc.
1 4.8The do/while Repetition Structure The do/while repetition structure –Similar to the while structure –Condition for repetition tested after the body.
CMSC 1041 Functions II Functions that return a value.
Lecture 2: Introduction to C Programming. OBJECTIVES In this lecture you will learn:  To use simple input and output statements.  The fundamental data.
Chapter 5 - Functions Outline 5.1Introduction 5.2Program Modules in C 5.3Math Library Functions 5.4Functions 5.5Function Definitions 5.6Function Prototypes.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Flow Control (for) Outline 4.1Introduction 4.2The.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 5 - Functions Outline 5.1Introduction 5.2Program.
EPSII 59:006 Spring Call-by-value example #include void increment(int); //prototype for increment function int main(void) { int a=1; printf("Value.
Sections 5.1 – 5.4 © Copyright by Pearson Education, Inc. All Rights Reserved.
Functions: Part 2 of /11/10: Lecture 16 CMSC 104, Section 0101 John Y. Park 1.
By Mr. Muhammad Pervez Akhtar
Lecture 15: Course Review BJ Furman ME 30 16MAY2011.
C Language 1 Program Looping. C Language2 Topics Program looping Program looping Relational operators / expressions Relational operators / expressions.
C Program Control September 15, OBJECTIVES The essentials of counter-controlled repetition. To use the for and do...while repetition statements.
CS 1428 Final Exam Review. Exam Format 200 Total Points – 60 Points Writing Programs – 45 Points Tracing Algorithms and determining results – 20 Points.
L131 Assignment Operators Topics Increment and Decrement Operators Assignment Operators Debugging Tips rand( ) math library functions Reading Sections.
Chapter 4 – C Program Control
Functions Course conducted by: Md.Raihan ul Masood
Exam 2 Review.
Lecture 7: Repeating a Known Number of Times
Functions, Part 2 of 2 Topics Functions That Return a Value
Control Statements: Part 2
C++, OBJECT ORIENTED PROGRAMMING
Chapter 4 - Program Control
BY GAWARE S.R. COMPUTER SCI. DEPARTMENT
Deitel- C:How to Program (5ed)
Chapter 5 - Functions Outline 5.1 Introduction
Chapter 5 - Functions Outline 5.1 Introduction
2008/11/10: Lecture 16 CMSC 104, Section 0101 John Y. Park
Chapter 5 - Functions Outline 5.1 Introduction
Chapter 6 - Functions Outline 5.1 Introduction
Chapter 4 - Program Control
Functions, Part 2 of 3 Topics Functions That Return a Value
CS 1428 Final Exam Review.
Assignment Operators Topics Increment and Decrement Operators
Assignment Operators Topics Increment and Decrement Operators
CS 1428 Final Exam Review.
Introduction to C Programming
Fundamental Programming
1-6 Midterm Review.
Final Review Bina Ramamurthy 4/15/2019 BR.
Chapter 4 - Program Control
Assignment Operators Topics Increment and Decrement Operators
Functions, Part 2 of 3 Topics Functions That Return a Value
Functions, Part 2 of 3 Topics Functions That Return a Value
Presentation transcript:

Review for midterm exam Dilshad M. Shahid Spring NYU

Today §Various topics in Chapters 2 - 5

Chapter 2 topics §variables - integers, floats, characters §variable declarations, assignment statements §main() §printf §scanf (remember the &, no output formatting) §format conversion string %d for integers, %f for floats, %c for characters

Chapter 2 topics §Memory concepts §destructive read-in, nondestructive read-out §precedence of arithmetic operators l () l *, / or % l + or - §Equality and relational operators, e.g. ==, !=, >=

Chapter 3 topics §Control structures goto is bad (leads to spaghetti code i.e. unstructured programming)

Chapter 3 topics §Selection structure l if l if/else l switch § If - all or nothing (only one option) §If/else - two options §Switch - many options §Can have multiple if/else statements to have more than two options §All switch statements can be rewritten as multiple if/else statements

Chapter 3 topics §Repetition structure l while l for § Use while when number of iterations is not known in advance §Use for when a fixed of iterations are to be made

Chapter 3 topics §Assignment operators, e.g. c += 3 l c += 3 corresponds to c = c + 3 l operators can be +, -, *, /, % §Increment/Decrement Operators, e.g. a++ l check out Fig 3.12 on page 80 in your text §Also check out Fig 3.14 for precedence of operators discussed up to Chapter 3

Chapter 4 topics §Counter controlled repetition §Sentinel controlled repetition §Switch in detail §Logical operators: &&, || and ! l Check out the truth tables for && and || §Fig 4.16 for operator precedence and associativity

Chapter 5 topics §Functions l definition (or body) l function prototype l general structure - input parameters, return variable l calling (or invoking) functions

Chapter 5 topics §Scope rules §Storage classes §Header files (standard and custom) §Call by value vs call by reference §Random Number Generation rand(), srand §Recursion l definition l recursion vs iteration