×

### Let's log you in.

or

Don't have a StudySoup account? Create one here!

×

or

## CS 159, Chs 5 - 7 (What was covered for Midterm 2)

by: Constanza Fernandez

230

1

3

# CS 159, Chs 5 - 7 (What was covered for Midterm 2) CS 15900

Marketplace > Purdue University > ComputerScienence > CS 15900 > CS 159 Chs 5 7 What was covered for Midterm 2
Constanza Fernandez
Purdue

Get a free preview of these Notes, just enter your email below.

×
Unlock Preview

These notes cover everything from the book chapters 5 - 7 and also include lecture notes for all of these chapters.
COURSE
Programming Applications For Engineers
PROF.
Alan Robert Bunning
TYPE
Study Guide
PAGES
3
WORDS
CONCEPTS
CS, CS159, CS15900, programming, ComputerScience, Computer Science, Introduction to C Programming Language, C Programming Language, CS 15900, CS 159
KARMA
50 ?

## Popular in ComputerScienence

This 3 page Study Guide was uploaded by Constanza Fernandez on Wednesday April 20, 2016. The Study Guide belongs to CS 15900 at Purdue University taught by Alan Robert Bunning in Spring 2016. Since its upload, it has received 230 views. For similar materials see Programming Applications For Engineers in ComputerScienence at Purdue University.

×

## Reviews for CS 159, Chs 5 - 7 (What was covered for Midterm 2)

×

×

### What is Karma?

#### You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 04/20/16
Study Guide: CS Exam 2 Logical data: true 1, false 0 Logical and comparison operators: Positive expressions are preferred Do what makes most sense to you De Morgan’s Rule: to negate an expression, apply the not operator to each operand and switch and/or operators && Short circuit logic: if the 1 st expression is false, 2 nd is not st evaluated (use expression most likely to be false 1 ) st nd || Short circuit logic: if the 1 expression is true, 2 is not evaluated (use expression most likely to be true 1 ) st Selection statements When + than 1 statement One-way selection: if statement (nothing happens if false) after if/else, use {} Two-way selection: if…else statement -Block of statements- Multi-way selection: if…else if statement, switch statement If the else condition is not required/null statement: rewrite condition Nested if statements: use && operator Dangling else problem: since spacing is ignored by the Conditional expressions: 3 operands, 2 operators compiler, else is paired with most recent unpaired if expression ? expression1 : expression 2 Conditional expressions can also be nested, but should be avoided. Switch statement: control expression evaluates to multiple alternatives When the expression matches one of the constants, it Default: didn’t match executes from that point to any other the end unless you use “break” Character test functions: Repetition: series of instructions several times/iterations (executions). Looping: repeat instruction until terminating condition is reached.  Initialization: assign beginning values to variables before loop begins  Control expression: determines whether the body of the loop is to be executed  Control variable: regulates the number of times a loop is executed  Loop updating: process which changes something in the loop – will cause the loop to terminate Infinite loop: repeats endlessly (has no terminating condition or it isn’t reached. Interrupt it: CTRL-C Pre-test loop: control expression checked before loop is executed, body may never be executed (while or for) Post-test loop: control expression checked after loop is executed, body executed at least once (do…while) 1. While statement: most common, body executed when condition remains true. 2. For statement: loop choice executed for a finite number of iterations. Use ONLY with counter controlled processes, make use of all 3 expressions with every for loop 3. Do…while statement: executes body at least once, use for input validation Input validation:  Use function to collect user’s input & return it as single value  Provide user with unlimited opportunities  Do not validate for particular data types  Display error message when user makes a mistake Do not use: Don’t use 1. Goto statement: jump from one location to another in a break or comma program, may produce unpredictable results & violates operator rules 2. Break statement: jumps to the end of a control statement 3. Continue statement: jumpts to beginning of control statement 4. Comma expressions: multiple expressions separated by commas 5. Recursion: function calls itself to solve smaller part of same problem Big-O Notation Standard input/output: Scanf – stdin, Printf - stdout Using files in a program when:  So much output it scrolls off screen  Too much data to be typed  Don’t want to type anymore

×

×

### BOOM! Enjoy Your Free Notes!

×

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

## Why people love StudySoup

Jim McGreen Ohio University

#### "Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

Kyle Maynard Purdue

#### "When you're taking detailed notes and trying to help everyone else out in the class, it really helps you learn and understand the material...plus I made \$280 on my first study guide!"

Steve Martinelli UC Los Angeles

#### "There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Parker Thompson 500 Startups

#### "It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

Become an Elite Notetaker and start selling your notes online!
×

### Refund Policy

#### STUDYSOUP CANCELLATION POLICY

All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email support@studysoup.com

#### STUDYSOUP REFUND POLICY

StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here: support@studysoup.com

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to support@studysoup.com