×
Log in to StudySoup
Get Full Access to Purdue - AAE 159 - Study Guide - Final
Join StudySoup for FREE
Get Full Access to Purdue - AAE 159 - Study Guide - Final

Already have an account? Login here
×
Reset your password

PURDUE / Computer science / CS 15900 / How are pre-test loops conducted?

How are pre-test loops conducted?

How are pre-test loops conducted?

Description

School: Purdue University
Department: Computer science
Course: C Programming
Professor: Alan bunning
Term: Spring 2017
Tags: Arrays, loops, selection, Sorting, Pointers, and strings
Cost: 50
Name: CS 159 Final Exam Study Guide
Description: Hey. These are my first set of notes. Sorry if my handwriting is a little bad. I'm currently repeated this class, so that's why some material from the beginning of class is missing. Most of that materi
Uploaded: 05/03/2017
7 Pages 121 Views 2 Unlocks
Reviews


.lst-kix_hbkiadb4bsll-7 > li:before{content:"○ "}.lst-kix_hbkiadb4bsll-6 > li:before{content:"● "}.lst-kix_hbkiadb4bsll-1 > li:before{content:"○ "}.lst-kix_hbkiadb4bsll-0 > li:before{content:"● "}.lst-kix_hbkiadb4bsll-8 > li:before{content:"■ "}ul.lst-kix_krl6cmkppdih-8{list-style-type:none}.lst-kix_hbkiadb4bsll-2 > li:before{content:"■ "}ul.lst-kix_krl6cmkppdih-6{list-style-type:none}ul.lst-kix_krl6cmkppdih-7{list-style-type:none}.lst-kix_hbkiadb4bsll-3 > li:before{content:"● "}ul.lst-kix_krl6cmkppdih-4{list-style-type:none}ul.lst-kix_krl6cmkppdih-5{list-style-type:none}.lst-kix_m1pvxfifxt9u-3 > li:before{content:"● "}ul.lst-kix_krl6cmkppdih-2{list-style-type:none}ul.lst-kix_krl6cmkppdih-3{list-style-type:none}.lst-kix_hbkiadb4bsll-5 > li:before{content:"■ "}.lst-kix_m1pvxfifxt9u-4 > li:before{content:"○ "}ul.lst-kix_krl6cmkppdih-0{list-style-type:none}ul.lst-kix_krl6cmkppdih-1{list-style-type:none}.lst-kix_hbkiadb4bsll-4 > li:before{content:"○ "}.lst-kix_m1pvxfifxt9u-6 > li:before{content:"● "}.lst-kix_m1pvxfifxt9u-5 > li:before{content:"■ "}.lst-kix_m1pvxfifxt9u-7 > li:before{content:"○ "}.lst-kix_yqn97015ov7c-0 > li:before{content:"● "}.lst-kix_yqn97015ov7c-3 > li:before{content:"● "}.lst-kix_yqn97015ov7c-1 > li:before{content:"○ "}.lst-kix_m1pvxfifxt9u-8 > li:before{content:"■ "}.lst-kix_yqn97015ov7c-2 > li:before{content:"■ "}.lst-kix_yqn97015ov7c-6 > li:before{content:"● "}.lst-kix_yqn97015ov7c-7 > li:before{content:"○ "}.lst-kix_yqn97015ov7c-4 > li:before{content:"○ "}.lst-kix_yqn97015ov7c-8 > li:before{content:"■ "}.lst-kix_yqn97015ov7c-5 > li:before{content:"■ "}ul.lst-kix_m1pvxfifxt9u-6{list-style-type:none}ul.lst-kix_m1pvxfifxt9u-7{list-style-type:none}ul.lst-kix_m1pvxfifxt9u-4{list-style-type:none}ul.lst-kix_m1pvxfifxt9u-5{list-style-type:none}ul.lst-kix_m1pvxfifxt9u-8{list-style-type:none}.lst-kix_x2b5iltsie1-8 > li:before{content:"■ "}ul.lst-kix_m1pvxfifxt9u-2{list-style-type:none}ul.lst-kix_m1pvxfifxt9u-3{list-style-type:none}ul.lst-kix_m1pvxfifxt9u-0{list-style-type:none}ul.lst-kix_m1pvxfifxt9u-1{list-style-type:none}.lst-kix_x2b5iltsie1-4 > li:before{content:"○ "}.lst-kix_x2b5iltsie1-3 > li:before{content:"● "}.lst-kix_x2b5iltsie1-5 > li:before{content:"■ "}ul.lst-kix_txisid9c586o-0{list-style-type:none}ul.lst-kix_txisid9c586o-1{list-style-type:none}.lst-kix_x2b5iltsie1-7 > li:before{content:"○ "}.lst-kix_x2b5iltsie1-6 > li:before{content:"● "}.lst-kix_x2b5iltsie1-0 > li:before{content:"● "}ul.lst-kix_txisid9c586o-4{list-style-type:none}ul.lst-kix_txisid9c586o-5{list-style-type:none}.lst-kix_x2b5iltsie1-1 > li:before{content:"○ "}ul.lst-kix_txisid9c586o-2{list-style-type:none}ul.lst-kix_txisid9c586o-3{list-style-type:none}.lst-kix_x2b5iltsie1-2 > li:before{content:"■ "}ul.lst-kix_txisid9c586o-8{list-style-type:none}ul.lst-kix_txisid9c586o-6{list-style-type:none}ul.lst-kix_txisid9c586o-7{list-style-type:none}.lst-kix_bz7m8d8yc1zb-8 > li:before{content:"■ "}ul.lst-kix_9ts3ixwvklal-2{list-style-type:none}ul.lst-kix_9ts3ixwvklal-3{list-style-type:none}ul.lst-kix_hbkiadb4bsll-0{list-style-type:none}ul.lst-kix_9ts3ixwvklal-0{list-style-type:none}ul.lst-kix_hbkiadb4bsll-1{list-style-type:none}ul.lst-kix_9ts3ixwvklal-1{list-style-type:none}ul.lst-kix_hbkiadb4bsll-2{list-style-type:none}ul.lst-kix_9ts3ixwvklal-6{list-style-type:none}ul.lst-kix_9ts3ixwvklal-7{list-style-type:none}.lst-kix_bz7m8d8yc1zb-0 > li:before{content:"● "}.lst-kix_bz7m8d8yc1zb-1 > li:before{content:"○ "}ul.lst-kix_9ts3ixwvklal-4{list-style-type:none}ul.lst-kix_9ts3ixwvklal-5{list-style-type:none}.lst-kix_bz7m8d8yc1zb-2 > li:before{content:"■ "}ul.lst-kix_9ts3ixwvklal-8{list-style-type:none}.lst-kix_bz7m8d8yc1zb-4 > li:before{content:"○ "}.lst-kix_bz7m8d8yc1zb-5 > li:before{content:"■ "}.lst-kix_bz7m8d8yc1zb-3 > li:before{content:"● "}.lst-kix_bz7m8d8yc1zb-7 > li:before{content:"○ "}.lst-kix_bz7m8d8yc1zb-6 > li:before{content:"● "}ul.lst-kix_x2b5iltsie1-1{list-style-type:none}.lst-kix_txisid9c586o-7 > li:before{content:"○ "}ul.lst-kix_x2b5iltsie1-2{list-style-type:none}ul.lst-kix_x2b5iltsie1-0{list-style-type:none}.lst-kix_txisid9c586o-5 > li:before{content:"■ "}.lst-kix_txisid9c586o-6 > li:before{content:"● "}ul.lst-kix_bz7m8d8yc1zb-8{list-style-type:none}ul.lst-kix_bz7m8d8yc1zb-6{list-style-type:none}ul.lst-kix_bz7m8d8yc1zb-7{list-style-type:none}ul.lst-kix_bz7m8d8yc1zb-4{list-style-type:none}ul.lst-kix_bz7m8d8yc1zb-5{list-style-type:none}ul.lst-kix_bz7m8d8yc1zb-2{list-style-type:none}ul.lst-kix_bz7m8d8yc1zb-3{list-style-type:none}.lst-kix_txisid9c586o-0 > li:before{content:"● "}.lst-kix_txisid9c586o-8 > li:before{content:"■ "}ul.lst-kix_bz7m8d8yc1zb-0{list-style-type:none}ul.lst-kix_bz7m8d8yc1zb-1{list-style-type:none}ul.lst-kix_hbkiadb4bsll-3{list-style-type:none}ul.lst-kix_hbkiadb4bsll-4{list-style-type:none}ul.lst-kix_x2b5iltsie1-7{list-style-type:none}ul.lst-kix_hbkiadb4bsll-5{list-style-type:none}ul.lst-kix_x2b5iltsie1-8{list-style-type:none}ul.lst-kix_hbkiadb4bsll-6{list-style-type:none}ul.lst-kix_x2b5iltsie1-5{list-style-type:none}ul.lst-kix_hbkiadb4bsll-7{list-style-type:none}ul.lst-kix_x2b5iltsie1-6{list-style-type:none}ul.lst-kix_hbkiadb4bsll-8{list-style-type:none}ul.lst-kix_x2b5iltsie1-3{list-style-type:none}ul.lst-kix_x2b5iltsie1-4{list-style-type:none}.lst-kix_9ts3ixwvklal-1 > li:before{content:"○ "}.lst-kix_9ts3ixwvklal-3 > li:before{content:"● "}.lst-kix_krl6cmkppdih-0 > li:before{content:"● "}.lst-kix_krl6cmkppdih-2 > li:before{content:"■ "}.lst-kix_9ts3ixwvklal-0 > li:before{content:"● "}.lst-kix_9ts3ixwvklal-4 > li:before{content:"○ "}.lst-kix_krl6cmkppdih-1 > li:before{content:"○ "}.lst-kix_krl6cmkppdih-5 > li:before{content:"■ "}.lst-kix_m1pvxfifxt9u-2 > li:before{content:"■ "}.lst-kix_m1pvxfifxt9u-1 > li:before{content:"○ "}.lst-kix_krl6cmkppdih-4 > li:before{content:"○ "}.lst-kix_m1pvxfifxt9u-0 > li:before{content:"● "}.lst-kix_9ts3ixwvklal-2 > li:before{content:"■ "}.lst-kix_krl6cmkppdih-3 > li:before{content:"● "}.lst-kix_krl6cmkppdih-8 > li:before{content:"■ "}.lst-kix_txisid9c586o-1 > li:before{content:"○ "}ul.lst-kix_yqn97015ov7c-8{list-style-type:none}.lst-kix_txisid9c586o-2 > li:before{content:"■ "}ul.lst-kix_yqn97015ov7c-6{list-style-type:none}ul.lst-kix_yqn97015ov7c-7{list-style-type:none}.lst-kix_9ts3ixwvklal-8 > li:before{content:"■ "}.lst-kix_txisid9c586o-3 > li:before{content:"● "}ul.lst-kix_yqn97015ov7c-4{list-style-type:none}ul.lst-kix_yqn97015ov7c-5{list-style-type:none}ul.lst-kix_yqn97015ov7c-2{list-style-type:none}ul.lst-kix_yqn97015ov7c-3{list-style-type:none}.lst-kix_9ts3ixwvklal-5 > li:before{content:"■ "}.lst-kix_9ts3ixwvklal-7 > li:before{content:"○ "}.lst-kix_krl6cmkppdih-6 > li:before{content:"● "}ul.lst-kix_yqn97015ov7c-0{list-style-type:none}ul.lst-kix_yqn97015ov7c-1{list-style-type:none}.lst-kix_txisid9c586o-4 > li:before{content:"○ "}.lst-kix_9ts3ixwvklal-6 > li:before{content:"● "}.lst-kix_krl6cmkppdih-7 > li:before{content:"○ "}

CS 159 We also discuss several other topics like How can unusual levels of exposure in preganancy affect later behaviors of child?

CHAPTER 6 to 11If you want to learn more check out What is meant by business promotion?

Most important for finalIf you want to learn more check out What are the 4 components of personality?

Repetition and LearningIf you want to learn more check out How has mass media changed over time?

repeated until terminating condition is reached

  • Initialization- assigning beginning values to variables before the loop begins
  • Central Expression- expression that determines whether body of the loop is executed or not
  • Control Variable- regulates the number of executions
  • Loop Updating- changes something in the loop (will cause loop to terminate)

Don't forget about the age old question of Do some taxonomic groups share the same shape?
If you want to learn more check out What term is used for picture representations of ideas or objects?

int main (void)

        int count = 1;                         initialization

        while (count <= 10)                control expression; “count” : control variable

        print f (“7odln”, count);

        count ++;                        loop updating

        return 0;

  • Infinite Loop- term condition is non-existent or never reached
  • A computer could become nonresponsive
  • May consume all resources
  • Stopped by CTRL - C

  • Pre-test Loops
  • Control expression checked before
  • May never be executed
  • Used for “while” or “for loops
  • Post-test Loops
  • Control expression checked after
  • Executed at least once
  • Used for “do…..while” loops

  • While Loop: body of loop is executed while condition is true
  • For Loop
  • Finite iterations
  • Quicker to read than while loop
  • for (initialization; condition; update)

{instructions}

  • only use for counter controlled loop
  • do….while Loop
  • Always executes at least once
  • do

{instructions} while (condition)

  • Input Validations
  • Unlimited tries to enter data
  • Must display an appropriate error message
  • Don’t need to validate the data type
  • Returning a single value preferred than pass by address

  • Avoid Loop Constructs
  • Cannot use “break”, “continue”, or “go to” are not allowed
  • Comma operator is also not allowed

  • Nested Loops
  • Each loop has its own control expression
  • Each can be a separate function

  • Recursion
  • Must at least reduce the problem
  • Can be written with standard loops
  • Must be a base case where the problem can be solved successfully
  • Use is discouraged and should never be used in the course
  • Each interaction acts independently
  • New local variables are created at each iteration (increases memory usage)

File Input or Output

  • Use files when →
  • Output scrolls off-screen
  • Too much to type
  • Repeat typing

  • Redirection

<        redirect input from a specified source

>        redirect output from a specified source

<<        redirect standard input from inline stream between delimiters

>>        redirect standard output to append data to a specified source

|        receive output from one source and use it for another

  • Files- determined by how application treats a file
  • Text files- series of ASCII characters
  • Binary files- series of 0’s and 1’s
  • Only deal with text files in the course

Open file                 →                 process file                 →                 close file

  • File handle is a variable
  • Specific files must be open before accessed
  • Read until EOF is reached
  • Size is number of elements read at a time
  • Use fprintf to write or append to a specific file stream, EOF is added when closed
  • Every file used with “fopen” must later be closed with “fclose”
  • If file can’t be opened a -1 is assigned to file handle

fopen modes

r- marker at the beginning → if not error is given

w- erased, marker at the beginning → if not, files is created

a- marker at the end →

Arrays

  • Size should be declared by a defined constant, which should also be used to reference the bounds of the array.
  • Variable-length arrays are not implemented in the compiler and are not allowed in the course
  • Can be defined, omitted as it is initialized, partially zeroed, or zeroed
  • Each element is treated like an individual variable
  • Can’t assign all of one array to another array at once.

Page Expired
5off
It looks like your free minutes have expired! Lucky for you we have all the content you need, just sign up here